Distributed micro-service system login verification method and device

By reading user login information and authenticating in the local cache of gateway microservice instances of distributed microservice systems, combined with the target database refresh expiration time, the IO performance bottleneck problem caused by frequent communication between gateway microservice instances and redis databases is solved, and the system authentication speed and overall performance are improved.

CN120200762APending Publication Date: 2025-06-24SHENZHEN SISENSING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311774685.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The gateway microservice instance of a distributed microservice system needs to communicate with the redis database twice during authentication, which leads to IO performance bottlenecks, especially when the operation request volume is large, which may lead to untimely authentication or system stuttering.

Method used

By reading user login information in the local cache of the gateway microservice instance and performing authentication once, the expiration time refresh instruction is sent to the target database after success, combining the local cache and the target database to reduce the number of communications with the target database.

Benefits of technology

It effectively avoids IO blockage or performance bottlenecks caused by frequent reading of the target database, improves the authentication speed and response speed of operation requests, and improves the overall performance of distributed microservice systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120200762A_ABST
    Figure CN120200762A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a distributed micro-service system login verification method and device. The method comprises the following steps: receiving an operation request sent by a client; based on the operation request, reading first user login information from a local cache of the current gateway micro-service instance; performing primary authentication based on the first user login information; under the condition that the first authentication succeeds, an expiration time refreshing instruction is sent to the target database, the expiration time refreshing instruction is used for indicating the target database to refresh the expiration time of the first user login information, and an expiration time refreshing result is returned; under the condition that the expiration time refreshing result is received, refreshing result verification is carried out to determine that expiration time refreshing succeeds or fails; releasing the operation request under the condition of determining that the expiration time is successfully refreshed; the target database is a database used for storing all user login information in the distributed micro-service system, and the authentication speed and the response speed of the operation request are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a distributed microservice system login verification method and device. Background Art

[0002] Operations involving user data security in software systems usually require authentication, that is, verifying whether the user has logged in. Only when the authentication is successful can the relevant operations be performed. Authentication of stand-alone software systems is usually performed on the local server, and the user login information of stand-alone software systems is usually stored in the local memory of the server. When receiving an operation request from the user, the server queries the local memory for the user login information corresponding to the token carried in the operation request, and performs authentication based on the queried user login information. The authentication operation of a distributed microservice system is usually performed in its entry gateway microservice, and the entry gateway microservice routes the successfully authenticated operation request to the corresponding business processing microservice.

[0003] However, since there are usually multiple gateway microservice instances in the entry gateway microservice, if the user login information is stored in the local memory of the entry gateway microservice, it will affect the reading of the user login information by the remaining gateway microservice instances, that is, the user login information in the local memory cannot be shared between multiple gateway microservice instances. Therefore, in order to realize the shared reading of user login information by multiple gateway microservice instances, at present, the user login information of the user is usually stored in the redis (Remote Dictionary Server, a memory-based open source database) database, and each gateway microservice instance can read the corresponding user login information from the redis database. When any gateway microservice instance receives an operation request from the user, it first reads the corresponding user login information from the redis database, performs authentication based on the read user login information, and after successful authentication, refreshes the expiration time of the user login information in the redis database and releases the request. During the entire authentication process, the gateway microservice instance needs to communicate with the redis database twice, and due to the limited IO (Input / Output, input and output) resources, when the operation request volume is large, IO performance bottleneck problems are prone to occur, resulting in untimely authentication or system freezes. Summary of the invention

[0004] The present invention provides a distributed microservice system login verification method and device, which are used to solve the problem that a gateway microservice instance of a distributed microservice system in the prior art needs to communicate with a redis database twice during authentication. When the amount of operation requests is large, an IO performance bottleneck problem is likely to occur, resulting in untimely authentication or system freeze.

[0005] The present invention provides a method for logging in and verifying in a distributed microservice system, including:

[0006] Receiving an operation request sent by a client;

[0007] Based on the operation request, reading first user login information from the local cache of the current gateway microservice instance;

[0008] Based on the first user login information, performing a first authentication;

[0009] In the case where the first authentication is successful, sending an expiration time refresh instruction to the target database, where the expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result; in the case of receiving the expiration time refresh result, performing a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case of determining that the expiration time refresh is successful, releasing the operation request; the target database is a database in the distributed microservice system for storing all user login information.

[0010] Optionally, the step of reading first user login information from the local cache of the current gateway microservice instance based on the operation request includes:

[0011] Based on the token carried in the operation request, querying and obtaining the first user login information corresponding to the token from the local cache.

[0012] Optionally, the step of performing a first authentication based on the first user login information includes:

[0013] In the case of determining that the content of the first user login information is complete, determining that the first authentication is successful;

[0014] In the case of determining that the first user login information is empty, determining that the first authentication fails.

[0015] Optionally, the step of releasing the operation request in the case of determining that the expiration time refresh is successful includes:

[0016] In the case of determining that the expiration time refresh is successful, sending the operation request to the corresponding business processing microservice in the distributed microservice system.

[0017] Optionally, it further includes:

[0018] In the case of determining that the expiration time refresh fails, sending a refresh failure message and a user login prompt to the client.

[0019] Optionally, it further includes:

[0020] In the case of an authentication failure, send a user login information reading request to the target database. The user login information reading request is used to instruct the target database to query user login information based on the token carried by the user login information reading request, and return the queried second user login information to the gateway microservice instance;

[0021] In the case of receiving the second user login information, perform secondary authentication based on the second user login information;

[0022] In the case of successful secondary authentication, release the operation request;

[0023] In the case of failed secondary authentication, send the secondary authentication result and user login prompt to the client.

[0024] Optionally, it further includes:

[0025] In the case of successful secondary authentication, cache the second user login information and the corresponding token in the local cache of the current gateway microservice instance;

[0026] Send an expiration time refresh instruction to the target database to refresh the expiration time of the second user login information in the target database.

[0027] The present invention also provides a login verification device for a distributed microservice system. The login verification device for the distributed microservice system runs on the gateway microservice instance of the distributed microservice system, and includes:

[0028] An operation request receiving module, configured to receive an operation request sent by a client;

[0029] A first user login information obtaining module, configured to read first user login information from the local cache of the current gateway microservice instance based on the operation request;

[0030] A primary authentication module, configured to perform primary authentication based on the first user login information;

[0031] A processing module, configured to, in the case of successful primary authentication, send an expiration time refresh instruction to the target database. The expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result; in the case of receiving the expiration time refresh result, perform a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case of determining that the expiration time refresh is successful, release the operation request; the target database is a database in the distributed microservice system for storing all user login information.

[0032] The present invention also provides a distributed microservices system, including:

[0033] A gateway microservices cluster, a target database, and business processing microservices; the gateway microservices cluster includes multiple gateway microservices instances, and the distributed microservices system login verification device as described above is provided in the gateway microservices instances, and the gateway microservices instances correspond to local caches one by one; the target database is a database in the distributed microservices system for storing all user login information; each of the network microservices instances is respectively connected to the target database, and each of the network microservices instances is respectively connected to the business processing microservices.

[0034] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the distributed microservices system login verification method as described in any one of the above.

[0035] Advantages of the present invention: The distributed microservices system login verification method and device provided by the present invention receive an operation request sent by a client; based on the operation request, read first user login information from the local cache of the current gateway microservices instance; based on the first user login information, perform a first authentication; in the case of successful first authentication, send an expiration time refresh instruction to the target database, and the expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result; in the case of receiving the expiration time refresh result, perform a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case of determining that the expiration time refresh is successful, release the operation request; the target database is a database in the distributed microservices system for storing all user login information. By combining the target database with the local cache, it preferably avoids the problems of IO blockage or IO performance bottleneck caused by frequently reading the target database, effectively improves the authentication speed and response speed of operation requests, improves the overall performance of the distributed microservices system, and has strong feasibility. Description of the Drawings

[0036] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0037] Figure 1 It is a flowchart of the distributed microservices system login verification method provided by the present invention;

[0038] Figure 2It is a schematic flowchart of a specific embodiment of the distributed microservice system login verification method provided by the present invention;

[0039] Figure 3 It is a schematic flowchart of another specific embodiment of the distributed microservice system login verification method provided by the present invention;

[0040] Figure 4 It is a schematic structural diagram of the distributed microservice system login verification device provided by the present invention;

[0041] Figure 5 It is a schematic structural diagram of the electronic device provided by the present invention. Specific Embodiments

[0042] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts shall fall within the protection scope of the present invention.

[0043] To facilitate the understanding of the distributed microservice system login verification method and device provided by the present invention, the technical terms involved in the present invention will be explained below.

[0044] Distributed microservice system: A system based on the microservice architecture, in which each microservice communicates and collaborates through a network to jointly build a large-scale and feature-rich application system. In a distributed microservice system, the system is split into multiple relatively independent microservices, and each microservice is responsible for handling a specific business function. Each microservice can be developed, deployed and extended independently, using a technology stack and tools suitable for its own needs.

[0045] Internet distributed microservice system: A distributed microservice system based on the Internet environment.

[0046] Gateway microservice: In a microservice architecture or system, a dedicated service for processing external requests and forwarding them to internal microservices. The gateway microservice usually serves as the entry point of the entire microservice system, responsible for receiving and processing external requests, and then routing the requests to the corresponding backend microservices.

[0047] Gateway microservice instance: A running instance of the gateway microservice. The gateway microservice corresponds to one or more gateway microservice instances, and each gateway microservice instance is independent of each other. From a hardware perspective, each gateway microservice instance is equivalent to a separate server.

[0048] It should be noted that the login verification steps of a distributed microservice system in the related art generally include: after the user inputs an account and password and logs in successfully, the distributed microservice system generates a token and returns the token to the client. The server (i.e., the distributed microservice system) stores the token and the corresponding user login information in the redis database and sets an expiration time, that is, the login expiration time. If the current time exceeds the expiration time of the user login information, the user login information is cleared and the user is prompted to log in again. When the gateway microservice instance of the distributed microservice system receives an operation request from the user, it queries the user login information from the redis database based on the token carried in the operation request. Based on the queried user login information, authentication is performed. In the case of successful authentication, the expiration time of the user login information is updated and the operation request is released to allow the business processing microservice of the distributed microservice system to continue processing the operation request. If the user login information cannot be queried, the query result is returned to the client to prompt the user to log in. In the above authentication steps, the gateway microservice instance and the redis database need to communicate twice. Since the IO resources of the redis database are limited, when the amount of operation requests is large, it is easy to have an IO performance bottleneck problem, resulting in untimely authentication or system lag. Therefore, the present invention provides a distributed microservice system login verification method and device to solve the above technical problems.

[0049] Next, in the form of embodiments, combined with Figures 1 - 5 describe the distributed microservice system login verification method and device provided by the present invention.

[0050] Please refer to Figure 1 , the distributed microservice system login verification method provided in this embodiment (the execution subject of the distributed microservice system login verification method in this embodiment is the gateway microservice instance, and a plurality of the gateway microservice instances form a gateway microservice cluster, and the gateway microservice cluster is set in the distributed microservice system), includes:

[0051] S110: Receive an operation request sent by the client. Specifically, receive an operation request sent by the user from the client. The operation request is such as a web request, a mobile application request, etc.

[0052] S120: Based on the operation request, read the first user login information from the local cache of the current gateway microservice instance.

[0053] It should be noted that in this embodiment, each gateway microservice instance corresponds to a local cache respectively. Therefore, in the case of receiving an operation request, based on the operation request, the first user login information is read from the local cache of the current gateway microservice instance for subsequent authentication, reducing the number of communications and interaction times with the target database and reducing the occupation of IO resources.

[0054] It should also be noted that the local cache of each gateway microservice instance is used to cache the user's login information. In this embodiment, when the user's login information is cached in the local cache of the gateway microservice instance, the login information of the user corresponding to the operation request can be directly read from the local cache, that is, the above-mentioned first user login information, thereby reducing the number of communications and interactions with the target database and avoiding situations such as IO congestion. When the user's login information is missing in the local cache of the gateway microservice instance, that is, when the user's login information is not cached, information is read from the target database for subsequent authentication operations.

[0055] S130: Perform a first authentication based on the first user login information.

[0056] Specifically, determine whether the first user login information is empty. If the first user login information is empty, it is determined that the first authentication fails; if the first user login information is not empty, it is determined that the first authentication is successful.

[0057] S140: In the case where the first authentication is successful, send an expiration time refresh instruction to the target database. The expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information (it should be noted that in the case where the first authentication is successful, it means that the target database and the local cache of the current gateway microservice instance store the same user login information, that is, this first user login information. Therefore, refreshing the expiration time of the first user login information here means refreshing the expiration time of the second user login information in the target database that is the same as this first user login information. For the convenience of distinguishing the user login information in the local cache and the target database, in this embodiment, the first user login information corresponds to the local cache, and the second user login information corresponds to the target database), and return the expiration time refresh result; in the case of receiving the expiration time refresh result, perform a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case of determining that the expiration time refresh is successful, release the operation request; the target database is a database in the distributed microservice system for storing all user login information.

[0058] It should be noted that in this embodiment, in the case of successful primary authentication, the gateway microservice instance needs to refresh the expiration time of the user's login information in the target database, that is, the first user login information, and determine whether the expiration time is successfully refreshed. If the refresh is successful, it is determined that the first user login information exists in the target database, and then the operation request can be released. If the refresh fails, it indicates that the user's login status has expired, and the user needs to be prompted to log in again. Through the above steps, the interaction times between the gateway microservice instance and the target database can be better reduced, the occupation of IO resources of the target database can be effectively reduced, the system performance can be improved, and problems such as lag can be avoided.

[0059] It should also be noted that the target database is a redis database or a MySQL (an open-source relational database management system) database.

[0060] It should be mentioned that the user login information in the local cache of each gateway microservice instance, that is, the first user login information, is synchronized from the target database after the user's first successful login. Specifically, after the user's first successful login, the target database stores the user login information (the second user login information) and the corresponding token, and synchronizes the second user login information and the corresponding token to the local cache of the corresponding gateway microservice instance.

[0061] In some embodiments, the step of reading the first user login information from the local cache of the current gateway microservice instance based on the operation request includes:

[0062] S1201: Based on the token carried in the operation request, query and obtain the first user login information corresponding to the token from the local cache. It should be noted that by querying and obtaining the first user login information corresponding to the token from the local cache of the current gateway microservice instance based on the token carried in the operation request, the accurate extraction of the user's login information can be realized, and it can also help to reduce the interaction times with the target database.

[0063] In some embodiments, the step of performing primary authentication based on the first user login information includes:

[0064] S1301: When it is determined that the content of the first user login information is complete, it is determined that the primary authentication is successful. Specifically, when it is determined that the first user login information is not empty, it is determined that the authentication is successful.

[0065] S1302: When it is determined that the first user login information is empty, it is determined that the primary authentication fails.

[0066] It should be noted that it is relatively convenient to implement the authentication by adopting the above steps once.

[0067] In some embodiments, when it is determined that the expiration time is successfully refreshed, the step of releasing the operation request includes:

[0068] When it is determined that the expiration time is successfully refreshed, send the operation request to the corresponding business processing microservice in the distributed microservice system. It should be noted that by sending the operation request to the corresponding business processing microservice in the distributed microservice system when it is determined that the expiration time is successfully refreshed, it is convenient for the subsequent business processing microservice to process the operation request.

[0069] In some embodiments, it further includes:

[0070] When it is determined that the expiration time refresh fails, send a refresh failure message and a user login prompt to the client. Specifically, when it is determined that the expiration time refresh fails, send the refresh failure message to the client and prompt the user to log in again.

[0071] In some embodiments, it further includes:

[0072] ① When the authentication fails once, send a user login information reading request to the target database. The user login information reading request is used to instruct the target database to query the user login information based on the token carried by the user login information reading request, and return the queried second user login information to the gateway microservice instance.

[0073] ② When receiving the second user login information, perform secondary authentication based on the second user login information. It should be noted that the steps of secondary authentication include:

[0074] When it is determined that the content of the second user login information is complete, determine that the secondary authentication is successful, that is, when it is determined that the second user login information is not empty, determine that the authentication is successful. When it is determined that the second user login information is empty, determine that the secondary authentication fails.

[0075] ③ When the secondary authentication is successful, release the operation request. Specifically, when the secondary authentication is successful, send the operation request to the corresponding business processing microservice in the distributed microservice system.

[0076] ④ When the secondary authentication fails, send the secondary authentication result and a user login prompt to the client.

[0077] In some embodiments, it further includes:

[0078] In the case of successful secondary authentication, cache the second user login information and the corresponding token in the local cache of the current gateway microservice instance. It should be noted that in the case of successful secondary authentication, it indicates that the login information of this user is stored in the target database and has not expired. Therefore, by caching the login information of this user, that is, the second user login information, and the corresponding token in the local cache of the current gateway microservice instance, when the operation request of this user is received next time, the login information of the user can be directly read from the local cache of the gateway microservice instance, so as to reduce the number of interactions with the target database, avoid the occurrence of IO bottlenecks, and ensure the stability of the system.

[0079] In some embodiments, it further includes:

[0080] Send an expiration time refresh instruction to the target database to refresh the expiration time of the second user login information in the target database.

[0081] The following uses a specific embodiment to further explain the distributed microservice system login verification method in the above embodiments.

[0082] Please refer to Figure 2 , the distributed microservice system login verification method includes:

[0083] First, the user sends an operation request to the gateway microservice cluster via the client.

[0084] Secondly, in the case where any gateway microservice instance in the gateway microservice cluster receives the operation request, based on the token carried in the operation request, read the first login information of this user from the corresponding local cache, and perform primary authentication on the first user login information.

[0085] In the case of successful primary authentication, refresh the expiration time of the login information of this user in the target database, and obtain the expiration time refresh result returned by the target database; verify the expiration time refresh result, that is, determine whether the refresh is successful; in the case of determining that the expiration time refresh is successful, release the operation request, that is, send the operation request to the business processing microservice; in the case of determining that the expiration time refresh fails, it indicates that the login status of this user has expired, and send a refresh failure message and a user login prompt to the client.

[0086] In the case of an authentication failure, send a user login information reading request to the target database; the target database queries the user login information based on the token carried in the user login information reading request, and returns the queried second user login information to the gateway microservice instance; when the gateway microservice instance receives the second user login information, it performs secondary authentication based on the second user login information; in the case of successful secondary authentication, the operation request is released; in the case of failed secondary authentication, the secondary authentication result and the user login prompt are sent to the client.

[0087] The following further explains the distributed microservice system login verification method in the above embodiment with another specific embodiment.

[0088] Please refer to Figure 3 , the distributed microservice system login verification method includes:

[0089] S310: Send an operation request. Specifically, the user sends an operation request to any one of the gateway microservice instances in the gateway microservice cluster through the client.

[0090] S320: Read the first user login information from the local cache. Specifically, read the first user login information from the local cache of the current gateway microservice instance.

[0091] S330: The local cache returns the first user login information. Specifically, the gateway microservice instance receives the first user login information returned by the local cache.

[0092] S340: Perform primary authentication. Specifically, based on the first user login information, perform primary authentication, that is, verify whether the first user login information is empty.

[0093] S3501: If the first user login information is not empty, refresh the expiration time of the target database. Specifically, if the first user login information is not empty, refresh the expiration time of the login information of this user in the target database.

[0094] S3502: Receive the expiration time refresh result returned by the target database.

[0095] S3503: Verify whether the expiration time is refreshed successfully. Specifically, verify based on the expiration time refresh result to determine whether the expiration time is refreshed successfully.

[0096] S3504: If the expiration time is refreshed successfully, release the operation request. Specifically, send the operation request to the business processing microservice.

[0097] S3505: If the expiration time refresh fails, prompt the user to log in.

[0098] S3601: If the first user login information is empty, read the second user login information from the target database. Specifically, based on the token carried in the operation request, query the login information of the current user from the target database, and determine the queried user's login information as the second user login information.

[0099] S3602: Receive the second user login information returned by the target database.

[0100] S3603: Perform secondary authentication. Specifically, verify whether the second user login information is empty.

[0101] S3604: If the secondary authentication is successful, cache it locally. Specifically, if the second user login information is not empty, cache the second user login information and the corresponding token to the local cache of the current gateway microservice instance.

[0102] S3605: Release the operation request.

[0103] S3606: If the secondary authentication fails, prompt the user to log in.

[0104] It should be noted that the above steps S3501 - S3505 and steps S3601 - S3606 are two parallel cases. In the specific implementation process, for the case where the first user login information is not empty, execute steps S3501 - S3505; for the case where the first user login information is empty, execute steps S3601 - S3606.

[0105] Next, the distributed microservice system login verification device provided by the present invention will be described. The distributed microservice system login verification device described below can be mutually corresponding and referred to with the distributed microservice system login verification method described above.

[0106] Please refer to Figure 4 , the distributed microservice system login verification device provided in this embodiment, the distributed microservice system login verification device runs on the gateway microservice instance of the distributed microservice system, and includes:

[0107] An operation request receiving module 410, configured to receive an operation request sent by a client;

[0108] A first user login information obtaining module 420, configured to read the first user login information from the local cache of the current gateway microservice instance based on the operation request;

[0109] A primary authentication module 430, configured to perform primary authentication based on the first user login information;

[0110] A processing module 440, which is configured to send an expiration time refresh instruction to a target database in the case of successful primary authentication. The expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result. In the case of receiving the expiration time refresh result, perform a refresh result verification to determine whether the expiration time refresh is successful or failed. In the case of determining that the expiration time refresh is successful, release the operation request. The target database is a database in a distributed microservices system for storing all user login information. The operation request receiving module 410, the first user login information obtaining module 420, the primary authentication module 430, and the processing module 440 are connected. The distributed microservices system login verification device in this embodiment combines the target database with the local cache, which preferably avoids the problems of IO congestion or IO performance bottleneck caused by frequent reading of the target database, effectively improves the authentication speed and response speed of the operation request, improves the overall performance of the distributed microservices system, has strong practicability, and low cost.

[0111] In some embodiments, the first user login information obtaining module 420 is specifically configured to query and obtain the first user login information corresponding to the token from the local cache based on the token carried in the operation request.

[0112] In some embodiments, the primary authentication module 430 is specifically configured to determine that the primary authentication is successful in the case of determining that the content of the first user login information is complete;

[0113] In the case of determining that the first user login information is empty, determine that the primary authentication fails.

[0114] In some embodiments, the processing module 440 is specifically configured to send the operation request to the corresponding business processing microservice in the distributed microservices system in the case of determining that the expiration time refresh is successful.

[0115] In some embodiments, the processing module 440 is further specifically configured to send a refresh failure message and a user login prompt to the client in the case of determining that the expiration time refresh fails.

[0116] In some embodiments, it further includes: a secondary authentication module, which is configured to send a user login information reading request to the target database in the case of primary authentication failure. The user login information reading request is used to instruct the target database to query user login information based on the token carried in the user login information reading request and return the queried second user login information to the gateway microservice instance;

[0117] Upon receiving the second user login information, perform secondary authentication based on the second user login information;

[0118] If the secondary authentication is successful, release the operation request;

[0119] If the secondary authentication fails, send the secondary authentication result and the user login prompt to the client.

[0120] In some embodiments, it further includes:

[0121] A cache module, configured to cache the second user login information and the corresponding token to the local cache of the current gateway microservice instance when the secondary authentication is successful;

[0122] An expiration time refresh module, configured to send an expiration time refresh instruction to the target database to refresh the expiration time of the second user login information in the target database.

[0123] This embodiment further provides a distributed microservice system, including:

[0124] A gateway microservice cluster, a target database, and a business processing microservice; the gateway microservice cluster includes multiple gateway microservice instances, and the distributed microservice system login verification device as described above is provided in the gateway microservice instance, and the gateway microservice instance corresponds to the local cache one by one; the target database is a database for storing all user login information in the distributed microservice system; each network microservice instance is respectively connected to the target database, and each network microservice instance is respectively connected to the business processing microservice. The distributed microservice system in this embodiment can effectively improve the timely processing of user operation requests, avoid the occurrence of IO bottleneck problems, and has strong system stability.

[0125] Figure 5 Illustrates a schematic diagram of the physical structure of an electronic device, as Figure 5As shown in the figure, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communications interface 520, and the memory 530 complete communication with each other through the communication bus 540. The processor 510 may call the logical instructions in the memory 530 to execute the login verification method for the distributed microservice system. The method includes: receiving an operation request sent by a client; based on the operation request, reading the first user login information from the local cache of the current gateway microservice instance; based on the first user login information, performing a primary authentication; in the case of successful primary authentication, sending an expiration time refresh instruction to the target database, where the expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result; in the case of receiving the expiration time refresh result, performing a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case of determining that the expiration time refresh is successful, releasing the operation request; the target database is a database in the distributed microservice system for storing all user login information.

[0126] In addition, when the logical instructions in the above-mentioned memory 530 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0127] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the distributed microservice system login verification method provided by the above-mentioned various methods. The method includes: receiving an operation request sent by a client; based on the operation request, reading first user login information from the local cache of the current gateway microservice instance; based on the first user login information, performing a first authentication; in the case where the first authentication is successful, sending an expiration time refresh instruction to a target database, the expiration time refresh instruction being used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result; in the case of receiving the expiration time refresh result, performing a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case where it is determined that the expiration time refresh is successful, releasing the operation request; the target database is a database in the distributed microservice system for storing all user login information.

[0128] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.

[0129] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0130] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A login verification method for a distributed microservice system, characterized in that, Including: Receiving an operation request sent by a client; Based on the operation request, reading first user login information from the local cache of the current gateway microservice instance; Based on the first user login information, performing primary authentication; In the case of successful primary authentication, sending an expiration time refresh instruction to the target database, where the expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result; in the case of receiving the expiration time refresh result, performing a refresh result verification to determine whether the expiration time refresh is successful or failed; in the case of determining that the expiration time refresh is successful, releasing the operation request; the target database is a database in the distributed microservice system for storing all user login information.

2. The login verification method of the distributed microservice system according to claim 1, characterized in that, The step of reading first user login information from the local cache of the current gateway microservice instance based on the operation request includes: Based on the token carried in the operation request, querying and obtaining the first user login information corresponding to the token from the local cache.

3. The login verification method of the distributed microservice system according to claim 1, characterized in that, The step of performing primary authentication based on the first user login information includes: In the case of determining that the content of the first user login information is complete, determining that the primary authentication is successful; In the case of determining that the first user login information is empty, determining that the primary authentication is failed.

4. The login verification method for the distributed microservice system according to claim 1, characterized in that, The step of releasing the operation request in the case of determining that the expiration time refresh is successful includes: In the case of determining that the expiration time refresh is successful, sending the operation request to the corresponding business processing microservice in the distributed microservice system.

5. The login verification method of the distributed microservice system according to claim 1, wherein Also including: In the case of determining that the expiration time refresh is failed, sending a refresh failure message and a user login prompt to the client.

6. The login verification method of the distributed microservice system according to claim 1, characterized in that Also including: In the case of failed primary authentication, sending a user login information reading request to the target database, where the user login information reading request is used to instruct the target database to query user login information based on the token carried in the user login information reading request and return the queried second user login information to the gateway microservice instance; In the case of receiving the second user login information, performing secondary authentication based on the second user login information; In the case of successful secondary authentication, releasing the operation request; In the case of failed secondary authentication, sending the secondary authentication result and a user login prompt to the client.

7. The login verification method of the distributed microservice system according to claim 6, wherein, Also including: In the case of successful secondary authentication, caching the second user login information and the corresponding token to the local cache of the current gateway microservice instance; Sending an expiration time refresh instruction to the target database to refresh the expiration time of the second user login information in the target database.

8. A distributed microservice system login verification device, characterized in that, The login verification device of the distributed microservice system runs on the gateway microservice instance of the distributed microservice system and includes: An operation request receiving module for receiving an operation request sent by a client; A first user login information obtaining module for reading first user login information from the local cache of the current gateway microservice instance based on the operation request; The primary authentication module is used to perform primary authentication based on the first user login information; The processing module is used to, when the primary authentication is successful, send an expiration time refresh instruction to the target database. The expiration time refresh instruction is used to instruct the target database to refresh the expiration time of the first user login information and return an expiration time refresh result. When receiving the expiration time refresh result, perform a refresh result verification to determine whether the expiration time refresh is successful or failed. When determining that the expiration time refresh is successful, release the operation request. The target database is a database in the distributed microservices system for storing all user login information.

9. A distributed microservices system, characterized in that, It includes: The gateway microservice cluster, the target database, and the business processing microservice; The gateway microservice cluster includes multiple gateway microservice instances. The distributed microservices system login verification device as described in claim 8 is provided in the gateway microservice instance, and the gateway microservice instance corresponds to a local cache one by one. The target database is a database in the distributed microservices system for storing all user login information. Each of the network microservice instances is respectively connected to the target database, and each of the network microservice instances is respectively connected to the business processing microservice.

10. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the distributed microservices system login verification method as described in any one of claims 1 to 7.