Microservice permission management method, device, electronic device and readable storage medium
By receiving and parsing API call requests and using the control microservice container to analyze user permissions, the problems of complexity and dispersed risk in microservice permission control are solved, simple and fast permission management is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411148373.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-08-20
Smart Images

Figure CN119004424B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to, but are not limited to, the field of financial technology, and in particular to a microservice permission management method, device, electronic device, and computer-readable storage medium. Background Art
[0002] With the continuous development of society and economy, and the continuous advancement of science and technology, people's living standards are constantly improving. In the financial industry, a variety of application services are applied to all aspects of the industry. In actual application processes, an application system can be split into multiple microservices, each of which provides some application programming interfaces (APIs) to constitute the main functions of the application system. Before the application system is split, a single configuration can be used for permission control and management of all application functions. However, after the split into multiple microservices, a set of permission configurations is required for each microservice to implement permission control. This will lead to extremely complex permission control and the risk of decentralized authorization management, which will bring a poor user experience. Summary of the Invention
[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0004] In order to solve the problems mentioned in the above background technology, the embodiments of the present application provide a microservice permission management method, device, electronic device and computer-readable storage medium, which can manage the permissions of microservices more simply, quickly and securely, thereby bringing users a better user experience.
[0005] In a first aspect, an embodiment of the present application provides a microservice permission management method, including:
[0006] Receiving application programming interface API call request information;
[0007] Parsing the API call request information to obtain user information and API information;
[0008] Analyze and process the user information and the API information based on a preset control microservice container to obtain user access permission information;
[0009] receiving an API call request from the user when the user access permission information indicates that the user corresponding to the user information has permission to access the API information;
[0010] Select corresponding API routing information from the preset application microservice container according to the API call request;
[0011] The corresponding microservice is called and processed according to the API routing information.
[0012] According to some embodiments of the present application, the parsing of the API call request information to obtain user information and API information includes:
[0013] Extracting attribution information from the API call request information to obtain the user information;
[0014] The API call request information is subjected to call information extraction to obtain the API information.
[0015] According to some embodiments of the present application, the preset control microservice container analyzes and processes the user information and the API information to obtain user access permission information, including:
[0016] Determining user group information according to the API hierarchical structure of the control microservice container and the user information, wherein the user group information carries permission configuration information of the API hierarchical structure;
[0017] The permission configuration information is matched with the API information to obtain the user access permission information.
[0018] According to some embodiments of the present application, the API hierarchical structure of the control microservice container is obtained by:
[0019] Determine the annotation information and original routing information of the API interface of each microservice from the application microservice container;
[0020] Generate the API hierarchical structure according to the annotation information and the corresponding original routing information;
[0021] The API hierarchy is transferred from the application microservice container to the control microservice container.
[0022] According to some embodiments of the present application, the application microservice container includes multiple microservices, each of the microservices corresponds to multiple API routing information, and selecting the corresponding API routing information from the preset application microservice container according to the API call request includes:
[0023] Selecting the corresponding microservice from the application microservice container according to the API call request;
[0024] The corresponding API routing information is determined based on the selected microservice.
[0025] According to some embodiments of the present application, after the preset control microservice container analyzes and processes the user information and the API information to obtain user access permission information, the method further includes:
[0026] In a case where the user access authority information indicates that the user corresponding to the user information does not have the authority to access the API information, API call failure information is fed back to the user.
[0027] According to some embodiments of the present application, the method further includes:
[0028] Sending API permission query information to the control microservice container based on the decorator function of the application microservice container;
[0029] In response to the API authority query information, the control microservice container feeds back an API authority query result.
[0030] In a second aspect, an embodiment of the present application further provides a microservice permission management device, the device comprising:
[0031] The first processing module is used to receive application programming interface API call request information;
[0032] A second processing module is used to parse the API call request information to obtain user information and API information;
[0033] A third processing module is configured to analyze and process the user information and the API information based on a preset control microservice container to obtain user access permission information;
[0034] A fourth processing module is configured to receive an API call request from the user if the user access permission information indicates that the user corresponding to the user information has permission to access the API information;
[0035] A fifth processing module is configured to select corresponding API routing information from a preset application microservice container according to the API call request;
[0036] The sixth processing module is used to call the corresponding microservice according to the API routing information.
[0037] In a third aspect, an embodiment of the present application further provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the microservice permission management method as described in the first aspect above is implemented.
[0038] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the microservice permission management method described in the first aspect above.
[0039] The microservice permission management method according to the embodiments provided herein has at least the following beneficial effects: during the microservice permission management process, first, application programming interface (API) call request information is received; then, the API call request information is parsed to obtain user information and API information; then, based on a preset control microservice container, the user information and API information are analyzed and processed to obtain user access rights information; when the user access rights information indicates that the user corresponding to the user information has permission to access the API information, the user's API call request is received; corresponding API routing information is selected from a preset application microservice container based on the API call request; and then, the corresponding microservice is called based on the API routing information. During the microservice permission management process, the user's access rights need to be determined, and only when the user access rights information indicates that the user has permission to access the API information will the user's API call request be received. Subsequently, the corresponding API routing information is selected from the application microservice based on the API call request. Through the above-described method, microservice permissions can be managed more simply, quickly, and securely, thereby providing users with a better user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings are used to provide a further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0041] Figure 1 This is a flowchart of a microservice permission management method provided by an embodiment of the present application;
[0042] Figure 2 This is a specific flow chart of step S200 provided in one embodiment of the present application;
[0043] Figure 3 This is a specific flow chart of step S300 provided in one embodiment of the present application;
[0044] Figure 4 This is a specific flow chart of generating an API hierarchical structure provided by an embodiment of the present application;
[0045] Figure 5 This is a specific flow chart of step S500 provided in one embodiment of the present application;
[0046] Figure 6 This is a flowchart of a microservice permission management method provided by another embodiment of the present application;
[0047] Figure 7 This is a flowchart of a microservice permission management method provided by another embodiment of the present application;
[0048] Figure 8 This is a specific flow chart of the microservice permission management method provided by an embodiment of this application
[0049] Figure 9 This is a schematic diagram of a microservice permission management device provided by an embodiment of the present application;
[0050] Figure 10 This is a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0052] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, used in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0053] It should be noted that, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0054] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0055] AI is a new technical discipline that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence. Artificial intelligence is a branch of computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. Artificial intelligence can simulate the information processes of human consciousness and thinking. It also refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0056] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0057] Artificial intelligence, or AI, is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0058] The servers involved in artificial intelligence technology can be independent servers or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0059] The present application provides a microservice permission management method, device, electronic device, and computer-readable storage medium. During the microservice permission management process, the method first receives an application programming interface (API) call request; then, the API call request information is parsed to obtain user information and API information; then, based on a preset control microservice container, the user information and API information are analyzed and processed to obtain user access rights information; when the user access rights information indicates that the user corresponding to the user information has access rights to the API information, the user's API call request is received; corresponding API routing information is selected from a preset application microservice container based on the API call request; and then, the corresponding microservice is called based on the API routing information. During the microservice permission management process, the user's access rights need to be determined, and only when the user access rights information indicates that the user has access rights to the API information will the user's API call request be received. Subsequently, the corresponding API routing information is selected from the application microservice based on the API call request. Through the above method, microservice permissions can be managed more simply, quickly, and securely, thereby providing users with a better user experience.
[0060] The microservice permission control method provided in the embodiment of the present application relates to the field of financial technology. The microservice permission control method provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the microservice permission control method, etc., but is not limited to the above forms.
[0061] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0062] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the user's identity or characteristics, such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0063] The embodiments of the present application are further described below with reference to the accompanying drawings.
[0064] like Figure 1 As shown, Figure 1 This is a flowchart of a microservice permission management method provided by an embodiment of the present application, which includes but is not limited to steps S100 to S600.
[0065] Step S100, receiving application programming interface API call request information;
[0066] Step S200: Parsing the API call request information to obtain user information and API information;
[0067] Step S300: Analyze and process user information and API information based on a preset control microservice container to obtain user access permission information;
[0068] Step S400: receiving an API call request from a user when the user access permission information indicates that the user corresponding to the user information has permission to access the API information;
[0069] Step S500: Select corresponding API routing information from a preset application microservice container according to the API call request;
[0070] Step S600: Call the corresponding microservice according to the API routing information.
[0071] It should be noted that during the microservice permission management process, application programming interface (API) call request information is first received; the API call request information is then parsed to obtain user information and API information; the user information and API information are then analyzed and processed based on a preset control microservice container to obtain user access rights information; if the user access rights information indicates that the user corresponding to the user information has permission to access the API information, the user's API call request is received; corresponding API routing information is selected from the preset application microservice container based on the API call request; and the corresponding microservice is subsequently called based on the API routing information. During the microservice permission management process, user access rights must be determined, and only if the user access rights information indicates that the user has permission to access the API information will the user's API call request be received. Subsequently, corresponding API routing information is selected from the application microservice based on the API call request. Through the above-described method, microservice permissions can be managed more simply, quickly, and securely, thereby providing users with a better user experience.
[0072] It's worth noting that in the financial industry, an application system, such as an intelligent answering system, is used to answer financial questions raised by users. To ensure that the intelligent answering system can accurately and quickly respond to user inquiries, it can be built using multiple microservices. A microservice can be understood as a group of small, independent services, each implementing a specific business function and capable of independent development, deployment, operation, and scalability. The microservices architecture has the following characteristics: Independence: Each microservice is independent, with its own codebase and lifecycle. Lightweight communication: Microservices interact with each other through lightweight communication mechanisms. Technology diversity: Different microservices can use different programming languages and database technologies. Scalability: Individual services, rather than the entire application, can be independently scaled based on demand. Fault tolerance: A single service failure does not cause the entire system to crash, improving system stability. Agility: Microservices allow for rapid iteration and deployment, accelerating development. Decentralized governance: Each service can be independently developed and maintained by a different team. Automated deployment: Microservices are often combined with continuous integration and continuous deployment processes for automated deployment. An Application Programming Interface (API) is a protocol that allows software applications to interact with each other. It defines how software components communicate with each other, usually through Hypertext Transfer Protocol requests and responses. APIs can be used for various purposes, such as accessing online services, databases, or hardware devices.
[0073] It's worth noting that after receiving an API call request, the API call request can be subsequently parsed to obtain user information and API information. The user information represents the attributes of the user sending the API call request, while the API information contains the API information for each microservice the user needs to call. For example, when a user needs to inquire about the current annual deposit interest rate, they can contact the intelligent answering robot. During the inquiry, the generation of API call request information can be triggered, preparing the microservice call within the intelligent answering robot.
[0074] It is worth noting that the control microservice container can analyze and process user information and API information to obtain corresponding user access permission information; based on the user access permission information, it can receive the user's API call request, and subsequently select the corresponding API routing information from the pre-set application microservice container according to the user's API call request, and then call the corresponding microservice according to the selected API routing information to realize the scheduling of microservices; first, through the permission detection, the user will be allowed to call the corresponding microservice only when the user has microservice scheduling, making the management and control of microservices more secure and reliable.
[0075] It is understandable that the microservice container includes multiple different API routing information. It only needs to determine the corresponding API routing information from the microservice container based on the API call request. Subsequently, the corresponding microservice can be called and processed based on the determined API routing information to meet business needs.
[0076] In some embodiments, as Figure 2 As shown, the above step S200 may include but is not limited to steps S210 to S220.
[0077] Step S210: extracting attribution information from the API call request information to obtain user information;
[0078] Step S220: extracting call information from the API call request information to obtain API information.
[0079] It should be noted that in the process of parsing the API call request information to obtain user information and API information, the user information can be obtained by first extracting the attribution information of the API call request information; and the API information can be obtained by extracting the API call request information; subsequently, the user information and API information can be analyzed and processed to obtain the user access permission information. Based on the user access permission information, the permissions of various microservices can be managed and processed, thereby ensuring the reliability and security of microservice permission management.
[0080] For example, when a user asks a financial question to an intelligent answering robot, an API call request message is generated, and then the generated API call request message is parsed and processed to obtain user information and API information respectively.
[0081] In some embodiments, as Figure 3 As shown, the above step S300 may include but is not limited to steps S310 to S320.
[0082] Step S310: Determine user group information based on the API hierarchical structure and user information of the control microservice container, wherein the user group information carries permission configuration information of the API hierarchical structure;
[0083] Step S320: Match the permission configuration information with the API information to obtain user access permission information.
[0084] It should be noted that in the process of obtaining user access permission information by analyzing and processing user information and API information based on a preset control microservice container, user group information is first determined based on the API hierarchical structure of the control microservice container and the user information, wherein the user analysis information carries the permission configuration information of the API hierarchical structure; then, the permission configuration information and the API information are matched and processed to obtain the user access permission information; through the above technical solution, user access permission information can be quickly and accurately obtained based on the analysis of user information and API information.
[0085] It is worth noting that by matching the parsed user information with the API hierarchical structure of the control microservice container, user group information can be determined, and the user group information carries the permission configuration information of the API hierarchical structure; then, the permission configuration information can be matched with the parsed API information to obtain user access permission information; among which, the user access permission information can indicate whether the user has access permission to the API information or not.
[0086] In some embodiments, as Figure 4 As shown, the API hierarchical structure of the control microservice container can be obtained through but not limited to steps S311 to S313.
[0087] Step S311: Determine the annotation information and original routing information of the API interface of each microservice from the application microservice container;
[0088] Step S312: Generate an API hierarchical structure based on the annotation information and the corresponding original routing information;
[0089] Step S313: Transfer the API hierarchical structure from the application microservice container to the control microservice container.
[0090] It should be noted that in the process of generating the API hierarchical structure of the control microservice, the annotation information and original routing information of the API interface of each microservice are first determined from the application microservice container; then, the API hierarchical structure can be generated based on the annotation information and the corresponding original routing information; finally, the API hierarchical structure is transferred from the application microservice container to the control microservice container, thereby making preparations for the subsequent confirmation of user access permission information.
[0091] It is worth noting that the application microservice container can include multiple microservices, and each microservice will carry the annotation information and original routing information of the API interface. The API hierarchical structure can be generated based on the annotation information and the corresponding original routing information. The obtained API hierarchical structure is subsequently transferred from the application microservice container to the control microservice container to prepare for the subsequent determination of user access permission information.
[0092] Exemplarily, the insurance policy inquiry system is composed of multiple microservices, and each microservice carries annotation information and original routing information of the API interface; an API hierarchical structure can be generated based on the annotation information and the corresponding original routing information, and then the obtained API hierarchical structure is transmitted from one side of the insurance policy inquiry system to the side of the control microservice container, and the control microservice container can be set in the cloud server.
[0093] In some embodiments, as Figure 5 As shown, the application microservice container includes multiple microservices, each microservice corresponds to multiple API routing information, and the above step S500 may include but is not limited to steps S510 to S520.
[0094] Step S510: Select the corresponding microservice from the application microservice container according to the API call request;
[0095] Step S520: Obtain corresponding API routing information based on the selected microservice.
[0096] It should be noted that in the process of selecting the corresponding API routing information from the preset application microservice container based on the API call request, the corresponding microservice is first selected from the application microservice container based on the API call request. Then, the corresponding API routing information is determined based on the selected microservice to prepare for the subsequent microservice call. The above technical solution makes microservice calls more simple, fast, and reliable.
[0097] It is worth noting that the application microservice container includes multiple microservices. According to the API call request, the corresponding microservice can be selected from the application microservice container. According to the selected microservice, the corresponding API routing information can be determined to prepare for the subsequent microservice calls.
[0098] In some embodiments, as Figure 6 As shown, after executing step S300, the microservice permission management method may also include but is not limited to step S330.
[0099] Step S330: When the user access authority information indicates that the user corresponding to the user information does not have the authority to access the API information, an API call failure message is fed back to the user.
[0100] It should be noted that after the preset control microservice container analyzes and processes the user information and API information to obtain the user access permission information, if the user access permission information indicates that the user corresponding to the user information does not have the permission to access the API information, the API call failure information will be fed back to the user to inform the user of the service operation status, so that the user can understand the service operation status more intuitively.
[0101] For example, the enterprise insured personnel query system is composed of multiple microservices. When an ordinary employee wants to query relevant information based on the enterprise insured personnel query system, he can generate corresponding API call request information, and parse and process the API call request information to obtain user information and API information. Subsequently, the control microservice container set up in the cloud analyzes and processes the user information and API information to obtain user access permission information; when the user access permission information indicates that the user does not have access to the corresponding API information, the API call failure information can be fed back to the user through the relevant business interface, informing the user that he does not have the permission to query the enterprise insured personnel.
[0102] In some embodiments, as Figure 7 As shown, the microservice permission management method may also include but is not limited to step S710 and step S720.
[0103] Step 710: Sending API permission query information to the control microservice container based on the decorator function of the application microservice container;
[0104] Step 720: In response to the API permission query information, the control microservice container feeds back the API permission query result.
[0105] It should be noted that, in the process of querying API permissions, API permission query information can be sent to the control microservice container based on the decorator function of the application microservice container; then the control microservice container can respond to the API permission query information and feed back the API permission query result from the control microservice container; through the above technical solution, the API permission query process can be made more stable and reliable.
[0106] It is worth noting that decorator functions are used to add additional functionality to functions or methods without modifying the original code. A decorator function is a high-order function written using a special syntax. It accepts a function as a parameter and returns a new function, usually adding some additional operations to the original function.
[0107] In order to more clearly illustrate the microservice permission management method of the embodiment of the present application, a specific embodiment is used below to illustrate.
[0108] like Figure 8 As shown, the main idea of the centralized API permission control solution is to standardize the application API interfaces of microservices. On the application microservice side, annotation information and routing information are standardized and categorized into hierarchical levels, such as first-level functions, second-level functions, and third-level functions, and so on. The annotation information and routing information form the overall hierarchical structure of the application API interfaces. Simultaneously, a centralized API permission control control microservice is built to perform permission control on each application microservice. The control microservice receives the application API hierarchical structure of the application microservice through the API interface. When the application microservice is started, the API hierarchy structure of the application microservice is sent to the control microservice through the interface with the control microservice. On the application microservice side, a decorator function is written to query the control microservice for permissions. This decorator function is loaded on each API interface of the microservice, enabling centralized API permission control on each application microservice. When a new application microservice is introduced, simply develop the API interface and decorator function according to the unified standard and it can be easily integrated into the control microservice to implement centralized API permission control.
[0109] The control microservice maintains the API hierarchy of all application microservices through its interface with the application microservices. It also retains all user information based on the single sign-on information used by users logging into the application microservices. The control microservice groups users into different roles and configures role-based access control based on the API hierarchy of each application microservice. This creates level-one permission control for all application APIs, while also providing detailed, granular control for each API interface within each microservice. When an application microservice receives an API call from a user, it sends the requesting user information and the called API interface information to the control microservice to check whether the requesting user has permission to access the routing information for the application API being accessed. The control microservice determines whether the user has the corresponding access rights to the application microservice API being accessed based on the user's permission configuration for the application microservice API hierarchy. The control microservice then sends the permission query result to the application microservice, which then rejects or accepts the user's request based on the query result received from the control microservice, thus establishing user permission control for the application microservice.
[0110] Through a centralized API permission management solution, the control microservice maintains the API interface hierarchy and logged-in user information for all application microservices. By displaying the API hierarchy of all application microservices on the front end and configuring permissions based on user groups, the control microservice enables easy, menu-based, and visual permission management of all application microservice component APIs after the application is split into microservices. This enables flexible integration of new microservice applications and corresponding permission management of these microservice applications. The control microservice also logs user API access for subsequent auditing, enabling user authorization, logging, and auditing of microservices.
[0111] In addition, if Figure 9 As shown, an embodiment of the present application further provides a microservice permission management device 10, comprising:
[0112] The first processing module 100 is used to receive application programming interface API call request information;
[0113] The second processing module 200 is used to parse the API call request information to obtain user information and API information;
[0114] The third processing module 300 is used to analyze and process user information and API information based on a preset control microservice container to obtain user access permission information;
[0115] The fourth processing module 400 is configured to receive an API call request from a user when the user access permission information indicates that the user corresponding to the user information has permission to access the API information;
[0116] A fifth processing module 500 is configured to select corresponding API routing information from a preset application microservice container according to the API call request;
[0117] The sixth processing module 600 is used to call the corresponding microservice according to the API routing information.
[0118] It should be noted that during the microservice permission management process, application programming interface (API) call request information is first received; the API call request information is then parsed to obtain user information and API information; the user information and API information are then analyzed and processed based on a preset control microservice container to obtain user access rights information; if the user access rights information indicates that the user corresponding to the user information has permission to access the API information, the user's API call request is received; corresponding API routing information is selected from the preset application microservice container based on the API call request; and the corresponding microservice is subsequently called based on the API routing information. During the microservice permission management process, user access rights must be determined, and only if the user access rights information indicates that the user has permission to access the API information will the user's API call request be received. Subsequently, corresponding API routing information is selected from the application microservice based on the API call request. Through the above-described method, microservice permissions can be managed more simply, quickly, and securely, thereby providing users with a better user experience.
[0119] The specific implementation of the microservice permission control device 10 is basically the same as the specific embodiment of the above-mentioned microservice permission control method, and will not be repeated here.
[0120] In addition, if Figure 10 As shown, an embodiment of the present application further provides an electronic device 700 , which includes: a memory 720 , a processor 710 , and a computer program stored in the memory 720 and executable on the processor 710 .
[0121] The processor 710 and the memory 720 may be connected via a bus or other means.
[0122] The non-transient software programs and instructions required to implement the microservice permission management method of the above embodiments are stored in the memory 720. When executed by the processor 710, the microservice permission management method of each of the above embodiments is executed.
[0123] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0124] In addition, an embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are executed by a processor 710 or a controller, for example, by a processor 710 in the above-mentioned device embodiment, so that the above-mentioned processor 710 can execute the microservice permission management method in the above-mentioned embodiment.
[0125] The above embodiments may be used in combination, and modules with the same name in different embodiments may be the same or different.
[0126] The foregoing description describes specific embodiments of the present application, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0127] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the device, equipment, and computer-readable storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant portions, refer to the descriptions of the method embodiments.
[0128] The apparatus, device, computer-readable storage medium and method provided in the embodiments of the present application correspond to each other. Therefore, the apparatus, device and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, device and computer storage medium will not be repeated here.
[0129] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures such as diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always program the improved process flow into the hardware circuit to obtain the corresponding hardware circuit structure. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is an integrated circuit whose logical function is determined by user programming of the device. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this type of programming is mostly implemented using "logic compiler" software. It is similar to the software compiler used when developing and writing programs. Before compiling, the original code must also be written in a specific programming language, which is called Hardware Description Language (HDL). There is not only one HDL, but many types, such as ABEL (Advanced Bootean Express Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell Universe Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used one is VHDL (Very-High-Speed Integrated Circuit Hardware Description Language). Those skilled in the art should also be aware that by simply programming the method flow in the aforementioned hardware description languages and programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0130] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91 SAM, Microchip PIC18F26K20, and Silicon Labs C8051 F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions may be considered to be both a software module for implementing the method and a structure within a hardware component.
[0131] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0132] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing the embodiments of the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0133] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0134] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0137] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0138] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash memory (Flash RAM). Memory is an example of a computer-readable medium.
[0139] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0140] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0141] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.
[0142] Embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. Embodiments of the present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0143] The various embodiments in this application are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment.
[0144] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.
Claims
1. A microservice permission management method, characterized in that: The method comprises: Receive application programming interface API call request information; Parsing the API call request information to obtain user information and API information; Analyze and process the user information and the API information based on a preset API hierarchical structure of the control microservice container to obtain user access permission information; When the user access permission information indicates that the user corresponding to the user information has permission to access the API information, receiving an API call request from the user; Select corresponding API routing information from a preset application microservice container according to the API call request; Call the corresponding microservice according to the API routing information; The API hierarchical structure of the control microservice container is obtained in the following manner: Determine annotation information and original routing information of the API interface of each microservice from the application microservice container; Generate the API hierarchical structure according to the annotation information and the corresponding original routing information; The API hierarchy structure is transferred from the application microservice container to the control microservice container.
2. The microservice permission management method according to claim 1 is characterized in that: The parsing of the API call request information to obtain user information and API information includes: Extracting attribution information from the API call request information to obtain the user information; Extracting call information from the API call request information to obtain the API information.
3. The microservice permission management method according to claim 1 is characterized in that: The user information and the API information are analyzed and processed based on the preset API hierarchical structure of the control microservice container to obtain user access permission information, including: Determining user group information according to the API hierarchical structure of the control microservice container and the user information, wherein the user group information carries permission configuration information of the API hierarchical structure; The permission configuration information is matched with the API information to obtain the user access permission information.
4. The microservice permission management method according to claim 1, characterized in that: The application microservice container includes multiple microservices, each of which corresponds to multiple API routing information. The corresponding API routing information is selected from the preset application microservice container according to the API call request, including: Selecting the corresponding microservice from the application microservice container according to the API call request; The corresponding API routing information is determined based on the selected microservice.
5. The microservice permission management method according to claim 1, characterized in that: After the preset control microservice container analyzes and processes the user information and the API information to obtain user access permission information, the method further includes: In a case where the user access authority information indicates that the user corresponding to the user information does not have the authority to access the API information, API call failure information is fed back to the user.
6. The microservice permission management method according to claim 1, characterized in that: The method further comprises: Sending API permission query information to the control microservice container based on the decorator function of the application microservice container; In response to the API permission query information, the control microservice container feeds back an API permission query result.
7. A microservice authority management and control device, characterized in that: include: The first processing module is used to receive application programming interface API call request information; A second processing module is used to parse the API call request information to obtain user information and API information; A third processing module is used to analyze and process the user information and the API information based on a preset API hierarchical structure of the control microservice container to obtain user access permission information; A fourth processing module is configured to receive an API call request from the user if the user access permission information indicates that the user corresponding to the user information has permission to access the API information; A fifth processing module is configured to select corresponding API routing information from a preset application microservice container according to the API call request; A sixth processing module is used to call and process the corresponding microservice according to the API routing information; The API hierarchical structure of the control microservice container is obtained in the following manner: Determine annotation information and original routing information of the API interface of each microservice from the application microservice container; Generate the API hierarchical structure according to the annotation information and the corresponding original routing information; The API hierarchy structure is transferred from the application microservice container to the control microservice container.
8. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the microservice permission management method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer-executable instructions are used to execute the microservice permission management method described in any one of claims 1 to 6.