Client authentication method and device of object storage system, medium and equipment
By using token mechanism and dual encryption technology in object storage systems, the security risks and usage statistics of user authentication and resource billing are solved, and high security and flexible resource management are achieved.
Patent Information
- Application Number
- CN202411156167.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-22
AI Technical Summary
The existing object storage system has security risks of key leakage and difficulty in resource usage statistics in terms of user authentication and resource billing, and it is impossible to charge based on usage.
By introducing a token mechanism in the object storage system, the token includes a plain secret key, a cryptographic secret key, an effective time, permission policy and role name, and conducts legality judgment and permission verification, and billing according to the role name. Double encryption technology protects tokens.
It improves the security of the object storage system, reduces management complexity, realizes on-demand billing, enhances the adaptability and scalability of the system, reduces the risk of secret key leakage, and improves the overall security protection capability.
Smart Images

Figure CN118965335A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method, device, medium, and equipment for authenticating an object storage system to a client. Background Art
[0002] Existing object storage systems can only perform user authentication through plaintext keys and ciphertext keys through a signature algorithm to ensure the legitimacy of user access. Object storage systems classify requests that do not carry signature information as anonymous requests, which can only access resources with public read and write permissions. This means that when writing applications or using components to connect to object storage systems, the user's plaintext keys and ciphertext keys need to be configured in the application or component configuration file. This process poses a security risk of key leakage.
[0003] Object storage systems have only one way to bill for access to these resources: charging the resource owner for all resource usage fees. This makes it impossible to count resource usage by different applications or components and charge the application or component based on usage. Summary of the invention
[0004] In response to at least one of the above technical problems, an embodiment of the present invention provides a method, apparatus, medium, and device for authenticating a client by an object storage system.
[0005] According to a first aspect, an object storage system authentication method for a client provided by an embodiment of the present invention is executed by the object storage system, and the method includes:
[0006] Upon receiving an access request sent by the first client, obtaining a token in the access request; wherein the token includes a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field;
[0007] Determining whether the token has timed out according to the effective time in the effective time field;
[0008] If it has not timed out, determining whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal;
[0009] If it is legal, then if the permission policy field is not empty, determining whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field;
[0010] If the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field, the first client is authenticated, a query is performed on the object storage resource, the queried object storage resource is returned to the first client, and the resource access of the first client is billed according to the role name in the role name field.
[0011] In one embodiment, the method further includes any of the following:
[0012] If the token times out, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client;
[0013] If the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client;
[0014] If the permission policy field is not empty, and the object storage resource that the first client wants to access is not allowed to be accessed by the permission policy in the permission policy field, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client.
[0015] In one embodiment, the method further comprises:
[0016] If the authority policy field is empty, then obtain the role attribute group where the role name in the role name field is located; wherein the role attribute group includes the role name, the authority policy corresponding to the role name, and path information; the role name is used to mark the identity of the user, and the path information is used to mark the logical position of the user, and the logical position includes the client name of the user;
[0017] Determine whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the role attribute group, and whether the first client is consistent with the path information;
[0018] If it is allowed and the first client is consistent with the path information, the authentication of the first client is successful;
[0019] If it is not allowed and / or the first client is inconsistent with the path information, the authentication of the first client fails.
[0020] In one embodiment, the permission policy includes whether the permission policy is allowed to be executed or denied to be executed, the object storage resource scope and the operation type;
[0021] Correspondingly, it is determined whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy, including: if the permission policy is allowed to be executed, the object storage resource that the first client wants to access is within the scope of the object storage resource and the operation type includes query access, then the object storage resource that the first client wants to access is allowed to be accessed by the permission policy.
[0022] In one embodiment, the token further includes first key signature information, and the first key signature information is obtained by encrypting the plaintext key and the ciphertext key when the object storage system issues the token;
[0023] Correspondingly, the determining whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal includes:
[0024] Encrypting the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field to obtain second key signature information;
[0025] Determine whether the first secret key signature information and the second secret key signature information are consistent;
[0026] If the two are consistent, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal;
[0027] Otherwise, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal.
[0028] In one embodiment, the method further comprises:
[0029] When receiving a token application request sent by the second client, generating a plaintext key and a ciphertext key according to a random algorithm, wherein the plaintext key and the ciphertext key are both strings of fixed length;
[0030] Encrypting the plaintext key and the ciphertext key to obtain first key signature information;
[0031] Determine the validity period of the token, the authority policy, and the role name of the second client;
[0032] Generate a token according to the first key signature information, the plaintext key, the ciphertext key, the effective time, the authority policy and the role name of the second client, and send the token to the second client;
[0033] The second client is used to apply for a token from the object storage system when a token needs to be issued to the first client, and pass the token to the first client after obtaining the token, so that the first client can access the object storage system based on the token.
[0034] In one embodiment, the method further comprises at least one of the following:
[0035] Clean up the timed-out tokens;
[0036] Before the token is sent to the second client, the token is encrypted for the first time using an encryption string, and the first encrypted token is encrypted for the second time. The first encryption and the second encryption use different encryption algorithms, and the encryption string is the encryption string set by the object storage gateway administrator or the system default encryption string.
[0037] According to a second aspect, an object storage system according to an embodiment of the present invention provides an authentication device for a client, which is deployed on the object storage system, and the device includes:
[0038] A token acquisition module, configured to acquire a token in an access request when receiving an access request sent by a first client; wherein the token includes a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field;
[0039] A timeout determination module, used to determine whether the token has timed out according to the effective time in the effective time field;
[0040] A key judgment module, used for judging whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal if the timeout has not occurred;
[0041] a policy judgment module, configured to judge, if legal, whether the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy in the permission policy field if the permission policy field is not empty;
[0042] The first processing module is used to authenticate the first client, query the object storage resources, return the queried object storage resources to the first client, and perform billing processing on the resource access of the first client according to the role name in the role name field if the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field.
[0043] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.
[0044] According to a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.
[0045] The object storage system provided by the embodiment of the present invention is a client authentication method, device, medium, and equipment. When receiving an access request sent by a first client, the object storage system obtains a token in the access request, determines whether the token has timed out according to the effective time in the effective time field, determines whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal, and determines whether the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy in the permission policy field when the permission policy field is not empty; if it has not timed out, the key is legal, and the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy, the authentication of the first client is passed, the object storage resource is queried, the queried object storage resource is returned to the first client, and the resource access of the first client is charged according to the role name in the role name field. Based on the above steps, it can be ensured that only legal users can access the specified resources within the specified time, thereby improving security. The introduction of roles makes the adjustment of permission policies no longer rely on direct operations on each user, but can be managed in batches through roles, reducing management complexity, while improving the efficiency and security of resource use, simplifying management and optimizing resource utilization. The introduction of permission policies allows for customized permissions for specific scenarios or tasks without changing the basic permissions of the role, which enhances the adaptability and scalability of the system. It can be seen that the embodiments of the present invention introduce effective time, keys, permission policies, roles, etc. into the token, which can improve the security level and enhance the overall security protection capabilities of the object storage system. Moreover, based on the method provided by the embodiments of the present invention, enterprises can more conveniently implement standardized security policies, promote compliance management, reduce human errors, and enhance system flexibility and scalability. Based on the embodiments of the present invention, it is not necessary to configure the user's plaintext secret key and ciphertext secret key into the configuration file of the application or component, reducing the security risk of key leakage. Moreover, the embodiments of the present invention can implement on-demand billing based on roles, instead of charging as a whole, and the charging is more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The figure is a flow chart of a method for authenticating a client by an object storage system in one embodiment of the present invention;
[0047] Figure 2 The structure diagram of the authentication device of the object storage system to the client in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] In a first aspect, an embodiment of the present invention provides a method for authenticating a client by an object storage system, the method being executed by the object storage system, see Figure 1 , the method comprises the following steps S110 to S150:
[0049] S110. Upon receiving an access request sent by the first client, obtain a token in the access request; wherein the token includes a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field;
[0050] For example, in an actual scenario, when a client with permanent permissions, namely the second client mentioned below, needs to issue a token to a client with temporary permissions, namely the first client, the token is a temporary token. At this time, the second client will apply for a token from the object storage system, the object storage system will generate a token and send it to the second client, and the second client will pass the token to the first client. When the first client needs to access the object storage system, it will send an access request to the object storage system. The access request contains a token, and the token contains a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field.
[0051] S120, judging whether the token has timed out according to the effective time in the effective time field;
[0052] It can be seen that there is an effective time in the effective time field, so the object storage system will determine whether the token has timed out based on the effective time. If not, execute S130. If the token has timed out, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client.
[0053] S130, if it has not timed out, determining whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal;
[0054] In one embodiment, the token further includes first key signature information, and the first key signature information is obtained by the object storage system encrypting the plaintext key and the ciphertext key when issuing the token; correspondingly, the determining whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal may include:
[0055] Encrypt the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field to obtain second key signature information; determine whether the first key signature information and the second key signature information are consistent; if the two are consistent, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal; otherwise, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal.
[0056] It can be seen that the first key signature information is obtained by encrypting the plaintext key and the ciphertext key when the second client applies for a token. The first key signature information is placed in the token, and the token is sent to the second client. The second client passes the token to the first client. When the first client applies for access, it will carry the token in the access request, so that the first key signature information is obtained by the object storage system. The object storage system generates the second key signature information based on the plaintext key and the ciphertext key in the token, and then determines whether the first key signature information and the second key signature information are consistent. If they are consistent, it means that the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal. If they are inconsistent, it means that the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal.
[0057] Of course, if the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client.
[0058] S140: If legal, if the permission policy field is not empty, determine whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field;
[0059] It can be seen that if the permission policy field is not empty, the judgment is performed according to the permission policy in the permission policy field. Specifically, it is judged whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field.
[0060] Of course, if the permission policy field is not empty, and the object storage resource that the first client wants to access is not allowed by the permission policy in the permission policy field, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client.
[0061] In one embodiment, if the permission policy field is empty, a judgment can be made according to the permission policy corresponding to the role name in the role name field, that is, whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy corresponding to the role name in the role name field.
[0062] In one embodiment, the method provided by the embodiment of the present invention may further include the following 4 steps:
[0063] 1. If the authority policy field is empty, obtain the role attribute group in which the role name in the role name field is located; wherein the role attribute group includes the role name, the authority policy corresponding to the role name, and path information; the role name is used to mark the identity of the user, and the path information is used to mark the logical position of the user, and the logical position includes the client name of the user;
[0064] It is understandable that a role is a set of identities that can be used to proxy users. A role has a role name attribute, a path attribute, and a permission policy attribute. The role name attribute is used to mark the identity of the user, the path attribute is used to mark the logical location of the user, and the permission policy attribute determines the type of operation that the role can call and the scope of the object storage resources that can be operated.
[0065] The definition rules of the role name attribute, path attribute, and permission policy attribute are as follows:
[0066] (a) The name attribute is used to identify the user, for example: S3Access1.
[0067] (b) The path attribute marks the user's logical location and can include the application name and component name where the agent is located. For example: / application1 / component1 / .
[0068] (c) The permission policy attributes determine the types of operations that the role can call and the scope of object storage resources that can be operated. It contains the Effect field, the Principal field and the Action field. The Effect field indicates whether the permission policy allows or denies execution, and the value range is Allow, which means allowing execution, or Deny, which means denying execution. The Principal field indicates the scope of object storage resources. Object storage resources include user, bucket and object. The Action field indicates the type of operation. It can be seen that in one embodiment, the permission policy may include whether the permission policy is allowed or denied execution, the scope of object storage resources and the type of operation.
[0069] Here are some examples:
[0070] {"Effect":"Allow","Principal":{"OSS":["s3:bucket1"]},"Action":["s3:PutObject(Upload object)"]}.
[0071] 2. Determine whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the role attribute group, and whether the first client is consistent with the path information;
[0072] 3. If it is allowed and the first client is consistent with the path information, the authentication of the first client is successful;
[0073] 4. If it is not allowed and / or the first client is inconsistent with the path information, the authentication of the first client fails.
[0074] Among them, judging whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy may include: if the permission policy is allowed to be executed, the object storage resource that the first client wants to access is within the scope of the object storage resource and the operation type includes query access, then the object storage resource that the first client wants to access is allowed to be accessed by the permission policy.
[0075] That is, if the Effect field is allowed to execute, the object storage resource that the first client wants to access is within the scope of the content of the Principal field, and the operation type in the Action field includes query access, then the authentication of the first client is passed. If any one of the items does not meet the requirements, the authentication of the first client is not passed.
[0076] S150. If the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field, the first client is authenticated, and a query is performed on the object storage resource. The queried object storage resource is returned to the first client, and the resource access of the first client is charged according to the role name in the role name field.
[0077] It can be seen that if the object storage resource that the first client wants to access is allowed by the permission policy, it is considered that the authentication of the first client is passed. At this time, the object storage resource query is performed based on the access request, and the queried object storage resource is returned to the first client, and the resource access of the first client is billed based on the role name in the role name field.
[0078] In one embodiment, the method provided by the embodiment of the present invention may further include the following 4 steps:
[0079] 1. Upon receiving a token application request sent by a second client, generate a plaintext key and a ciphertext key according to a random algorithm, wherein both the plaintext key and the ciphertext key are strings of fixed length;
[0080] 2. Encrypt the plaintext key and the ciphertext key to obtain first key signature information;
[0081] 3. Determine the validity period, authority policy and role name of the token;
[0082] 4. Generate a token based on the first key signature information, the plaintext key, the ciphertext key, the effective time, the permission policy and the role name of the second client, and issue the token to the second client;
[0083] The second client is used to apply for a token from the object storage system when a token needs to be issued to the first client, and pass the token to the first client after obtaining the token, so that the first client can access the object storage system based on the token.
[0084] The above 4 steps are the token generation process.
[0085] It is understandable that a token is a credential for accessing an object storage system. The object storage system uses the token to verify whether the user's identity is legitimate. The token has a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field. The definition rules for the plaintext key field, the ciphertext key field, the effective time field, the permission policy field, and the role name field are as follows:
[0086] Among them, the plaintext key and the ciphertext key are fixed-length strings generated by the object storage system using a random algorithm, and are bound to the token in a one-to-one mapping to ensure that the token is not misused. When the first client carries the token to access the gateway of the object storage system, it also carries the first key signature information, which is obtained by encrypting the plaintext key and the ciphertext key using the SHA1 algorithm. When the gateway of the object storage system verifies the access request of the first client, it obtains the plaintext key and the ciphertext key information bound to the token and performs the same SHA1 algorithm encryption process to obtain the second key signature information. If the second key signature information obtained is consistent with the first key signature information carried by the client, it means that the user's identity is legal and the token has not been leaked or misused.
[0087] The validity period is the validity period of the token. The gateway of the object storage system refuses the first client to access the object storage resource using the expired token. If the user does not set the validity period of the token, 3600 seconds is used as the default validity period.
[0088] Among them, the role name is used to bind the token and the role. A token can only be bound to one role. When the first client uses the token to access the object storage resource, the owner of the bound role will be charged, realizing the demand for reasonable charging according to resource usage.
[0089] When the permission policy field in the token is empty, the permission policy of the role bound to the token will take effect. When the permission policy field in the token is not empty, the permission policy in the permission policy field in the token will take effect.
[0090] In actual scenarios, the object storage system can periodically clean up expired tokens to prevent waste of storage space. At the same time, the encrypted string is stored. Only the object storage gateway administrator can set the encrypted string. The encrypted string should contain numbers, uppercase and lowercase letters, and special characters to ensure security.
[0091] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0092] Before the token is sent to the second client, the token is encrypted for the first time using an encryption string, and the first encrypted token is encrypted for the second time. The first encryption and the second encryption use different encryption algorithms, and the encryption string is the encryption string set by the object storage gateway administrator or the system default encryption string.
[0093] Before the token is encrypted for the first time using the encryption string, it is determined whether the object storage gateway administrator has set the encryption string. If not, a string of 36 characters containing numbers, uppercase and lowercase letters, and special characters is randomly generated as the encryption string and stored as the default encryption string. The user can delete the default encryption string and replace it with a specified encryption string that meets security requirements. The token is encrypted using the AES256 algorithm using the encryption string to achieve the first encryption. In order to prevent the token from being intercepted and decrypted, the token encrypted with the first encryption using the AES256 algorithm needs to be encrypted with the second encryption using the Base64 algorithm. The transmission security of the double-encrypted token is significantly improved.
[0094] It can be seen that the embodiments of the present invention can improve the security level by introducing the effective time and role into the token. Due to the comprehensive use of role permission management and high-intensity token encryption technology, the overall security protection capability of the object storage system is significantly improved, the risk of data leakage caused by permission abuse or token leakage is reduced, and the user experience and operation efficiency are improved. Moreover, users can quickly obtain tokens with specific permissions as needed without having to wait for a long time for permission approval, which also reduces the workload of system administrators and promotes the automation and standardization of resource management. In addition, through automated role management and token life cycle management, enterprises can more conveniently implement standardized security policies, promote compliance management, reduce human errors, and enhance system flexibility and scalability. The embodiments of the present invention support dynamic adjustment of access rights to adapt to changing business needs, facilitate the integration of more advanced authentication mechanisms or docking with other security systems in the future, and maintain technological leadership.
[0095] The present invention makes the permission allocation more refined and dynamic by introducing role management and token mechanism, supports on-demand authentication and access control of object storage resources in different scenarios, and enhances the flexibility of access control. In addition, double-layer encryption technology is used to protect access tokens, effectively preventing the leakage and tampering of token information during transmission and storage, ensuring that only legitimate users can access designated resources within the specified time, and improving security. The introduction of roles makes the adjustment of permission policies no longer rely on direct operations on each user, but can be managed in batches through roles, reducing management complexity, while improving the efficiency and security of resource use, simplifying management and optimizing resource utilization. The permission policy design of the token allows permissions to be customized for specific scenarios or tasks without changing the basic permissions of the role, enhancing the adaptability and scalability of the system, and enhancing adaptability.
[0096] In a second aspect, an embodiment of the present invention provides an authentication device for an object storage system to a client, wherein the device is deployed on the object storage system, see Figure 2 , the device 100 comprises:
[0097] The token acquisition module 110 is used to acquire the token in the access request when receiving the access request sent by the first client; wherein the token includes a plaintext key field, a ciphertext key field, an effective time field, a permission policy field and a role name field;
[0098] A timeout determination module 120, configured to determine whether the token has timed out according to the effective time in the effective time field;
[0099] The key determination module 130 is used to determine whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal if the timeout has not occurred;
[0100] A policy determination module 140 is used to determine, if legal, whether the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy in the permission policy field when the permission policy field is not empty;
[0101] The first processing module 150 is used to authenticate the first client, query the object storage resources, return the queried object storage resources to the first client, and perform billing for the resource access of the first client according to the role name in the role name field, if the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field.
[0102] In one embodiment, the device may further include any one of the following:
[0103] A first feedback module, configured to, if the token times out, indicate that the authentication of the first client fails, and to feedback an error code corresponding to the authentication failure to the first client;
[0104] A second feedback module is configured to fail the authentication of the first client if the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal, and to feed back an error code corresponding to the authentication failure to the first client;
[0105] The third feedback module is used to, if the permission policy field is not empty, and the object storage resource that the first client wants to access is not allowed to be accessed by the permission policy in the permission policy field, then the authentication of the first client fails and an error code corresponding to the authentication failure is fed back to the first client.
[0106] In one embodiment, the device may further include:
[0107] The attribute group acquisition module is used to acquire the role attribute group to which the role name in the role name field belongs if the authority policy field is empty; wherein the role attribute group includes the role name, the authority policy corresponding to the role name, and path information; the role name is used to mark the identity of the user, and the path information is used to mark the logical position of the user, and the logical position includes the client name of the user;
[0108] The attribute group judgment module is used to judge whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the role attribute group, and whether the first client is consistent with the path information; if it is allowed and the first client is consistent with the path information, the authentication of the first client is passed; if it is not allowed and / or the first client is inconsistent with the path information, the authentication of the first client is not passed.
[0109] In one embodiment, the permission policy includes whether the permission policy is allowed to execute or denied execution, the scope of object storage resources and the type of operation; correspondingly, the process of judging in the policy judgment module or the attribute group judgment module whether the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy may include: if the permission policy is allowed to execute, the object storage resource to be accessed by the first client is within the scope of the object storage resource and the operation type includes query access, then the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy.
[0110] In one embodiment, the token also includes first secret key signature information, and the first secret key signature information is obtained by the object storage system encrypting the plaintext key and the ciphertext key when issuing the token; correspondingly, the secret key judgment module is specifically used to: encrypt the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field to obtain second secret key signature information; determine whether the first secret key signature information and the second secret key signature information are consistent; if the two are consistent, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal; otherwise, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal.
[0111] In one embodiment, the device may further include:
[0112] A key generation module, configured to generate a plaintext key and a ciphertext key according to a random algorithm when receiving a token application request sent by a second client, wherein both the plaintext key and the ciphertext key are strings of fixed length;
[0113] A key encryption module, used to encrypt the plaintext key and the ciphertext key to obtain first key signature information;
[0114] A first determination module, used to determine the validity period of the token, the authority policy and the role name of the second client;
[0115] A token generation module, configured to generate a token according to the first secret key signature information, the plaintext secret key, the ciphertext secret key, the effective time, the authority policy and the role name of the second client, and issue the token to the second client;
[0116] The second client is used to apply for a token from the object storage system when a token needs to be issued to the first client, and pass the token to the first client after obtaining the token, so that the first client can access the object storage system based on the token.
[0117] In one embodiment, the device may further include at least one of the following:
[0118] The timeout cleaning module is used to clean up the timed-out tokens;
[0119] A double encryption module is used to perform a first encryption on the token using an encryption string and a second encryption on the token after the first encryption before sending the token to the second client. The encryption algorithms used for the first encryption and the second encryption are different. The encryption string is an encryption string set by the object storage gateway administrator or a system default encryption string.
[0120] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0121] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.
[0122] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.
[0123] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0124] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0125] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0126] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0127] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0128] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.
[0129] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0130] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0131] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0132] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for authenticating a client by an object storage system, characterized in that: The method is performed by an object storage system, and the method includes: Upon receiving an access request sent by the first client, obtaining a token in the access request; wherein the token includes a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field; Determining whether the token has timed out according to the effective time in the effective time field; If it has not timed out, determining whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal; If it is legal, then if the permission policy field is not empty, determining whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field; If the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field, the first client is authenticated, a query is performed on the object storage resource, the queried object storage resource is returned to the first client, and the resource access of the first client is billed according to the role name in the role name field.
2. The method according to claim 1, characterized in that Also includes any of the following: If the token times out, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client; If the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client; If the permission policy field is not empty, and the object storage resource that the first client wants to access is not allowed to be accessed by the permission policy in the permission policy field, the authentication of the first client fails, and an error code corresponding to the authentication failure is fed back to the first client.
3. The method according to claim 1, characterized in that Also includes: If the authority policy field is empty, then obtain the role attribute group where the role name in the role name field is located; wherein the role attribute group includes the role name, the authority policy corresponding to the role name, and path information; the role name is used to mark the identity of the user, and the path information is used to mark the logical position of the user, and the logical position includes the client name of the user; Determine whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the role attribute group, and whether the first client is consistent with the path information; If it is allowed and the first client is consistent with the path information, the authentication of the first client is successful; If it is not allowed and / or the first client is inconsistent with the path information, the authentication of the first client fails.
4. The method according to claim 1 or 3, characterized in that: The permission policy includes whether the permission policy is allowed or denied, the object storage resource scope and the operation type; Correspondingly, it is determined whether the object storage resource that the first client wants to access is allowed to be accessed by the permission policy, including: if the permission policy is allowed to be executed, the object storage resource that the first client wants to access is within the scope of the object storage resource and the operation type includes query access, then the object storage resource that the first client wants to access is allowed to be accessed by the permission policy.
5. The method according to claim 1, characterized in that The token also includes first key signature information, where the first key signature information is obtained by encrypting the plaintext key and the ciphertext key when the object storage system issues the token; Correspondingly, the determining whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal includes: Encrypting the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field to obtain second key signature information; Determine whether the first secret key signature information and the second secret key signature information are consistent; If the two are consistent, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal; Otherwise, the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are illegal.
6. The method according to claim 5, characterized in that Also includes: When receiving a token application request sent by the second client, generating a plaintext key and a ciphertext key according to a random algorithm, wherein the plaintext key and the ciphertext key are both strings of fixed length; Encrypting the plaintext key and the ciphertext key to obtain first key signature information; Determine the validity period of the token, the authority policy, and the role name of the second client; Generate a token according to the first key signature information, the plaintext key, the ciphertext key, the effective time, the authority policy and the role name of the second client, and send the token to the second client; The second client is used to apply for a token from the object storage system when a token needs to be issued to the first client, and pass the token to the first client after obtaining the token, so that the first client can access the object storage system based on the token.
7. The method according to claim 6, characterized in that Also includes at least one of the following: Clean up the timed-out tokens; Before the token is sent to the second client, the token is encrypted for the first time using an encryption string, and the first encrypted token is encrypted for the second time. The first encryption and the second encryption use different encryption algorithms, and the encryption string is the encryption string set by the object storage gateway administrator or the system default encryption string.
8. An object storage system authentication device for a client, characterized in that: The device is deployed on an object storage system, and includes: A token acquisition module, configured to acquire a token in an access request when receiving an access request sent by a first client; wherein the token includes a plaintext key field, a ciphertext key field, an effective time field, a permission policy field, and a role name field; A timeout determination module, used to determine whether the token has timed out according to the effective time in the effective time field; A key judgment module, used for judging whether the plaintext key in the plaintext key field and the ciphertext key in the ciphertext key field are legal if the timeout has not occurred; a policy judgment module, configured to judge, if legal, whether the object storage resource to be accessed by the first client is allowed to be accessed by the permission policy in the permission policy field if the permission policy field is not empty; The first processing module is used to authenticate the first client, query the object storage resources, return the queried object storage resources to the first client, and perform billing for the resource access of the first client according to the role name in the role name field if the object storage resource that the first client wants to access is allowed to be accessed by the permission policy in the permission policy field.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
10. A computing device, characterized in that: The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Access control method and device, gateway, client and security token service
CN112187724A
Session management method and device, computer device and storage medium
CN112187931A
Cloud platform account authentication method and system
CN118473819A
Permissions request verification method and apparatus, device, and storage medium
WO2021139244A1
