Authentication method, device, equipment and storage medium
By using a trusted control device to verify application information and generate unified format token information in the single sign-on system, the problem of different authentication information fields caused by differences in different IAM interface protocols is solved, and the unified authentication logic and efficient authentication process of the application server are realized. .
Patent Information
- Application Number
- CN202110779202.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-09
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-07-09
AI Technical Summary
In a single sign-on system, the application server needs to configure different business logic to complete authentication based on the authentication information fields returned by different IAM interface protocols, making it difficult to implement a unified solution.
The trusted control device verifies the application information sent by the application server, generates an application authentication request that conforms to the target IAM format based on the target user token, sends the authentication request to the corresponding IAM, and generates token information in a unified format. The application server is based on the unified Business logic analysis completes certification.
It enables the application server to complete application authentication based on unified business logic, simplifies the configuration process, adapts to the differences in interface protocols of different IAMs, and improves authentication efficiency and consistency.
Smart Images

Figure CN113505353B
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to an authentication method, device, equipment and storage medium. Background Art
[0002] Single sign-on is widely used in enterprise business integration. Users only need to log in once to access all mutually trusted application systems.
[0003] In single sign-on, the application server connects to multiple identity and access management devices (IAM) through a trusted control device. Different IAMs return authentication information based on different interface protocols. Therefore, the authentication information received by the application contains different fields, and different business logic needs to be configured on the application server to complete the authentication. Summary of the invention
[0004] The present application provides an authentication method, apparatus, device and storage medium, which are used to enable an application server to complete application authentication based on a unified business logic.
[0005] In a first aspect, an embodiment of the present application provides an authentication method, which is applied to a trusted control device, and the method includes:
[0006] Verify the application information sent by the application server;
[0007] After the application information is verified, an application authentication request is obtained based on the application information and the corresponding target user token;
[0008] Sending the application authentication request to the first IAM, so that the first IAM determines application authentication information based on the application authentication request;
[0009] Based on the application authentication information sent by the first IAM, generate token information in a target format, and send the token information to the application server.
[0010] In the above scheme, after the trusted control device verifies the application information sent by the application server, it obtains an application authentication request based on the application information and the corresponding target user token; then it sends an application authentication request that meets the format requirements of the first IAM to the first IAM, and the first IAM determines the application authentication information based on the application authentication request; the trusted control device generates token information in a unified target format based on the application authentication information, and sends the token information to the application server, and the application server parses the token information based on the unified business logic for the above target format, thereby completing the application authentication.
[0011] In some optional implementations, generating token information in a target format based on the application authentication information sent by the first IAM includes:
[0012] If the application authentication information includes user information, generating token information that complies with the identity authentication standard protocol (OpenID Connect, OIDC) based on the application authentication information; or
[0013] If the application authentication information does not include user information, a request for obtaining user information is sent to the first IAM, and the user information sent by the first IAM is received; based on the application authentication information and the received user information, token information that complies with OIDC is generated.
[0014] In some optional implementations, the application information includes an application identifier, and obtaining an application authentication request based on the application information and a corresponding target user token includes:
[0015] According to the type of the first IAM, an application authentication request including the application identifier and the target user token is generated.
[0016] In the above solution, the trusted control device generates an application authentication request in a format that meets the requirements of the first IAM according to the type of the first IAM, and the first IAM can correctly parse the application authentication request and then authenticate the application.
[0017] In some optional implementations, before verifying the application information sent by the application server, the method further includes:
[0018] Determine a target user token corresponding to the authorization request sent by the application server;
[0019] Based on the type of the selected second IAM, obtain a token verification request including the target user token;
[0020] Send the token verification request to the second IAM, and receive verification information of the target user token from the second IAM;
[0021] If it is determined based on the verification information that the target user token verification is successful, an authorization code is obtained by encryption based on the encryption timestamp, the target user token and the application identifier contained in the authorization request, and the authorization code is sent to the application server, wherein the authorization code is used to instruct the application server to send the application information.
[0022] In the above scheme, before authenticating the application, the trusted control device first obtains a token verification request containing the target user token that meets the second IAM format requirements according to the type of the selected second IAM; and sends the token verification request to the second IAM. The second IAM can correctly parse the token verification request, and then verify the target user token to obtain verification information. The trusted control device receives the verification information and can determine whether the target user token has been verified. If the verification is successful, it means that the target user token is valid, and then encrypts the authorization code based on the timestamp of encryption, the target user token and the application identifier included in the authorization request, and sends the authorization code to the above application server, so that the application server sends the above application information after the target user token has been verified based on the authorization code.
[0023] In some optional implementations, the application information includes an application identifier, an application key, and an authorization code;
[0024] The verifying the application information sent by the application server includes:
[0025] Decrypting the authorization code contained in the application information to obtain a decrypted user token, a decrypted application identifier, and a timestamp of encryption;
[0026] If the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information.
[0027] In the above scheme, if the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, it is determined that the authorization code has not expired, and then based on the decrypted application identifier, the application identifier contained in the above application information, and the application key contained in the above application information, it is verified whether the application information matches the above authorization code, and whether the application key is forged.
[0028] In some optional implementations, verifying the application information based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information includes:
[0029] If the decrypted application identifier is the same as the application identifier included in the application information, determining the target key corresponding to the application identifier included in the application information according to the correspondence between the identifier and the key;
[0030] If the target key is the same as the application key included in the application information, it is determined that the application information verification has passed, and the decrypted user token is determined as the target user token.
[0031] In the above scheme, if it is determined that the authorization code has not expired, the decrypted application identifier is compared with the application identifier contained in the application information. If the two are the same, it means that the application information matches the above authorization code, and then the target key corresponding to the application identifier is determined, and the target key is compared with the application key contained in the application information. If the target key is the same as the application key contained in the application information, it means that the application key is not forged, and it is determined that the application information has passed the verification.
[0032] In some optional implementations, if the authorization request does not have a corresponding target user token, the method further includes:
[0033] Sending an instruction to display a login interface to the application server, and after receiving the login information sent by the application server, sending the login information to a third IAM for login information authentication;
[0034] Receive the target user token sent by the third IAM after authenticating the login information, and send the SSO login credentials obtained based on the target user token to the corresponding user device through the application server.
[0035] In a second aspect, an embodiment of the present application provides an authentication device, including:
[0036] A verification module, used to verify the application information sent by the application server;
[0037] An application authentication request processing module, configured to obtain an application authentication request based on the application information and a corresponding target user token after the application information is verified;
[0038] The application authentication request processing module is further configured to send the application authentication request to the first IAM, so that the first IAM determines the application authentication information based on the application authentication request;
[0039] A token information processing module is used to generate token information in a target format based on the application authentication information sent by the first IAM, and send the token information to the application server.
[0040] In a third aspect, an embodiment of the present application provides a trusted control device, comprising: one or more processors, and a memory for storing instructions executable by the processors;
[0041] The processor is configured to execute the instructions to implement the authentication method as described in any one of the first aspects above.
[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the authentication method as described in any one of the first aspects above is implemented.
[0043] In addition, the technical effects brought about by any implementation method in the second to fourth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0045] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0046] Figure 2 An interactive flow chart of the first authentication method provided in the embodiment of the present application;
[0047] Figure 3 An interactive flow chart of the second authentication method provided in the embodiment of the present application;
[0048] Figure 4 A flowchart of an authentication method provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of the structure of an authentication device provided in an embodiment of the present application;
[0050] Figure 6 A schematic block diagram of a trusted control device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0052] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0053] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0054] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be directly connected, or indirectly connected through an intermediate medium, or it can be the internal connection of two devices. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0055] Single sign-on is widely used in enterprise business integration. Users only need to log in once to access all mutually trusted application systems.
[0056] In single sign-on, the application server connects to multiple IAMs through a trusted control device. Different IAMs return authentication information according to different interface protocols, so the authentication information received by the application server contains different fields. Different business logics (such as different parsing methods and different request methods) need to be configured on the application server to obtain authentication information and correctly parse authentication-related data to complete application authentication.
[0057] In order to enable an application server to complete application authentication based on a unified business logic, an embodiment of the present application provides an authentication method, an apparatus, a device and a storage medium. The present application is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0058] like Figure 1 As shown, it is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario includes a trusted control device 110, an application server 120, and multiple IAMs ( Figure 1 Taking IAM131 and IAM132 as examples, there may be more IAMs in actual applications).
[0059] In this scenario, the trusted control device 110 verifies the application information sent by the application server 120;
[0060] After verifying the application information, the trusted control device 110 obtains an application authentication request based on the application information and the corresponding target user token;
[0061] The trusted control device 110 sends the application authentication request to the first IAM (IAM131 or IAM132), so that the first IAM determines the application authentication information based on the application authentication request;
[0062] The trusted control device 110 generates token information in a target format based on the application authentication information sent by the first IAM, and sends the token information to the application server 120 .
[0063] The above IAM is used to implement centralized authorization, auditing, dynamic authorization, etc. based on policies. IAM 131 and IAM 132 can send application authentication requests based on OIDC or other protocols.
[0064] In the embodiment of the present application, the trusted control device 110 includes one or more groups of servers, and the servers may be of one or more types.
[0065] The above application scenarios are only examples of application scenarios for implementing the embodiments of the present application, and the embodiments of the present application are not limited to the above application scenarios.
[0066] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0067] Figure 2 The interactive flow chart of the first authentication method provided in the embodiment of the present application is as follows: Figure 2 As shown, the method may include:
[0068] Step S201: the application server sends application information to the trusted control device.
[0069] The above application information is information that the application server requests to authenticate application access. This embodiment does not specifically limit the content of the application information. In some embodiments, the application information includes the application identifier that needs to be authenticated and other information.
[0070] Step S202: The trusted control device verifies the application information; and after the application information is verified, obtains an application authentication request based on the application information and the corresponding target user token.
[0071] In this embodiment, forged application information will affect the security of application access, based on which, the application information sent by the application server needs to be verified. After the trusted control device verifies the application information, an application authentication request is obtained based on the secure application information and the corresponding target user token.
[0072] As described above, the trusted control device may be connected to multiple IAMs, and different IAMs send and receive data based on different protocols. Based on this, in some embodiments, the trusted control device determines the first IAM to authenticate the above application, and based on the type of the first IAM, generates an application authentication request that meets the format requirements of the first IAM. For example:
[0073] The trusted control device receives application information through the token interface processing component and verifies it; after verification, the application information and the target user token are transmitted to the IamAdapter (IAM adapter) component of the trusted control device; and then the first IAM (current IAM) source configuration information is obtained from the database of the trusted control device through the IamAdapter component. The IamAdapter component determines the type of the first IAM based on the first IAM source configuration information. If the first IAM is IAM131, the IamAdapter component generates an application authentication request that meets the IAM131 format requirements based on the application identifier contained in the application information and the corresponding target user token as shown below:
[0074] "appCode":client_id,
[0075] “userToken”:user_token
[0076] The parameter corresponding to the "appCode" field is the application identifier (client_id), and the parameter corresponding to the "userToken" field is the target user token (user_token).
[0077] If the first IAM is IAM132, the IamAdapter component generates an application authentication request that complies with the IAM132 format requirements as shown below based on the application identifier contained in the application information and the corresponding target user token:
[0078] "client_id":client_id,
[0079] “user_token”:user_token
[0080] The parameter corresponding to "client_id" is the application identifier (client_id), and the parameter corresponding to "user_token" is the target user token (user_token).
[0081] The above is only an exemplary description of the application authentication request. The application authentication request of this embodiment may also adopt other formats.
[0082] Step S203: The trusted control device sends the application authentication request to the first IAM.
[0083] In this embodiment, the trusted control device can send the above application authentication request to the first IAM in a variety of ways, which are not specifically limited in this embodiment. For example:
[0084] If the first IAM is IAM131, the trusted control device sends the application authentication request to IAM131 through the interface corresponding to IAM131; or if the first IAM is IAM132, the trusted control device sends the application authentication request to IAM132 through the interface corresponding to IAM132.
[0085] Step S204: The first IAM determines application authentication information based on the application authentication request.
[0086] After the first IAM receives an application authentication request that meets its format requirements, it can correctly parse the application identifier and target user token carried in the application authentication request; then authenticate the application based on the application identifier and target user token, and generate application authentication information containing the application token after the authentication is successful.
[0087] This embodiment does not limit the specific implementation method of application authentication information, for example:
[0088] If the first IAM is IAM131, the following application authentication information is generated:
[0089]
[0090] The application token (the parameter corresponding to the above appToken) in the application authentication information is data in JWT (a standardized format).
[0091] If the first IAM is IAM132, the following application authentication information is generated:
[0092]
[0093]
[0094] The application token in the application authentication information (parameter corresponding to the above app_Token) corresponds to a random string. The application authentication information also includes the expiration time of the application token (parameter corresponding to the above expires_in), but does not include user information.
[0095] Step S205: The first IAM sends application authentication information to the trusted control device.
[0096] In this embodiment, the first IAM may send the above application authentication information to the trusted control device in a variety of ways, which are not specifically limited in this embodiment.
[0097] Step S206: The trusted control device generates token information in a target format based on the application authentication information, and sends the token information to the application server.
[0098] The above-mentioned generation of token information in the target format based on the application authentication information can be achieved through but not limited to the following methods:
[0099] If the application authentication information includes user information, generating token information that complies with OIDC based on the application authentication information; or
[0100] If the application authentication information does not include user information, a request for obtaining user information is sent to the first IAM, and the user information sent by the first IAM is received; based on the application authentication information and the received user information, token information that complies with OIDC is generated.
[0101] In this embodiment, the formats of application authentication information sent by different IAMs are different. Taking the above IAM131 and IAM132 as examples:
[0102] If the first IAM is IAM131, the application token in the application authentication information is data in the JWT format. The trusted control device parses the application token to obtain the parsed data shown below:
[0103]
[0104]
[0105] The parsed data includes the expiration time of the application token (the parameter corresponding to the above expireAt) and user information.
[0106] If the first IAM is IAM132, the application authentication information does not include user information, and the trusted control device also needs to send a request to IAM132 to obtain user information as shown below:
[0107]
[0108] The parameter corresponding to "user_token" is the target user token, and the parameter corresponding to "client_id" is the application identifier.
[0109] After receiving the request to obtain the user information, IAM132 sends the following user information to the trusted control device:
[0110]
[0111]
[0112] For example, no matter which IAM returns the application authentication information, the trusted control device will package it into a unified target format token information based on the application authentication information through the above Token interface processing component, and send it to the above application server through the token interface processing component. For example:
[0113] The application token obtained based on the application authentication information is used as the parameter corresponding to access_token, the preset type is used as the parameter corresponding to token_type, the hexadecimal string obtained based on the current timestamp is used as the parameter corresponding to refresh_token, the expiration time of the application token is used as the parameter corresponding to expires_in, the preset duration is used as the parameter corresponding to refresh_expires_in, the user information is used as the parameter corresponding to id_token, the user name obtained from the first IAM is used as the parameter corresponding to username, the application identifier is used as the parameter corresponding to client_id, the active state of the application token (true indicates active, other characters indicate inactive) is used as the parameter corresponding to active, the additional information in the application token is used as the parameter corresponding to action, the state indicating whether the application token is normal (0 indicates normal, other characters indicate abnormal) is used as the parameter corresponding to code, and the description information of the code is used as the parameter corresponding to text; and the token information shown below is obtained:
[0114]
[0115]
[0116] The application server obtains id_token based on the above token information, parses id_token according to the parsing key obtained from the trusted control device, obtains the user login credentials inside the application, and the user logs in to the application successfully. The fields contained in id_token and the corresponding parameters are shown in Table 1:
[0117] Table 1
[0118]
[0119] In the above scheme, after the trusted control device verifies the application information sent by the application server, it obtains an application authentication request based on the application information and the corresponding target user token; then it sends an application authentication request that meets the format requirements of the first IAM to the first IAM, and the first IAM determines the application authentication information based on the application authentication request; the trusted control device generates token information in a unified target format based on the application authentication information, and sends the token information to the application server, and the application server parses the token information based on the unified business logic for the above target format, thereby completing the application authentication.
[0120] Figure 3 The interactive flow chart of the second authentication method provided in the embodiment of the present application is as follows: Figure 3 As shown, the method may include:
[0121] Step S301: The trusted control device determines the target user token corresponding to the authorization request sent by the application server.
[0122] In this embodiment, the authorization request sent by the above application server may have a corresponding target user token, or may not have a corresponding target user token. The trusted control device can determine whether the authorization request has a corresponding target user token by, but not limited to, the following methods:
[0123] After receiving the above authorization request through the authorization interface processing component, the trusted control device will first confirm whether the header of the authorization request contains SSO login credentials, such as the data value corresponding to the auth_session (authentication authentication field). If there is no SSO login credential, it is determined that the authorization request does not have a corresponding target user token;
[0124] If there is an SSO login credential, a user token is queried through a remote dictionary service (Remote DictionaryServer, redis) based on the SSO login credential, and the queried user token is determined as the target user token corresponding to the authorization request.
[0125] In this embodiment, if the authorization request does not have a corresponding target user token, it is necessary to obtain a user token before step S301. In this embodiment, the user token can be obtained by, but not limited to, the following methods:
[0126] The trusted control device sends an instruction to display a login interface to the application server, and after receiving the login information sent by the application server, sends the login information to the third IAM for login information authentication;
[0127] Receive the target user token sent by the third IAM after authenticating the login information, and send the SSO login credentials obtained based on the target user token to the corresponding user device through the application server.
[0128] Exemplarily, the trusted control device determines that the authorization request does not include SSO login credentials, and instructs the application server to return to the login interface. After the user device displays the login interface, the user enters the user name and password in the login interface to trigger the login information. After receiving the login information, the application server sends it to the trusted control device, and the trusted control device sends the login information to the third IAM for login information authentication. After the third IAM authenticates the login information, it sends the target user token to the trusted control device. The trusted control device generates an SSO login credential based on the target user token and the user device identifier included in the login information, and sends the SSO login credential to the above-mentioned user device. The user device stores the SSO login credential in the browser cache. When the user touches the application icon included in the SSO application list page, an instruction to access the application is triggered, and the instruction carries the SSO login credential. Then, based on the instruction to access the application, the authorization request sent by the application server to the trusted control device also carries the SSO login credential.
[0129] Step S302: The trusted control device obtains a token verification request including the target user token based on the type of the selected second IAM.
[0130] As described above, the trusted control device may be connected to multiple IAMs, and different IAMs send and receive data based on different protocols. Based on this, in some embodiments, the trusted control device determines the second IAM to verify the above user token, and based on the type of the second IAM, generates a token verification request that meets the format requirements of the second IAM. For example:
[0131] The trusted control device receives the above authorization request through the authorization interface processing component, and transmits the authorization request and the target user token to the IamAdapter component of the trusted control device; then the second IAM (current IAM) source configuration information is obtained from the database of the trusted control device through the IamAdapter component, and the IamAdapter component determines the type of the second IAM based on the second IAM source configuration information. If the second IAM is IAM131, the IamAdapter component generates a token verification request that meets the IAM131 format requirements as shown below based on the application identifier and the target user token included in the authorization request:
[0132]
[0133] The parameter corresponding to the "appCode" field is the application identifier (client_id), and the parameter corresponding to the "userToken" field is the target user token (user_token).
[0134] If the second IAM is IAM132, the IamAdapter component generates a token verification request that complies with IAM132 requirements based on the target user token as shown below:
[0135] {
[0136] “user_token”:user_token
[0137] }
[0138] Among them, the parameter corresponding to "user_token" is the target user token (user_token).
[0139] The above is only an exemplary description of the token verification request. The token verification request of this embodiment may also adopt other formats.
[0140] Step S303: The trusted control device sends the token verification request to the second IAM.
[0141] In the embodiment, the trusted control device may send the token verification request to the second IAM in a variety of ways, which are not specifically limited in this embodiment. For example:
[0142] If the second IAM is IAM131, the trusted control device sends the token verification request to IAM131 through the interface corresponding to IAM131; or if the second IAM is IAM132, the trusted control device sends the token verification request to IAM132 through the interface corresponding to IAM132.
[0143] Step S304: The second IAM verifies the target user token to obtain verification information.
[0144] After receiving the token verification request that meets its format requirements, the second IAM can correctly parse the target user token carried in the token verification request; then verify the target user token to obtain verification information for the target user token.
[0145] This embodiment does not limit the specific implementation method of the verification information, for example:
[0146] If the second IAM is IAM131 and the target user token is successfully authenticated, the following authentication information may be generated:
[0147]
[0148] The above verification information is explained by taking successful verification as an example. It can be understood that when the verification fails, the parameters corresponding to some fields are different from the above verification information.
[0149] If the second IAM is IAM132 and the target user token verification fails, the following verification information can be generated:
[0150]
[0151]
[0152] The above verification information is explained by taking verification failure as an example. It can be understood that when the verification is successful, the parameters corresponding to some fields are different from the above verification information.
[0153] The above is only an exemplary description of the verification information. The verification information of this embodiment may also be in other formats.
[0154] Step S305: The trusted control device receives the above verification information.
[0155] In this embodiment, the trusted control device may receive the verification information in a variety of ways, which are not specifically limited in this embodiment.
[0156] Step S306: If it is determined based on the verification information that the target user token has been verified, the trusted control device encrypts the authorization code based on the encryption timestamp, the target user token, and the application identifier included in the authorization request.
[0157] Exemplarily, the trusted control device receives verification information through the authorization interface processing component, and determines the verification result of the target user token based on the verification information. If the verification fails, the authorization interface processing component notifies the application server that the authorization code acquisition fails. If the verification passes, the authorization interface processing component constructs a json (a lightweight data format) data based on the above-mentioned target user token, application identifier and current (encrypted) timestamp three parameters, and then encrypts the json data using the Advanced Encryption Standard (AES) algorithm to obtain binary data; the binary data is converted into a hexadecimal string as the authorization code.
[0158] Step S307: The trusted control device sends the authorization code to the application server.
[0159] In this embodiment, the trusted control device can send the authorization code to the application server in various ways, which are not specifically limited in this embodiment. For example, the authorization code is sent to the application server through the authorization interface processing component.
[0160] Step S308: The application server sends application information to the trusted control device.
[0161] The implementation of step S308 is the same as that of the above step S201, and will not be repeated here.
[0162] Step S309: The trusted control device verifies the application information; and after the application information is verified, obtains an application authentication request based on the application information and the corresponding target user token.
[0163] The above verification of the application information sent by the application server can be achieved by but not limited to the following methods:
[0164] Decrypting the authorization code contained in the application information to obtain a decrypted user token, a decrypted application identifier, and a timestamp of encryption;
[0165] If the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information.
[0166] In some embodiments, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information in the following manner:
[0167] If the decrypted application identifier is the same as the application identifier included in the application information, determining the target key corresponding to the application identifier included in the application information according to the correspondence between the identifier and the key;
[0168] If the target key is the same as the application key included in the application information, it is determined that the application information verification has passed, and the decrypted user token is determined as the target user token.
[0169] Exemplarily, after receiving the application information through the token interface processing component, the trusted control device determines the authorization code contained in the application information, and decrypts the authorization code to obtain json data. The timestamp of encryption in the json data is compared with the current timestamp. If the time difference between the timestamp of encryption and the current timestamp reaches the preset time difference (such as 20 seconds), the authorization code is determined to be invalid and the verification fails. If the time difference between the timestamp of encryption and the current timestamp is less than the preset time difference, the decrypted application identifier in the json data is compared with the application identifier contained in the application information. If the two are different, the authorization code is determined to be invalid and the verification fails; if the two are the same, the target key corresponding to the application identifier is queried from the database, and the target key is compared with the application key contained in the application information. If the target key is different from the application key contained in the application information, it means that the application key is forged, the application information is determined to be invalid, and the verification fails; if the target key is the same as the application key contained in the application information, it means that the application key is not forged, and the verification of the application information is determined to be passed, and the application information is transmitted to the IamAdapter component.
[0170] Step S310: The trusted control device sends the application authentication request to the first IAM.
[0171] Step S311: The first IAM determines application authentication information based on the application authentication request.
[0172] Step S312: The first IAM sends application authentication information to the trusted control device.
[0173] Step S313: The trusted control device generates token information in a target format based on the application authentication information, and sends the token information to the application server.
[0174] The implementation of steps S310-313 is the same as that of the above steps S203-206, and will not be repeated here.
[0175] In the above scheme, before authenticating the application, the trusted control device first obtains a token verification request containing the target user token that meets the second IAM format requirements according to the type of the selected second IAM; and sends the token verification request to the second IAM. The second IAM can correctly parse the token verification request, and then verify the target user token to obtain verification information. The trusted control device receives the verification information and can determine whether the target user token has been verified. If the verification is successful, it means that the target user token is valid, and then encrypts the authorization code based on the timestamp of encryption, the target user token and the application identifier included in the authorization request, and sends the authorization code to the above application server, so that the application server sends the above application information after the target user token has been verified based on the authorization code.
[0176] In the above embodiment, the first IAM, the second IAM and the third IAM may be the same IAM or different IAMs, which is not specifically limited in this embodiment.
[0177] like Figure 4 As shown, it is a flowchart of the first authentication method provided in the embodiment of the present application, which is applied to the above-mentioned trusted control device. The method includes the following steps:
[0178] Step S401: verifying the application information sent by the application server;
[0179] Step S402: after the application information is verified, an application authentication request is obtained based on the application information and the corresponding target user token;
[0180] Step S403: Sending the application authentication request to the first IAM, so that the first IAM determines application authentication information based on the application authentication request;
[0181] Step S404: Generate token information in a target format based on the application authentication information sent by the first IAM, and send the token information to the application server.
[0182] In some optional implementations, generating token information in a target format based on the application authentication information sent by the first IAM includes:
[0183] If the application authentication information includes user information, generating token information that complies with OIDC based on the application authentication information; or
[0184] If the application authentication information does not include user information, a request for obtaining user information is sent to the first IAM, and the user information sent by the first IAM is received; based on the application authentication information and the received user information, token information that complies with OIDC is generated.
[0185] In some optional implementations, the application information includes an application identifier, and obtaining an application authentication request based on the application information and a corresponding target user token includes:
[0186] According to the type of the first IAM, an application authentication request including the application identifier and the target user token is generated.
[0187] In some optional implementations, before verifying the application information sent by the application server, the method further includes:
[0188] Determine a target user token corresponding to the authorization request sent by the application server;
[0189] Based on the type of the selected second IAM, obtain a token verification request including the target user token;
[0190] Send the token verification request to the second IAM, and receive verification information of the target user token from the second IAM;
[0191] If it is determined based on the verification information that the target user token verification is successful, an authorization code is obtained by encryption based on the encryption timestamp, the target user token and the application identifier contained in the authorization request, and the authorization code is sent to the application server, wherein the authorization code is used to instruct the application server to send the application information.
[0192] In some optional implementations, the application information includes an application identifier, an application key, and an authorization code;
[0193] The verifying the application information sent by the application server includes:
[0194] Decrypting the authorization code contained in the application information to obtain a decrypted user token, a decrypted application identifier, and a timestamp of encryption;
[0195] If the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information.
[0196] In some optional implementations, verifying the application information based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information includes:
[0197] If the decrypted application identifier is the same as the application identifier included in the application information, determining the target key corresponding to the application identifier included in the application information according to the correspondence between the identifier and the key;
[0198] If the target key is the same as the application key included in the application information, it is determined that the application information verification has passed, and the decrypted user token is determined as the target user token.
[0199] In some optional implementations, if the authorization request does not have a corresponding target user token, the method further includes:
[0200] Sending an instruction to display a login interface to the application server, and after receiving the login information sent by the application server, sending the login information to a third IAM for login information authentication;
[0201] Receive the target user token sent by the third IAM after authenticating the login information, and send the SSO login credentials obtained based on the target user token to the corresponding user device through the application server.
[0202] like Figure 5 As shown, based on the same inventive concept, an embodiment of the present application provides an authentication device 500, including: a verification module 501, an application authentication request processing module 502 and a token information processing module 503. In some optional implementations, the authentication device 500 may also include a token processing module 504.
[0203] Verification module 501, used to verify the application information sent by the application server;
[0204] An application authentication request processing module 502 is used to obtain an application authentication request based on the application information and a corresponding target user token after the application information is verified;
[0205] The application authentication request processing module 502 is further configured to send the application authentication request to the first IAM, so that the first IAM determines the application authentication information based on the application authentication request;
[0206] The token information processing module 503 is used to generate token information in a target format based on the application authentication information sent by the first IAM, and send the token information to the application server.
[0207] In some optional implementations, the token information processing module 503 is specifically used to:
[0208] If the application authentication information includes user information, generating token information that complies with OIDC based on the application authentication information; or
[0209] If the application authentication information does not include user information, a request for obtaining user information is sent to the first IAM, and the user information sent by the first IAM is received; based on the application authentication information and the received user information, token information that complies with OIDC is generated.
[0210] In some optional implementations, the application information includes an application identifier, and the application authentication request processing module 502 is specifically used to:
[0211] According to the type of the first IAM, an application authentication request including the application identifier and the target user token is generated.
[0212] In some optional implementations, the token processing module 504 is used to: before the verification module 501 verifies the application information sent by the application server,
[0213] Determine a target user token corresponding to the authorization request sent by the application server;
[0214] Based on the type of the selected second IAM, obtain a token verification request including the target user token;
[0215] Send the token verification request to the second IAM, and receive verification information of the target user token from the second IAM;
[0216] If it is determined based on the verification information that the target user token verification is successful, an authorization code is obtained by encryption based on the encryption timestamp, the target user token and the application identifier contained in the authorization request, and the authorization code is sent to the application server, wherein the authorization code is used to instruct the application server to send the application information.
[0217] In some optional implementations, the application information includes an application identifier, an application key, and an authorization code;
[0218] The verification module 501 is specifically used for:
[0219] Decrypting the authorization code contained in the application information to obtain a decrypted user token, a decrypted application identifier, and a timestamp of encryption;
[0220] If the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information.
[0221] In some optional implementations, the verification module 501 is specifically used to:
[0222] If the decrypted application identifier is the same as the application identifier included in the application information, determining the target key corresponding to the application identifier included in the application information according to the correspondence between the identifier and the key;
[0223] If the target key is the same as the application key included in the application information, it is determined that the application information verification has passed, and the decrypted user token is determined as the target user token.
[0224] In some optional implementations, if the authorization request does not have a corresponding target user token, the token processing module 504 is further configured to:
[0225] Sending an instruction to display a login interface to the application server, and after receiving the login information sent by the application server, sending the login information to a third IAM for login information authentication;
[0226] Receive the target user token sent by the third IAM after authenticating the login information, and send the SSO login credentials obtained based on the target user token to the corresponding user device through the application server.
[0227] like Figure 6 As shown, based on the same inventive concept, an embodiment of the present application provides a trusted control device 600, including: a processor 601 and a memory 602;
[0228] The memory 602 is used to store the computer program executed by the processor 601. The memory 602 can be a volatile memory, such as a random-access memory (RAM); the memory 602 can also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 602 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 602 can also be a combination of the above memories.
[0229] The processor 601 may include one or more central processing units (CPU), graphics processing units (GPU) or digital processing units, etc.
[0230] The specific connection medium between the memory 602 and the processor 601 is not limited in the embodiment of the present application. Figure 6 In the embodiment, the memory 602 and the processor 601 are connected via a bus 603, but the embodiment of the present application is not limited thereto. The bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0231] The memory stores a computer program, and when the computer program is executed by the processor, the processor 601 performs the following process:
[0232] Verify the application information sent by the application server;
[0233] After the application information is verified, an application authentication request is obtained based on the application information and the corresponding target user token;
[0234] Sending the application authentication request to the first IAM, so that the first IAM determines application authentication information based on the application authentication request;
[0235] Based on the application authentication information sent by the first IAM, token information in a target format is generated, and the token information is sent to the application server.
[0236] In some optional implementations, the processor 601 is specifically configured to:
[0237] If the application authentication information includes user information, generating token information that complies with OIDC based on the application authentication information; or
[0238] If the application authentication information does not include user information, a request for obtaining user information is sent to the first IAM, and the user information sent by the first IAM is received; based on the application authentication information and the received user information, token information that complies with OIDC is generated.
[0239] In some optional implementations, the application information includes an application identifier, and the processor 601 is specifically configured to:
[0240] According to the type of the first IAM, an application authentication request including the application identifier and the target user token is generated.
[0241] In some optional implementations, before verifying the application information sent by the application server, the processor 601 is further configured to:
[0242] Determine a target user token corresponding to the authorization request sent by the application server;
[0243] Based on the type of the selected second IAM, obtain a token verification request including the target user token;
[0244] Send the token verification request to the second IAM, and receive verification information of the target user token from the second IAM;
[0245] If it is determined based on the verification information that the target user token verification is successful, an authorization code is obtained by encryption based on the encryption timestamp, the target user token and the application identifier contained in the authorization request, and the authorization code is sent to the application server, wherein the authorization code is used to instruct the application server to send the application information.
[0246] In some optional implementations, the application information includes an application identifier, an application key, and an authorization code;
[0247] The processor 601 is specifically configured to:
[0248] Decrypting the authorization code contained in the application information to obtain a decrypted user token, a decrypted application identifier, and a timestamp of encryption;
[0249] If the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information.
[0250] In some optional implementations, the processor 601 is specifically configured to:
[0251] If the decrypted application identifier is the same as the application identifier included in the application information, determining the target key corresponding to the application identifier included in the application information according to the correspondence between the identifier and the key;
[0252] If the target key is the same as the application key included in the application information, it is determined that the application information verification has passed, and the decrypted user token is determined as the target user token.
[0253] In some optional implementations, if the authorization request does not have a corresponding target user token, the processor 601 is further configured to:
[0254] Sending an instruction to display a login interface to the application server, and after receiving the login information sent by the application server, sending the login information to a third IAM for login information authentication;
[0255] Receive the target user token sent by the third IAM after authenticating the login information, and send the SSO login credentials obtained based on the target user token to the corresponding user device through the application server.
[0256] The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the above-mentioned authentication method are implemented. The readable storage medium may be a non-volatile readable storage medium.
[0257] The present application is described above with reference to block diagrams and / or flow charts showing methods, devices (systems) and / or computer program products according to embodiments of the present application. It should be understood that a block of a block diagram and / or flow chart diagram and a combination of blocks of a block diagram and / or flow chart diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable authentication device to produce a machine, so that instructions executed via a computer processor and / or other programmable authentication device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.
[0258] Accordingly, the present application may also be implemented with hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium, which has a computer-usable or computer-readable program code implemented in the medium, for use by an instruction execution system or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that may contain, store, communicate, transmit, or convey a program for use by an instruction execution system, device, or apparatus, or in conjunction with an instruction execution system, device, or apparatus.
[0259] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0260] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An authentication method, characterized in that: Applied to a trusted control device, the method comprises: Verify the application information sent by the application server; After the application information is verified, an application authentication request is obtained based on the application information and the corresponding target user token; Sending the application authentication request to the first IAM, so that the first IAM determines application authentication information based on the application authentication request; Based on the application authentication information sent by the first IAM, token information in a target format is generated, and the token information is sent to the application server.
2. The method according to claim 1, characterized in that The generating token information in a target format based on the application authentication information sent by the first IAM includes: If the application authentication information includes user information, generating token information that complies with the identity authentication standard protocol OIDC based on the application authentication information; or If the application authentication information does not include user information, a request for obtaining user information is sent to the first IAM, and the user information sent by the first IAM is received; based on the application authentication information and the received user information, token information that complies with OIDC is generated.
3. The method according to claim 1, characterized in that The application information includes an application identifier, and obtaining an application authentication request based on the application information and a corresponding target user token includes: According to the type of the first IAM, an application authentication request including the application identifier and the target user token is generated.
4. The method according to claim 1, characterized in that: Before verifying the application information sent by the application server, the method further includes: Determine a target user token corresponding to the authorization request sent by the application server; Based on the type of the selected second IAM, obtain a token verification request including the target user token; Send the token verification request to the second IAM, and receive verification information of the target user token from the second IAM; If it is determined based on the verification information that the target user token verification is successful, an authorization code is obtained by encryption based on the encryption timestamp, the target user token and the application identifier contained in the authorization request, and the authorization code is sent to the application server, wherein the authorization code is used to instruct the application server to send the application information.
5. The method according to claim 4, characterized in that The application information includes an application identifier, an application key, and an authorization code; The verifying the application information sent by the application server includes: Decrypting the authorization code contained in the application information to obtain a decrypted user token, a decrypted application identifier, and a timestamp of encryption; If the time difference between the encrypted timestamp and the current timestamp is less than the preset time difference, the application information is verified based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information.
6. The method according to claim 5, characterized in that Verifying the application information based on the decrypted application identifier, the application identifier included in the application information, and the application key included in the application information includes: If the decrypted application identifier is the same as the application identifier included in the application information, determining the target key corresponding to the application identifier included in the application information according to the correspondence between the identifier and the key; If the target key is the same as the application key included in the application information, it is determined that the application information verification has passed, and the decrypted user token is determined as the target user token.
7. The method according to claim 4, characterized in that If the authorization request does not have a corresponding target user token, the method further includes: Sending an instruction to display a login interface to the application server, and after receiving the login information sent by the application server, sending the login information to a third IAM for login information authentication; Receive the target user token sent by the third IAM after authenticating the login information, and send the single sign-on (SSO) login credential obtained based on the target user token to the corresponding user device through the application server.
8. An authentication device, characterized in that: include A verification module, used to verify the application information sent by the application server; An application authentication request processing module, configured to obtain an application authentication request based on the application information and a corresponding target user token after the application information is verified; The application authentication request processing module is further configured to send the application authentication request to the first IAM, so that the first IAM determines the application authentication information based on the application authentication request; A token information processing module is used to generate token information in a target format based on the application authentication information sent by the first IAM, and send the token information to the application server.
9. A trusted control device, characterized in that: comprising one or more processors, and a memory for storing instructions executable by said processors; The processor is configured to execute the instructions to implement the authentication method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the authentication method according to any one of claims 1 to 7 is implemented.
