A unified authentication token generation method and device
By adopting the token generation method of primary encryption and secondary encryption in the unified authentication system, combined with security parameters, the problems of information leakage and token overhead in the unified authentication mechanism are solved, and security and performance are improved.
Patent Information
- Application Number
- CN202410313866.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-03-19
AI Technical Summary
The existing unified authentication mechanism has problems such as information leakage and token storage and transmission overhead, resulting in security and performance problems.
By introducing token generation methods of primary encryption and secondary encryption in the unified authentication system, using custom encryption algorithms and adding security parameters to the secondary encryption, ensuring the complexity and security of tokens and reducing unnecessary traffic Overhead.
Improve the security of unified login verification, prevent external attacks, compress the token size share, reduce unnecessary traffic overhead, and enhance data security.
Smart Images

Figure CN118174874B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption, and in particular to a unified authentication token generation method and device. Background Art
[0002] With the increasing popularity of digitalization, the number of enterprise application systems has gradually increased. In the construction of application systems, the management of user identity and authentication information is a particularly critical part.
[0003] Since the decentralized user management model will hinder the evolution of enterprise applications towards platformization, it is a general trend to build a standardized account management system with unified authentication. It can bring unified account management, identity authentication, user authorization and other basic capabilities to the platform, and bring basic capabilities such as cross-system single sign-on and third-party authorized login to enterprises. The unified authentication of the current Internet system not only improves the efficiency of developers, but also reduces the operational burden of users.
[0004] In the unified authentication mechanism, once a user logs in once, all authorized application systems can theoretically access the user's identity information. This design does facilitate the user's operating experience, but it also brings potential security risks. Therefore, it is crucial to improve the security of unified login verification. Summary of the invention
[0005] In view of this, the present invention provides a unified authentication token generation method to solve the problem that the existing unified authentication mechanism may cause some important information leakage.
[0006] In a first aspect, the present invention provides a unified authentication token generation method, which is applied to a unified authentication token generation system, wherein the system includes a client, a gateway, an authentication server, and a database, and the method is executed by the gateway, and the method includes:
[0007] Receiving user request information sent by the client, and judging the user request information;
[0008] When it is determined that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, the login information is encrypted once into an initial token;
[0009] Receiving the initial token issued by the authentication server, and performing secondary encryption on the initial token to generate a final token;
[0010] The final token is returned to the client corresponding to the user request information.
[0011] The above solution adds primary encryption and secondary encryption to the unified login verification to enhance the complexity of the token generation algorithm and ensure the security of authentication. In addition, when generating the token, the primary encryption and secondary encryption use the self-encapsulated encryption algorithm, so even if the token stores a lot of information, the traffic overhead will not be too large.
[0012] In an optional implementation, the re-encrypting the initial token to generate a final token includes:
[0013] Generate security parameters according to the user request information; the security parameters include client IP, client model and token validity period;
[0014] The initial token is encrypted again according to the security parameter to generate a final token.
[0015] The above scheme implements secondary encryption of the token through security parameters, effectively preventing attacks from external systems and further ensuring data security. The verification of security parameters compresses the size of the token and reduces unnecessary traffic overhead.
[0016] In an optional implementation manner, the receiving the user request information sent by the client and judging the user request information includes:
[0017] When the user request information includes the login information, determining that the user request information is a user login request; the login information includes a user name and a password;
[0018] When the user request information includes a login token, it is determined that the user request information is a non-user login request.
[0019] When the gateway receives the user request information sent by the client, the above solution determines the request type of the user request information based on the data information in the user request information, thereby realizing data diversion and improving authentication efficiency.
[0020] In an optional implementation, the system further includes a business system; when it is determined that the user request information is non-user login request information, the method further includes:
[0021] Parsing the login token in the user request information to obtain security parameters in the login token;
[0022] The login token is verified once according to the security parameters in the login token, and after the verification is passed, the user request information is sent to the corresponding business system so that the business system performs a second verification on the login token.
[0023] The above scheme authenticates the token in the user request information through security parameters. The verification of security parameters compresses the size of the token and reduces unnecessary traffic overhead.
[0024] In a second aspect, the present invention provides a unified authentication token generation method, which is applied to a unified authentication token generation system, wherein the system includes a client, a gateway, an authentication server, and a database, and the method is executed by the authentication server, and the method includes:
[0025] When the gateway determines that the user request information sent by the client is a user login request, the gateway receives the user request information;
[0026] The login information in the user request information is compared with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted once into an initial token and sent to the gateway, so that the gateway encrypts the initial token twice and generates a final authentication command and sends it to the client corresponding to the user request information.
[0027] In an optional implementation, encrypting the login information once into an initial token comprises:
[0028] Get the target encryption format of the token;
[0029] The login information is encrypted into an initial token according to the target encryption format.
[0030] In a third aspect, the present invention provides a unified authentication token generation device, which is applied to a unified authentication token generation system, wherein the system includes a client, a gateway, an authentication server, and a database, and the device is executed by the gateway, and the device includes:
[0031] A user request information judgment module, used for receiving the user request information sent by the client and judging the user request information;
[0032] A user request information forwarding module is used to, when determining that the user request information is a user login request, send the user request information to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, encrypt the login information once into an initial token;
[0033] A secondary encryption module, used for receiving the initial token issued by the authentication server and performing secondary encryption on the initial token to generate a final token;
[0034] The final token sending module is used to return the final token to the client corresponding to the user request information.
[0035] In a fourth aspect, the present invention provides a unified authentication token generation device, which is applied to a unified authentication token generation system, wherein the system includes a client, a gateway, an authentication server, and a database, and the device is executed by the authentication server, and the device includes:
[0036] A user request information receiving module, used for receiving user request information sent by the client through the gateway; the user request information is determined by the gateway as a user login request;
[0037] A one-time encryption module is used to compare the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted once into an initial token and sent to the gateway, so that the gateway can perform a second encryption on the initial token and generate a final authentication command and send it to the client corresponding to the user request information.
[0038] In a fifth aspect, the present invention provides a unified authentication token generation system, the system comprising a client, a gateway, an authentication server and a database;
[0039] The client is used to send user request information;
[0040] The gateway is used to receive the user request information sent by the client, and judge the user request information, and when it is judged that the user request information is a user login request, send the user request information to the authentication server;
[0041] The authentication server is used to compare the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, encrypt the login information once into an initial token, and send the initial token to the gateway;
[0042] The gateway is also used to receive the initial token issued by the authentication server, and perform secondary encryption on the initial token to generate a final token; and return the final token to the client corresponding to the user request information.
[0043] In a sixth aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the computer instructions to thereby execute a unified authentication token generation method of the above-mentioned first aspect or any corresponding embodiment thereof.
[0044] In a seventh aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute a unified authentication token generation method according to the first aspect or any corresponding embodiment thereof.
[0045] In an eighth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute a unified authentication token generation method according to the first aspect or any corresponding embodiment thereof.
[0046] The technical solution provided by the present invention may include the following beneficial effects:
[0047] The gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 is a structural schematic diagram of a unified authentication token generation system according to an embodiment of the present invention;
[0050] Figure 2 It is a flowchart of a unified authentication token generation method according to an embodiment of the present invention;
[0051] Figure 3 is a flow chart of another unified authentication token generation method according to an embodiment of the present invention;
[0052] Figure 4 is a flowchart of another unified authentication token generation method according to an embodiment of the present invention;
[0053] Figure 5 is a flow chart of another unified authentication token generation method according to an embodiment of the present invention;
[0054] Figure 6 is a structural block diagram of a unified authentication token generation device according to an embodiment of the present invention;
[0055] Figure 7 is a structural block diagram of another unified authentication token generation device according to an embodiment of the present invention;
[0056] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0058] The original intention of the current unified authentication mechanism design is to simplify the user login process and improve the user experience. This mechanism allows users to access all authorized application systems with just one login, which is called Single Sign-On (SSO). In the SSO system, users can obtain a token after passing one authentication (for example, entering a username and password). When users access other authorized application systems, they only need to present this token without having to enter their username and password again. However, this mechanism also has some potential security risks and performance issues:
[0059] Information leakage risk: Once a user's token is maliciously obtained, the attacker can use this token to access all the user's authorized application systems, which may lead to the leakage of important information.
[0060] Token storage and traffic overhead: Tokens on the market often contain a lot of information, such as user identity information, permission information, token validity period, etc. The storage and transmission of this information consumes certain resources.
[0061] In order to solve the above problems, a more efficient token verification mechanism can be used and the structure of the token can be optimized to reduce the risk of the token being cracked or stolen. Therefore, an embodiment of the present invention provides a unified authentication token generation method, which achieves the effect of improving the security of unified login verification through two encryption processes and the reference of security parameters.
[0062] Figure 1 FIG. 1 is a schematic diagram of a unified authentication token generation system according to an embodiment of the present invention. Figure 1 As shown, the system includes a client 10, a gateway 20, an authentication server 30 and a database 40;
[0063] The client 10 is used to send user request information;
[0064] The gateway 20 is used to receive the user request information sent by the client 10, and judge the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server 30;
[0065] The authentication server 30 is used to compare the login information in the user request information with the user storage information in the database 40. When the user storage information corresponding to the login information exists in the database 40, the login information is encrypted into an initial token and the initial token is sent to the gateway 20.
[0066] The gateway 20 is further configured to receive the initial token issued by the authentication server 30, and perform secondary encryption on the initial token to generate a final token; and return the final token to the client 10 corresponding to the user request information.
[0067] Optionally, the database 40 is used to store user storage information, the main source of which is user registration or administrator addition. The user storage information includes user name and password to respond to query requests from the authentication server 30 and other services.
[0068] Optionally, there may be multiple clients 10 , which provide users with an interactive interface, such as a web page, a mobile application, etc. When a user attempts to access an application or service, a request is initiated through the client 10 .
[0069] Optionally, the gateway 20 serves as an external service, including request routing, responsible for first receiving the user request information sent by the client 10, and routing it to the corresponding backend service (such as the authentication server 30 and the business system 50) according to the target of the request. In this embodiment, the gateway 20 is also used for identity authentication and authorization, judging the request type of the user request information sent by the client 10, verifying whether the user request information contains valid authentication information, such as a token, and then judging whether the user request information is a user login request. When the user request information is a user login request, the user request information is sent to the authentication server 30, and after the authentication server 30 completes the encryption once, the user request information is encrypted twice; when the user request information is not a user login request, the token in the user request information is verified, and after the verification is passed, it is sent to the corresponding business system 50.
[0070] Optionally, the gateway 20 may include functions such as a firewall, DDoS protection, and API rate limiting.
[0071] Specifically, the authentication server 30 is mainly used to verify whether the login information in the user request information matches the existing user storage information in the database 40. In addition, the authentication server 30 can also implement token management, generate, verify and update tokens. When there is user storage information corresponding to the login information in the database 40, the login information is encrypted once into an initial token and sent to the gateway 20.
[0072] Optionally, the business system 50 refers to a system or platform within an organization or enterprise that supports its core business activities. Such a system is usually complex and highly integrated, and is intended to improve business efficiency, reduce costs, and ensure the smooth operation of the business. In this embodiment, the business system 50 is used to perform a secondary verification on the user request information after the gateway 20 has verified it once when the user request information is not a user login request information.
[0073] In summary, the gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead.
[0074] According to an embodiment of the present invention, an embodiment of a unified authentication token generation method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0075] In this embodiment, a unified authentication token generation method is provided, which is applied to Figure 1 In the illustrated unified authentication token generation system, the system includes a client 10, a gateway 20, an authentication server 30 and a database 40, and the following method is executed by the gateway 20: Figure 2 FIG. 1 is a flow chart of a unified authentication token generation method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0076] Step S201, receiving user request information sent by the client, and judging the user request information.
[0077] Specifically, since the user request information sent by the client is not necessarily a user login request, it may also be other request information, such as attempting to access the corresponding business system for corresponding data processing, etc. Therefore, when the user enters the user request information through the client, the gateway will judge the request type of the user request information (the request type includes user login requests and non-user login requests) to determine whether the user request information is a user login request or a non-user login request.
[0078] Step S202, when it is determined that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted into an initial token once.
[0079] Specifically, when the gateway determines that the user request information is a user login request, the gateway does not directly process the user request information, but forwards the user request information to the back-end authentication server. The authentication server is a component specifically responsible for processing user authentication logic, which includes the ability to interact with the database to verify the user request information forwarded by the gateway. During the authentication process of the authentication server, the authentication server first compares the login information in the user request information with the user storage information in the database. If the two match, the authentication is successful; at this time, the authentication server encrypts the login information in the user request information once to generate an initial token.
[0080] Step S203, receiving the initial token issued by the authentication server, and re-encrypting the initial token to generate a final token.
[0081] Specifically, after the authentication server generates the initial token, it will send the initial token to the gateway. The gateway will receive the initial token. In order to improve security, the gateway will re-encrypt the initial token to generate the final token. The purpose is to increase the complexity and confidentiality of the token and prevent unauthorized access and tampering.
[0082] Step S204: Return the final token to the client corresponding to the user request information.
[0083] Specifically, after the gateway generates the final token, the gateway will return the generated final token to the client corresponding to the user request information. After the client receives the final token, it can directly log in according to the final token in the subsequent login process.
[0084] In summary, the gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead.
[0085] In this embodiment, a unified authentication token generation method is provided, which is applied to Figure 1 In the illustrated unified authentication token generation system, the system includes a client 10, a gateway 20, an authentication server 30 and a database 40, and the following method is executed by the gateway 20: Figure 3 FIG. 1 is a flow chart of another unified authentication token generation method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0086] Step S301, receiving user request information sent by the client, and judging the user request information.
[0087] Specifically, the above step S301 includes:
[0088] Step S3011: when the user request information includes the login information, determining that the user request information is a user login request; the login information includes a user name and a password;
[0089] Step S3012: When the user request information includes a login token, determine that the user request information is a non-user login request.
[0090] Specifically, after the user inputs a request through the client and submits it, a user request message will be generated and sent to the server. This user request message will first reach the gateway. The gateway is located between the front-end and back-end services and is the entry point for traffic to enter the system. The gateway will first determine whether this user request message is a user login request message. The user login request message contains login information such as user name and password, which needs to be processed through a specific authentication process. Therefore, the gateway determines the type of the user request message based on the specific information included in the user request message. Therefore, when the user request message includes the login information, the user request message is determined to be a user login request. When the user request message includes a login token, the user request message is determined to be a non-user login request.
[0091] Step S302, when it is determined that the user request information is not user login request information, the login token is verified once according to the security parameters in the login token, and after the verification is passed, the user request information is sent to the corresponding business system so that the business system performs a second verification on the login token.
[0092] Specifically, if the user request information is non-user login request information, it means that the user has successfully logged in and is now trying to access a protected resource. In this case, the user request information will contain a login token, which is used to prove the user's identity and authorization information. The gateway will parse the login token once and extract the user information and security parameters contained therein. After the first parsing is completed, the gateway will use the extracted security parameters to verify the credibility of the login token once. These security parameters may include the token's signature, issuer, validity period, etc. The purpose of a verification is to ensure that the login token is issued by a trustworthy system (such as an authentication server), is within the validity period, and has not been tampered with.
[0093] If the first verification is successful, the gateway will distribute the request to the corresponding business system based on the information in the user request information (such as API path or business identifier). These business systems are responsible for processing specific business logic. After receiving the user request information, the business system will perform a second verification on the login token. The second verification is to ensure that even if the gateway has performed a verification once, the business system itself can verify the validity of the login token again, which can further enhance the security of the system and prevent potential security vulnerabilities or misoperations. If the second verification of the login token also passes (which means that the login token is the final token sent by the gateway to the client), the business system will execute the corresponding business logic according to the content of the request and return the result to the client.
[0094] In the whole process, the verification of login tokens and the distribution of requests are key steps, ensuring that only legitimate and trusted user request information can access system resources, thereby improving the security of the system. At the same time, through the centralized management of the gateway, user request information can be more conveniently monitored, logged, and traffic controlled.
[0095] Step S303, when it is determined that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted into an initial token once.
[0096] Specifically, see Figure 4 A flowchart of another unified authentication token generation method is shown, such as Figure 4 As shown, the user enters login information including user name and password through the client and submits the user request information, which means that the user request information is a user login request. This user request information will first reach the gateway (i.e. Figure 4 The gateway service in the gateway will recognize that this is a user login request. The gateway does not directly process the user request information, but forwards the user request information to the backend authentication server (i.e. Figure 4 The authentication server has the ability to interact with the database. It compares the login information in the user request information with the user stored information in the database to verify the login information provided by the user. When the login information is consistent with the user stored information in the database, the login information is encrypted into an initial token.
[0097] Step S304: receiving the initial token issued by the authentication server, and performing secondary encryption on the initial token to generate a final token.
[0098] Specifically, the above step S304 includes:
[0099] Step S3041, generating security parameters according to the user request information; the security parameters include the client IP, client model and token validity period.
[0100] Step S3042: The initial token is re-encrypted according to the security parameter to generate a final token.
[0101] Step S3043: compress the final token to obtain a compressed final token.
[0102] Specifically, Figure 4As shown, the authentication server returns the generated initial token to the gateway. After receiving the initial token, the gateway will not return it directly to the client, but will perform further processing, that is, secondary encryption. In order to improve security, the gateway will perform secondary encryption on the received initial token based on some security parameters (such as client IP, client model, and token validity period, etc.). The secondary encryption is to increase the complexity and confidentiality of the initial token to prevent unauthorized access and tampering.
[0103] Step S305: Return the final token to the client corresponding to the user request information.
[0104] Specifically, the gateway returns the final token generated after double encryption to the client, and the client will carry this encrypted final token in subsequent access requests to prove the user's identity and authorization information. Through this process, it is ensured that only authenticated users can obtain a valid final token, and this final token is also additionally encrypted during transmission, further enhancing security. The client needs to use this encrypted final token to access protected resources in subsequent requests, and the business system will verify and decrypt the final token to ensure the legitimacy and security of the request.
[0105] In summary, the gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead.
[0106] In this embodiment, a unified authentication token generation method is provided, which is applied to Figure 1 In the illustrated unified authentication token generation system, the system includes a client 10, a gateway 20, an authentication server 30 and a database 40, and the following method is executed by the authentication server 30: Figure 5 FIG. 1 is a flow chart of another unified authentication token generation method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0107] Step S501: When the gateway determines that the user request information sent by the client is a user login request, the gateway receives the user request information.
[0108] Step S502, compare the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, encrypt the login information into an initial token and send it to the gateway, so that the gateway encrypts the initial token again and generates a final authentication command and sends it to the client corresponding to the user request information.
[0109] Specifically, the "encrypting the login information once into an initial token and sending it to the gateway" in the above step S502 includes:
[0110] The target encryption format of the token is obtained, and the login information is encrypted into an initial token according to the target encryption format.
[0111] Optionally, the target encryption format is in the format of JWT (JSON Web Token), which is an open standard (RFC 7519) that defines a compact, self-contained way to securely transmit information between parties as a JSON object.
[0112] Specifically, the login information in the user request information is encrypted and encoded in the JWT (JSON Web Token) format to generate an initial token, which may include the user's identity information, validity period, and other possible custom statements.
[0113] In summary, the gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead.
[0114] In this embodiment, a unified authentication token generation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0115] This embodiment provides a unified authentication token generation device, which is applied to Figure 1 In the illustrated unified authentication token generation system, the system includes a client 10, a gateway 20, an authentication server 30 and a database 40, and the following means are executed by the gateway 20, such as Figure 6 As shown, the device comprises:
[0116] The user request information determination module 601 is used to receive the user request information sent by the client and determine the user request information;
[0117] The user request information forwarding module 602 is used to send the user request information to the authentication server when it is determined that the user request information is a user login request, so that the authentication server compares the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, encrypt the login information once into an initial token;
[0118] A secondary encryption module 603 is used to receive the initial token issued by the authentication server and perform secondary encryption on the initial token to generate a final token;
[0119] The final token sending module 604 is used to return the final token to the client corresponding to the user request information.
[0120] In some optional implementations, the secondary encryption module 603 is further used to:
[0121] Generate security parameters based on the user request information; the security parameters include client IP, client model and token validity period;
[0122] Based on the security parameters, the initial token is encrypted again to generate a final token.
[0123] In some optional implementations, the user request information determination module 601 is further used to:
[0124] When the user request information includes the login information, determining that the user request information is a user login request; the login information includes a user name and a password;
[0125] When the user request information includes a login token, it is determined that the user request information is a non-user login request.
[0126] In some optional embodiments, the device is also used for:
[0127] When it is determined that the user request information is not user login request information, the login token in the user request information is parsed to obtain security parameters in the login token;
[0128] The login token is verified once according to the security parameters in the login token, and after the verification is passed, the user request information is sent to the corresponding business system so that the business system performs a second verification on the login token.
[0129] The more specific functional descriptions of the above modules and units are the same as those of the above corresponding embodiments and will not be repeated here.
[0130] In this embodiment, a unified authentication token generation device is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0131] In summary, the gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead.
[0132] This embodiment provides another unified authentication token generation device, which is applied to Figure 1 In the illustrated unified authentication token generation system, the system includes a client 10, a gateway 20, an authentication server 30 and a database 40, and the following means are executed by the authentication server 30, such as Figure 7 As shown, the device comprises:
[0133] The user request information receiving module 701 is used to receive the user request information sent by the client through the gateway; the user request information is determined by the gateway as a user login request;
[0134] The one-time encryption module 702 is used to compare the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted into an initial token and sent to the gateway, so that the gateway performs a second encryption on the initial token and generates a final authentication command and sends it to the client corresponding to the user request information.
[0135] In some optional implementations, the one-time encryption module 702 is further used to:
[0136] Get the target encryption format of the token;
[0137] The login information is encrypted into an initial token according to the target encryption format.
[0138] The more specific functional descriptions of the above modules and units are the same as those of the above corresponding embodiments and will not be repeated here.
[0139] Another unified authentication token generation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0140] In summary, the gateway receives the user request information sent by the client and judges the user request information. When it is judged that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the authentication server encrypts the login information once into an initial token; the gateway encrypts the initial token twice to generate a final token, and returns the final token to the client corresponding to the user request information. The above scheme generates the final token after two encryptions, which ensures the security of data transmission, and adds some security parameter verification to the parameters of the secondary encryption algorithm, which effectively prevents attacks from external systems, further ensures data security, compresses the size ratio of tokens, and reduces unnecessary traffic overhead.
[0141] The embodiment of the present invention also provides a computer device having the above Figure 6 A unified authentication token generation device and Figure 7 Another unified authentication token generation device is shown.
[0142] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 810, memory 820, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 810 is taken as an example.
[0143] The processor 810 may be a central processing unit, a network processor or a combination thereof. The processor 810 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0144] The memory 820 stores instructions executable by at least one processor 810, so that the at least one processor 810 executes the method shown in the above embodiment.
[0145] The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 820 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 820 may optionally include a memory remotely arranged relative to the processor 810, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0146] The memory 820 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 820 may also include a combination of the above types of memory.
[0147] The computer device also includes a communication interface 830 for the computer device to communicate with other devices or a communication network.
[0148] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0149] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0150] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A unified authentication token generation method, characterized in that: The invention is applied to a unified authentication token generation system, the system includes a client, a gateway, an authentication server and a database, the method is executed by the gateway, the gateway is used for identity authentication and authorization, and the system also includes a business system; the method includes: Receiving user request information sent by the client, and judging the user request information; When it is determined that the user request information is a user login request, the user request information is sent to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, the login information is encrypted once into an initial token; Receiving the initial token issued by the authentication server, and performing secondary encryption on the initial token to generate a final token; Returning the final token to the client corresponding to the user request information; The receiving the user request information sent by the client and judging the user request information includes: When the user request information includes a login token, determining that the user request information is a non-user login request; When it is determined that the user request information is non-user login request information, the method further includes: Parsing the login token in the user request information to obtain security parameters in the login token; The login token is verified once according to the security parameters in the login token, and after the verification is passed, the user request information is sent to the corresponding business system so that the business system performs a second verification on the login token.
2. The method according to claim 1, characterized in that The secondary encryption of the initial token to generate a final token includes: Generate security parameters according to the user request information; the security parameters include client IP, client model and token validity period; The initial token is encrypted again according to the security parameter to generate a final token.
3. The method according to claim 1, characterized in that The receiving the user request information sent by the client and judging the user request information includes: When the user request information includes the login information, it is determined that the user request information is a user login request; the login information includes a user name and a password.
4. A unified authentication token generation method, characterized in that: The invention is applied to a unified authentication token generation system, the system includes a client, a gateway, an authentication server and a database, the method is executed by the authentication server, the gateway is used for identity authentication and authorization, and the system also includes a business system; the method includes: When the gateway determines that the user request information sent by the client is a user login request, the gateway receives the user request information; when the user request information includes a login token, the gateway determines that the user request information is a non-user login request; The login information in the user request information is compared with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted into an initial token and sent to the gateway, so that the gateway performs a second encryption on the initial token and generates a final authentication command and sends it to the client corresponding to the user request information. When it is determined that the user request information is not user login request information, the gateway performs a second analysis on the login token in the user request information to obtain the security parameters in the login token. The gateway performs a second verification on the login token based on the security parameters in the login token, and after the verification is passed, the gateway sends the user request information to the corresponding business system, so that the business system performs a second verification on the login token.
5. The method according to claim 4, characterized in that The step of encrypting the login information into an initial token comprises: Get the target encryption format of the token; The login information is encrypted into an initial token according to the target encryption format.
6. A unified authentication token generation device, characterized in that: The invention is applied to a unified authentication token generation system, the system includes a client, a gateway, an authentication server and a database, the device is executed by the gateway, the gateway is used for identity authentication and authorization, and the system also includes a business system; the device includes: A user request information judgment module, used for receiving the user request information sent by the client and judging the user request information; A user request information forwarding module is used to, when determining that the user request information is a user login request, send the user request information to the authentication server, so that the authentication server compares the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, encrypt the login information once into an initial token; A secondary encryption module, used for receiving the initial token issued by the authentication server and performing secondary encryption on the initial token to generate a final token; A final token sending module, used for returning the final token to the client corresponding to the user request information; The user request information judging module is further used to judge that the user request information is a non-user login request when the user request information includes a login token; When it is determined that the user request information is not user login request information, the device is also used to parse the login token in the user request information to obtain the security parameters in the login token; verify the login token according to the security parameters in the login token, and after the verification is passed, send the user request information to the corresponding business system so that the business system performs a second verification on the login token.
7. A unified authentication token generation device, characterized in that: The invention is applied to a unified authentication token generation system, the system comprising a client, a gateway, an authentication server and a database, the device is executed by the authentication server, the gateway is used for identity authentication and authorization, and the system also comprises a business system; the device comprises: A user request information receiving module, used to receive user request information sent by the client through the gateway; the user request information is judged by the gateway as a user login request; when the user request information includes a login token, the gateway judges the user request information as a non-user login request; A one-time encryption module is used to compare the login information in the user request information with the user storage information in the database. When the database contains user storage information corresponding to the login information, the login information is encrypted once into an initial token and sent to the gateway, so that the gateway performs a second encryption on the initial token and generates a final authentication command and sends it to the client corresponding to the user request information; when it is determined that the user request information is not user login request information, the gateway performs a one-time analysis on the login token in the user request information to obtain the security parameters in the login token; the gateway performs a one-time verification on the login token according to the security parameters in the login token, and after the verification is passed, the gateway sends the user request information to the corresponding business system, so that the business system performs a second verification on the login token.
8. A unified authentication token generation system, characterized in that: The system includes a client, a gateway, an authentication server and a database; the gateway is used for identity authentication and authorization, and the system also includes a business system; The client is used to send user request information; The gateway is used to receive the user request information sent by the client, and judge the user request information, and when it is judged that the user request information is a user login request, send the user request information to the authentication server; When the user request information includes a login token, the gateway is further used to determine that the user request information is a non-user login request; The authentication server is used to compare the login information in the user request information with the user storage information in the database, and when the user storage information corresponding to the login information exists in the database, encrypt the login information once into an initial token, and send the initial token to the gateway; The gateway is further used to receive the initial token issued by the authentication server and perform secondary encryption on the initial token to generate a final token; Returning the final token to the client corresponding to the user request information; When it is determined that the user request information is not user login request information, the gateway is also used to parse the login token in the user request information to obtain the security parameters in the login token; verify the login token according to the security parameters in the login token, and after the verification is passed, send the user request information to the corresponding business system so that the business system can perform a second verification on the login token.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes a unified authentication token generation method as described in any one of claims 1 to 5 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute a unified authentication token generation method according to any one of claims 1 to 5.
11. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute a unified authentication token generation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Gateway routing forwarding based authentication method
CN108512784A
Method and system for realizing unified identity authentication strategy for micro-service architecture
CN110086822A
Gateway authentication and identity authentication platform and method thereof
CN111865920A
EPG webpage security access system and method based on IPTV
CN114374862A
Security authentication method, system and device based on gateway Token and medium
CN115589295A
