User information acquisition method, device, equipment and medium for micro service

文档序号:168553 发布日期:2021-10-29 浏览:40次 中文

阅读说明:本技术 用于微服务的用户信息获取方法、装置、设备及介质 (User information acquisition method, device, equipment and medium for micro service ) 是由 刘光伟 于 2021-07-29 设计创作,主要内容包括:本公开提供一种用于微服务的用户信息获取方法,涉及微服务技术领域,可应用金融科技领域或其他领域。该用户信息获取方法包括:生成访问令牌,其中,所述访问令牌适用于直接对登录用户进行认证;根据所述访问令牌生成访问请求,并通过前端发送所述访问请求至后端对应的微服务应用接口;对后端各微服务应用接口进行自定义注解,以使得当前微服务应用接口根据所述访问令牌获取当前登录用户的用户信息,并将所述用户信息赋值到注解参数中,以供其他微服务应用接口使用。本公开还提供一种用于微服务的用户信息获取装置、电子设备、计算机可读存储介质及计算机程序产品。(The disclosure provides a user information acquisition method for micro-services, relates to the technical field of micro-services, and can be applied to the field of financial science and technology or other fields. The user information acquisition method comprises the following steps: generating an access token, wherein the access token is adapted to directly authenticate a logged-in user; generating an access request according to the access token, and sending the access request to a micro-service application interface corresponding to a back end through a front end; and performing user-defined annotation on each back-end micro-service application interface so that the current micro-service application interface obtains the user information of the current login user according to the access token, and assigning the user information to annotation parameters for other micro-service application interfaces to use. The present disclosure also provides a user information acquisition apparatus, an electronic device, a computer-readable storage medium, and a computer program product for microservice.)

1. A user information acquisition method for micro services comprises the following steps:

generating an access token, wherein the access token is adapted to directly authenticate a logged-in user;

generating an access request according to the access token, and sending the access request to a micro-service application interface corresponding to a back end through a front end;

and performing user-defined annotation on each back-end micro-service application interface so that the current micro-service application interface obtains the user information of the current login user according to the access token, and assigning the user information to annotation parameters for other micro-service application interfaces to use.

2. The method for acquiring user information of a microservice according to claim 1, wherein the self-defined annotation of the backend microservice application interfaces comprises:

generating a public jar packet at the back end;

and introducing the public jar packet into each micro-service application at the back end so as to perform self-defined annotation on each micro-service application interface.

3. The user information acquisition method for a microservice according to claim 1, wherein the generating an access token comprises:

inputting login information of a user through the front end and sending the login information to the rear end;

and the back end verifies the login information, and after the verification is successful, the Token information is returned to the front end to be used as the access Token of the user.

4. The user information acquisition method for microservice according to claim 3, wherein the Token information corresponds to the user information of the login user one to one;

the user information acquisition method further comprises the following steps:

and storing the Token information and the user information of the login user in a cache in a key value pair mode.

5. The user information acquisition method for a microservice according to claim 4, wherein the Token information is stored in the cache in a key form and the user information is stored in a value form.

6. The user information acquisition method for the microservice of claim 1, wherein the current microservice application interface acquires the user information of the current login user at a service access layer according to the access token.

7. A user information acquisition apparatus for a microservice, comprising:

the system comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for generating an access token, and the access token is suitable for directly authenticating a login user;

the second generation module is used for generating an access request according to the access token and sending the access request to a micro-service application interface corresponding to a back end through a front end;

and the annotation module is used for performing custom annotation on each micro-service application interface at the rear end so that the current micro-service application interface obtains the user information of the current login user according to the access token and assigns the user information to annotation parameters for other micro-service application interfaces to use.

8. The user information acquisition apparatus for a microservice according to claim 7, wherein the second generation module comprises:

a generating unit configured to generate a common iar packet at the backend;

and the introducing unit is used for introducing the public jar packet into each micro-service application at the rear end so as to perform self-defined annotation on each micro-service application interface.

9. The user information acquisition apparatus for a microservice according to claim 7, wherein the first generation module comprises:

the input unit is used for inputting the login information of the user through the front end and sending the login information to the rear end;

and the response unit is used for returning Token information to the front end as an access Token of the user after the login information is successfully verified by the back end.

10. The user information acquisition apparatus for microservice according to claim 9, wherein the Token information corresponds to the user information of the user one to one;

the user information acquisition apparatus further includes:

and the cache module is used for storing the Token information and the user information of the user in a cache in a key value pair mode.

11. The user information acquisition apparatus for a microservice according to claim 10, wherein the cache module stores the Token information in a key and the user information of the user in a value in the cache.

12. The apparatus of claim 7, wherein the current microservice application interface obtains the user information of the current login user at the service access layer according to the access token.

13. An electronic device, comprising:

one or more processors;

a memory for storing one or more programs,

wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-6.

14. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 6.

15. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.

Technical Field

The disclosure relates to the technical field of micro services, which can be applied to the field of financial technology or other fields, in particular to a method, a device, equipment and a medium for acquiring user information of micro services.

Background

At present, for the situation that the user quantity and the concurrency quantity are increasing day by day, each service platform usually adopts a micro-service design mode at the back end to split a functional module into different applications, so as to realize horizontal capacity expansion and meet the application requirements of large user quantity and concurrency quantity. However, the way to obtain the information of the currently logged-in user among different applications and to perform information transfer among the applications is generally as follows: the method has the defects of low efficiency, high intrusion code and high repeatability in the process of inquiring and assigning user information in a backend interface and then transferring the user information to the next application.

BRIEF SUMMARY OF THE PRESENT DISCLOSURE

In view of the above, an aspect of the present disclosure provides a method for acquiring user information for a microservice, including: generating an access token, wherein the access token is adapted to directly authenticate a logged-in user; generating an access request according to the access token, and sending the access request to a micro-service application interface corresponding to a back end through a front end; and performing user-defined annotation on each back-end micro-service application interface so that the current micro-service application interface obtains the user information of the current login user according to the access token, and assigning the user information to annotation parameters for other micro-service application interfaces to use.

According to the embodiment of the present disclosure, the performing custom annotation on each backend microservice application interface includes: generating a public jar packet at the back end; and introducing the public jar packet into each micro-service application at the back end so as to perform self-defined annotation on each micro-service application interface.

According to an embodiment of the present disclosure, wherein the generating an access token comprises: inputting login information of a user through the front end and sending the login information to the rear end; and the back end verifies the login information, and after the verification is successful, the Token information is returned to the front end to be used as the access Token of the user.

According to the embodiment of the present disclosure, the Token information corresponds to the user information of the user one to one; the user information acquisition method further comprises the following steps: and storing the Token information and the user information of the user in a cache in a key-value pair mode.

According to the embodiment of the present disclosure, the Token information is stored in the cache in the form of key, and the user information of the user is stored in the cache in the form of value.

According to the embodiment of the disclosure, the current microservice application interface acquires the user information of the current login user according to the access token in the service access layer.

Another aspect of the present disclosure provides a user information acquiring apparatus for a microservice, including: the system comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for generating an access token, and the access token is suitable for directly authenticating a login user; the second generation module is used for generating an access request according to the access token and sending the access request to a micro-service application interface corresponding to a back end through a front end; and the annotation module is used for performing custom annotation on each micro-service application interface at the rear end so that the current micro-service application interface obtains the user information of the current login user according to the access token and assigns the user information to annotation parameters for other micro-service application interfaces to use.

According to an embodiment of the present disclosure, wherein the second generating module includes: a generating unit, configured to generate a public jar packet at the back end; and the introducing unit is used for introducing the public jar packet into each micro-service application at the rear end so as to perform self-defined annotation on each micro-service application interface.

According to an embodiment of the present disclosure, the first generating module includes: the input unit is used for inputting the login information of the user through the front end and sending the login information to the rear end; and the response unit is used for returning Token information to the front end as an access Token of the user after the login information is successfully verified by the back end.

According to the embodiment of the present disclosure, the Token information corresponds to the user information of the user one to one; the user information acquisition apparatus further includes: and the cache module is used for storing the Token information and the user information of the user in a cache in a key value pair mode.

According to the embodiment of the present disclosure, the caching module stores the Token information in a key and the user information of the user in a value in the cache.

According to the embodiment of the disclosure, the current microservice application interface acquires the user information of the current login user according to the access token in the service access layer.

Another aspect of the present disclosure provides an electronic device including: one or more processors; memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method as described above.

Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.

Another aspect of the disclosure provides a computer program comprising computer executable instructions for implementing the method as described above when executed.

Drawings

FIG. 1 schematically illustrates a system architecture 100 for a method and system for user information acquisition for microservices in accordance with an embodiment of the present disclosure;

FIG. 2 schematically illustrates a flow chart of a user information acquisition method for a microservice according to an embodiment of the present disclosure;

fig. 3 schematically shows a flow chart of a method of access token generation according to an embodiment of the present disclosure;

FIG. 4 schematically illustrates a data interaction diagram for access token generation according to an embodiment of the disclosure;

FIG. 5 schematically illustrates a data interaction diagram accessed according to an access token according to an embodiment of the disclosure;

FIG. 6 is a diagram that schematically illustrates a method for custom annotation of backend microservice application interfaces, in accordance with an embodiment of the present disclosure;

FIG. 7 schematically illustrates a block diagram of a user information acquisition apparatus for a microservice according to an embodiment of the present disclosure;

FIG. 8 schematically shows a block diagram of a first generation module according to an embodiment of the present disclosure;

FIG. 9 schematically shows a block diagram of a second generation module according to an embodiment of the present disclosure;

FIG. 10 schematically shows a block diagram of a user information acquisition apparatus for a microservice according to yet another embodiment of the present disclosure;

fig. 11 schematically shows a block diagram of an electronic device adapted to implement the above described method according to an embodiment of the present disclosure.

Detailed Description

Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.

All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.

Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).

Some block diagrams and/or flow diagrams are shown in the figures. It will be understood that some blocks of the block diagrams and/or flowchart illustrations, or combinations thereof, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the instructions, which execute via the processor, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks. The techniques of this disclosure may be implemented in hardware and/or software (including firmware, microcode, etc.). In addition, the techniques of this disclosure may take the form of a computer program product on a computer-readable storage medium having instructions stored thereon for use by or in connection with an instruction execution system.

In the technical scheme of the disclosure, the related user information acquisition, storage, application and the like all accord with the regulations of related laws and regulations, necessary security measures are taken, and the customs of the public order is not violated.

The embodiment of the disclosure provides a method for acquiring user information of a micro service, which includes: an access token is generated, wherein the access token is adapted to directly authenticate the logged-in user. And generating an access request according to the access token, and sending the access request to a micro-service application interface corresponding to the back end through the front end. And performing user-defined annotation on each back-end micro-service application interface so that the current micro-service application interface obtains the user information of the current login user according to the access token, and assigning the user information to annotation parameters for other micro-service application interfaces to use.

Fig. 1 schematically illustrates a system architecture 100 for a user information acquisition method and system for microservices according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.

As shown in fig. 1, the system architecture 100 according to this embodiment may include clients 101, 102, a network 103 and a server 104. Network 103 is used to provide communication links between clients 101, 102 and server 104.

The clients 101, 102 may be, for example, various electronic devices having display screens and accessible to input devices for information input, including but not limited to smartphones, tablets, desktop PCs, laptop PCs, netbook computers, workstations, servers, game consoles, etc., which may be used to log in a corresponding account to initiate access to information and perform business operations, including but not limited to text, audio, video, etc. Network 103 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few. The wired mode may be, for example, a connection using a cable and any one of the following interfaces: the wireless communication system comprises a fiber channel, an Infrared interface, a D-Type data interface, a serial interface, a USB Type-C interface or a Dock interface, and the wireless communication mode can be connected by adopting a wireless communication mode, wherein the wireless communication mode can adopt any one of a plurality of wireless technology standards such as Bluetooth, Wi-Fi, infra, ZigBee and the like. The server 104 may be a server capable of receiving a client login account through the network 103 to perform information access and service operation, or may be a server that analyzes log data generated in the information access and service operation process in real time to identify whether an attack behavior exists in the information access and service operation process. According to the embodiment of the disclosure, the server 104 adopts a design mode of a microservice, and is used for sending an access request to the server 104 through the network 103 on an access page of the client 101, 102 in the process of realizing user information acquisition, wherein the access request comprises an access token. Since each micro-service application interface on the server 104 is self-defined annotated, after receiving the access request, the current login user information can be obtained according to the access token contained in the access request, and the user information is assigned to the annotation parameter for use by other micro-service application interfaces, so that all micro-service application structures can use the user information of the user to perform subsequent business logic operation.

It should be noted that the user information obtaining method for the microservice provided by the embodiment of the present disclosure may be executed by the server 104. Accordingly, the user information obtaining apparatus for the micro service provided by the embodiment of the present disclosure may be disposed in the server 104. Alternatively, the user information obtaining method for the micro service provided by the embodiment of the present disclosure may also be performed by a server or a server cluster that is different from the server 104 and is capable of communicating with the clients 101 and 102 and/or the server 104. Accordingly, the user information obtaining apparatus for micro service provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 104 and capable of communicating with the clients 101, 102 and/or the server 104. Alternatively, the user information obtaining method for the microservice provided by the embodiment of the present disclosure may also be partially executed by the server 104 and partially executed by the clients 101 and 102. Accordingly, the user information obtaining apparatus for the microservice provided by the embodiment of the present disclosure may also be partially disposed in the server 104, and partially disposed in the clients 101 and 102.

It should be understood that the number of clients, networks, and servers in FIG. 1 is merely illustrative. There may be any number of clients, networks, and servers, as desired for an implementation.

The user information acquisition method for the micro service provided by the embodiment of the disclosure can be applied to the field of financial science and technology. For example, in the banking industry or other financial institutions, with the rapid development of the internet and the internet of things, the amount of users and concurrency facing the banking industry is increasing, and each user needs to query user information stored in a database to perform identity authentication on the user every time the user logs in to perform business operations through a front end, which further increases the pressure of a server for processing related business of a bank. In order to reduce the pressure of the server and the number of times of inquiring the database, the back end of the bank adopts a micro-service design mode to split the functional module into different applications, but the modes of acquiring the information of the current login user among the different applications and transmitting the information among the applications are generally as follows: user information is queried and assigned in a backend interface and then transmitted to the next application, and the mode for acquiring the user information is low in efficiency, high in intrusion code and high in repeatability. By adopting the method for acquiring the user information for the micro service provided by the embodiment of the disclosure, the back-end micro service application interface is annotated, so that the current micro service application interface can acquire the user information of the current login user according to the access token, and the user information is assigned to the annotation parameter for other micro service application interfaces to use. That is, the current microservice application interface accesses the cache to obtain the user information of the user, and then the user information is shared by other microservice application interfaces through annotation parameters, so that the query database is greatly reduced, and the performance of the server is improved.

It should be understood that the user information obtaining method for the micro service provided by the embodiment of the present disclosure is not limited to be applied to the field of financial technology, and the above description is only exemplary, and the user information obtaining method for the micro service according to the embodiment of the present disclosure may be applied to other fields that need to obtain user information for the micro service, such as the field of sales of other non-financial products, the field of electronic commerce, the field of logistics, and the like.

Fig. 2 schematically shows a flowchart of a user information acquisition method for a microservice according to an embodiment of the present disclosure.

As shown in fig. 2, the user information acquisition method for a micro service may include operations S201 to S204, for example.

In operation S201, an access token is generated, wherein the access token is adapted to directly authenticate the login user.

According to an embodiment of the present disclosure, the access Token may be Token information. The Token information can be a string of character strings generated by the server to serve as a Token requested by the client, after the server logs in for the first time, the server generates the Token information and returns the Token information to the client, and the client only needs to take the Token information to request data later without taking a user name and a password again.

Fig. 3 schematically shows a flow chart of an access token generation method according to an embodiment of the present disclosure.

Fig. 4 schematically illustrates a data interaction diagram for access token generation according to an embodiment of the present disclosure.

As shown in fig. 3 and 4, the generation method may include operations S301 to S303, for example.

In operation S301, login information of a user is input through the front end and transmitted to the back end.

According to the embodiment of the disclosure, the login information of the user can comprise an account and a password, and the user submits the account and the password to the back-end micro-service application interface for verification after inputting the account and the password.

In operation S302, the backend verifies the login information.

According to the embodiment of the disclosure, the back-end micro-service application interface performs verification according to the input account and password, and stores the inquired user information in the system to be cached after the verification is successful. User information is saved to a cache to relieve pressure on frequent access to the database, where the cache system may include, for example, a redis cache system.

In operation S303, Token information is returned to the front end as the access Token of the user.

According to the embodiment of the disclosure, after the user successfully logs in for the first time, the backend generates the Token information and returns the Token information to the front-end page to serve as an access Token for requesting access of the user later, and then requests that the backend interface needs to take the Token information.

According to the embodiment of the disclosure, the Token information corresponds to the user information one by one, and the Token information and the user information can be stored in a cache in a key value pair mode so as to be called by a subsequent application. Specifically, Token information may be stored in the cache in the form of a key and user information of the user in the form of a value.

In operation S202, an access request is generated according to the access token, and the access request is sent to the micro service application interface corresponding to the back end through the front end.

According to the embodiment of the disclosure, since Token information is used as the identity Token, the access request only needs to take the Token information to request data, and does not need to take the user name and the password again. That is to say, the Token information can play the role of user name and password, and the back-end microservice application interface can directly verify the user information of the login user according to the Token information.

In operation S203, each backend microservice application interface is annotated by self-definition, so that the current microservice application interface obtains user information of the current login user according to the access token, and assigns the user information to annotation parameters for use by other microservice application interfaces.

According to the embodiment of the disclosure, the annotation is a usage pattern in a back-end development framework, and the main logic of annotation implementation is: after the user-defined annotation is introduced into the back-end micro-service application interface, the user information of the current user is obtained according to the user identification (namely, the access token) of the login user in the service access layer, and the respective interface can use the user information to perform subsequent service logic operation.

FIG. 5 schematically illustrates a data interaction diagram accessed according to an access token according to an embodiment of the disclosure.

As shown in fig. 5, after the user logs in, the backend interface needs to attach Token information for requesting when the front-end page accesses the backend interface, the backend application queries whether the current user time is invalid or not according to the Token information in the service access layer, and if the time is invalid, an advisory message is sent to inform that the login of the logged-in user is invalid, the user needs to log in again. If the user information is not invalid, because the application interface of the back-end micro-service introduces the self-defined annotation, the annotation can directly acquire the user information of the current login user according to the Token information, and assigns the user information to the annotation parameter for the direct use of other micro-service application interfaces.

FIG. 6 is a diagram that schematically illustrates a method for custom annotation of backend microservice application interfaces, in accordance with an embodiment of the present disclosure.

As shown in fig. 6, the method may include, for example, operations S601 to S602.

In operation S601, a common jar packet is generated in the backend.

In operation S602, the public jar packet is introduced into each micro service application at the back end to perform a custom annotation on each micro service application interface.

According to the embodiment of the disclosure, different jar packages can be generated by different micro service applications, so that different custom annotation field information can be registered.

According to the user information acquisition method for the micro service provided by the embodiment of the disclosure, the user information of the login user can be conveniently and quickly acquired directly according to the access token contained in the access request of the login user by performing the self-defined annotation on the micro service application interface at the rear end. And the user information is assigned to the annotation parameter for being directly used by other micro-service application interfaces, and the other micro-service application interfaces do not need to repeatedly query the cache system to acquire the user information of the login user, so that all the micro-service application interfaces can perform subsequent business logic operation by using the user information without repeatedly acquiring the user information by each micro-service application, thereby reducing the times of accessing a database or cache, reducing repeated query of information and improving the performance of a back-end server. In addition, the code is simplified by acquiring the user information in an annotation mode, so that the code is modularized and is convenient for developers to use.

Fig. 7 schematically shows a block diagram of a user information acquisition apparatus for a microservice according to an embodiment of the present disclosure.

As shown in fig. 7, the user information acquiring apparatus 700 for a microservice may include, for example, a first generating module 710, a second generating module 720, and an annotation module 730.

A first generating module 710 for generating an access token, wherein the access token is adapted to authenticate the logged-in user directly.

And a second generating module 720, configured to generate an access request according to the access token, and send the access request to a micro-service application interface corresponding to the back-end through the front-end.

The annotation module 730 is configured to perform custom annotation on each backend microservice application interface, so that the current microservice application interface obtains user information of a current login user according to the access token, and assigns the obtained user information to annotation parameters for direct use by other microservice application interfaces.

Fig. 8 schematically shows a block diagram of a first generation module according to an embodiment of the present disclosure.

As shown in fig. 8, the first generation module 710 may include an input unit 711 and a response unit 712, for example.

An input unit 711, configured to input login information of a user through a front end and send the login information to a back end.

And the response unit 712 is configured to, after the login information is successfully verified by the backend, return Token information to the frontend as the access Token of the user.

Fig. 9 schematically shows a block diagram of a second generation module according to an embodiment of the present disclosure.

As shown in fig. 9, the second generating module 720 may include a generating unit 721 and an introducing unit 722, for example.

A generating unit 721, configured to generate the public jar packet at the back end.

And the introducing unit 722 is configured to introduce the public jar packet into each micro-service application at the back end, so as to perform a custom annotation on each micro-service application interface.

Fig. 10 schematically shows a block diagram of a user information acquisition apparatus for a microservice according to still another embodiment of the present disclosure.

As shown in fig. 10, the user information acquiring apparatus 700 of the microservice may include, for example, a first generating module 710, a second generating module 720, an annotation module 730, and a cache module 740.

A first generating module 710 for generating an access token, wherein the access token is adapted to authenticate the logged-in user directly.

And a second generating module 720, configured to generate an access request according to the access token, and send the access request to a micro-service application interface corresponding to the back-end through the front-end.

The annotation module 730 is configured to perform custom annotation on each backend microservice application interface, so that the current microservice application interface obtains user information of a current login user according to the access token, and assigns the obtained user information to annotation parameters for direct use by other microservice application interfaces.

The cache module 740 is configured to store Token information and user information of the user in a cache by a key-value pair. Specifically, the cache module stores Token information in a form of key and user information of a user in a form of value in the cache. The Token information corresponds to the user information of the user one by one.

Based on the user information acquisition device for the micro service provided by the embodiment of the disclosure, the user information of the login user can be conveniently, quickly and directly acquired according to the access token contained in the access request of the login user by performing the self-defined annotation on the micro service application interface at the rear end. And the user information is assigned to the annotation parameter for being directly used by other micro-service application interfaces, and the other micro-service application interfaces do not need to repeatedly query the cache system to acquire the user information of the login user, so that all the micro-service application interfaces can perform subsequent business logic operation by using the user information without repeatedly acquiring the user information by each micro-service application, thereby reducing the times of accessing a database or cache, reducing repeated query of information and improving the performance of a back-end server. In addition, the code is simplified by acquiring the user information in an annotation mode, so that the code is modularized and is convenient for developers to use.

Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.

For example, any plurality of the first generation module 710, the second generation module 720, the annotation module 730, and the cache module 740 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the first generation module 710, the second generation module 720, the annotation module 730, and the cache module 740 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of three implementations of software, hardware, and firmware, or in any suitable combination of any of them. Alternatively, at least one of the first generation module 710, the second generation module 720, the annotation module 730 and the caching module 740 may be at least partially implemented as a computer program module, which when executed may perform a corresponding function.

It should be noted that, the user information obtaining device part for the micro service in the embodiment of the present disclosure corresponds to the user information obtaining method part for the micro service in the embodiment of the present disclosure, and specific implementation details thereof are also the same, and are not described herein again.

Fig. 11 schematically shows a block diagram of an electronic device adapted to implement the above described method according to an embodiment of the present disclosure. The electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.

As shown in fig. 11, an electronic device 1100 according to an embodiment of the present disclosure includes a processor 1101, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. The processor 1101 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1101 may also include on-board memory for caching purposes. The processor 1101 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to the embodiments of the present disclosure.

In the RAM1103, various programs and data necessary for the operation of the electronic device 1100 are stored. The processor 1101, the ROM1102, and the RAM1103 are connected to each other by a bus 1104. The processor 1101 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM1102 and/or the RAM 1103. It is noted that the programs may also be stored in one or more memories other than the ROM1102 and RAM 1103. The processor 1101 may also perform various operations of the method flows according to the embodiments of the present disclosure by executing programs stored in the one or more memories.

Electronic device 1100 may also include input/output (I/O) interface 1105, input/output (I/O) interface 1105 also connected to bus 1104, according to an embodiment of the disclosure. Electronic device 1100 may also include one or more of the following components connected to I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output portion 1107 including a signal output unit such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.

According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. The computer program, when executed by the processor 1101, performs the above-described functions defined in the system of the embodiment of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.

The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.

According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM1102 and/or the RAM1103 and/or one or more memories other than the ROM1102 and the RAM1103 described above.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:客户端的开发方法和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!