Cross-resource pool API gateway application access authorization and management method and system
By storing the configuration in the global database when creating an application in the API gateway, supporting multiple authentication types, and managing API authentication by configuring the adaptation module and authorization management module, the problem that the API gateway cannot support multiple authentication methods is solved. Realizes APP configuration sharing and flexible authentication management across resource pools.
Patent Information
- Application Number
- CN202410892256.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-04
AI Technical Summary
The API gateway cannot support multiple authentication methods at the same time, and the existing technology requires configuring authentication information on each API, which is cumbersome to operate and cannot view the information bound to the authentication.
By storing the configuration in the global database when creating an application, it provides a common configuration template and supports multiple authentication types. The configuration adaptation module converts the configuration into plug-in configuration. The authorization authentication management module manages the authentication relationship of the API and supports cross-resource pool authorization. and deauthorization, providing a unified API calling SDK.
It realizes APP configuration sharing across resource pools, supports unified access of multiple authentication methods, flexibly controls API access, reduces consumer configuration dependencies between APIs, and provides more flexible application scenarios.
Smart Images

Figure CN118740464A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing-middleware-API gateway, and in particular to a method and system for cross-resource pool API gateway application access authorization and management. Background Art
[0002] The API gateway is the unified entry point for users to request APIs. The original service authentication capability for interface requests is upgraded to the API gateway as the API is managed in a unified manner. When the API gateway has the security protection capability for API requests, it is easier to manage the calling permissions in a unified manner.
[0003] The prior art "A method and device for unified authentication of API gateway" (CN202211365718.1) also uses consumer management and persists the authorization relationship in the back-end database, with a fast processing speed, but does not solve the problem that the API gateway cannot support multiple authentication methods at the same time and the current authentication method requires configuration of authentication information on each API, which is cumbersome to operate and cannot view the information bound to the authentication. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In view of the problems existing in the above-mentioned existing method and system for API gateway application access authorization and management across resource pools, the present invention is proposed.
[0006] Therefore, the purpose of the present invention is to provide a method and system for API gateway application access authorization and management across resource pools, which is suitable for solving the problem that the API gateway cannot support multiple authentication methods at the same time and the current authentication method requires configuration of authentication information on each API, which is cumbersome to operate and cannot view the information bound to the authentication.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for cross-resource pool API gateway application access authorization and management, the method comprising the following steps:
[0008] S1: When creating an application, the controller stores the application configuration in the national database and acts as a global configuration center;
[0009] S2: Authorization process;
[0010] S3: Deauthorization process;
[0011] S4: User calls API application scenario.
[0012] As a preferred solution of the method for cross-resource pool API gateway application access authorization and management described in the present invention, wherein: in step S1, it includes the following sub-steps:
[0013] Step 1: When creating an application, we provide a general configuration template for the supported authentication types to help users quickly create applications, including application name, application authentication type, and application configuration YAML data;
[0014] Step 2: After the application is created, the user authorizes and releases the API;
[0015] Step 3: After the application is created, the user can quickly modify or delete the configuration information. After the change, the configuration will be automatically synchronized to the corresponding API according to the authorized relationship table.
[0016] As a preferred solution of the method for cross-resource pool API gateway application access authorization and management described in the present invention, wherein: in step S2, it includes the following sub-steps:
[0017] Step 1: When performing authorization actions;
[0018] Step 2: When the authorization and authentication management module receives the authorization instruction and plugin_config.
[0019] As a preferred solution of the method for cross-resource pool API gateway application access authorization and management described in the present invention, wherein: in the step 1, it includes the following sub-steps:
[0020] ①: The configuration adapter module obtains complete configuration information from the database according to app_id;
[0021] ②: Convert app_config (yaml) to auth_plugin_config according to app_auth_type;
[0022] ③: Send the authorization instruction and plugin_config to the authorization and authentication management module, and inform it of the list of APIs to be authorized;
[0023] ④: Write the relationship record of the application authorization API into the database;
[0024] In the step 2, it includes the following sub-steps:
[0025] ①: Create a consumer resource based on app_id in the current instance. The consumer resource contains a consumer identifier with app_id as consumer_id, authentication information, and a quick authentication code;
[0026] ②: Update the resource configuration information of the API, that is, you need to update the plugins configuration in the API resources, which includes: (a) writing an auth-plugin name identifier corresponding to app_auth_type, indicating that the API needs to be authenticated through this authentication method; (b) the consumer-restriction plug-in, the whitelist and blacklist in the plug-in respectively represent the allowed and disallowed consumer lists. When authorizing, write consumer_id into the whitelist.
[0027] As a preferred solution of the method for cross-resource pool API gateway application access authorization and management described in the present invention, the deauthorization process includes the following sub-steps:
[0028] Step 1: When performing the deauthorization action;
[0029] Step 2: When the authorization and authentication management module receives the contact authorization instruction and api_id.
[0030] As a preferred solution of the method for cross-resource pool API gateway application access authorization and management described in the present invention, wherein: in the step 1, it includes the following sub-steps:
[0031] ①: Send the deauthorization instruction and plugin_config to the authorization and authentication management module, and inform it of the list of APIs to be authorized;
[0032] ②: Update the database and delete the relationship record of the application authorization API;
[0033] In the step 2: it is necessary to update the consumer-restriction plug-in in the API resource and remove the consumer_id from the whitelist in the plug-in.
[0034] As a preferred solution of the method for cross-resource pool API gateway application access authorization and management described in the present invention, in step S4, the application scenario includes:
[0035] 1: For unauthenticated APIs;
[0036] 2. When the API requires authentication and an application has been authorized to access the API;
[0037] 3. When the API requires authentication, and an application has been authorized to access the API (hmac-auth mode);
[0038] 4: Set app_auth_type to jwt mode.
[0039] A cross-resource pool API gateway application access authorization and management system, the system is applicable to any of the above methods, and the system includes:
[0040] 1: Cross-resource pool application configuration storage module based on database;
[0041] 2: Application configuration adaptation module;
[0042] 3: Plug-in-based authentication and authorization management module;
[0043] 4: API calls SDK.
[0044] As a preferred solution of the API gateway application access authorization and management system across resource pools described in the present invention, in "one":
[0045] ①: When creating an application in the gateway console, the application configuration is stored in the global database, where the application configuration table records the characteristics of the created application, and the application authorization relationship table records which APIs the application has access rights to;
[0046] ②: When authorizing / deauthorizing the API, send the configuration to the API (api_id) of each resource pool (region_id);
[0047] ③: When the APP configuration changes, traverse the relationship table, issue and update the application configuration information of each resource pool API according to the relationship records;
[0048] In "Two":
[0049] ①: Receive a unified application authorization request body, including application ID, resource pool ID, instance ID, API unique identifier and authorization validity period;
[0050] ②: The application configuration adapter module is actually a configuration converter. It obtains the authentication plug-in type and configuration YAML data according to the application ID, and parses the YAML format into the authentication configuration in Map format to flexibly support authentication methods;
[0051] ③: Send the plugin config map to the specified resource pool and different APIs of the instance. After the API configuration is completed, the authorization configuration takes effect.
[0052] As a preferred solution of the API gateway application access authorization and management system across resource pools described in the present invention, in "three":
[0053] ①: After receiving the plugin configuration, the module creates a consumer resource based on app_id, which contains the authentication token information;
[0054] ②: Update the plugin information plugins in each api resource according to the api_id list to be authorized, including: auth_plugin corresponding to app_auth_type; update the whitelist of consumer-restriction plugin;
[0055] ③: Write multiple authentication plug-ins to each API to enable the same API to be authorized to different applications, and different applications use different authentication types;
[0056] In "four":
[0057] ①: Provide a unified SDK for API calls, with built-in signature implementation in the SDK, so that users can quickly get started when calling and avoid the cumbersome signature generation process;
[0058] ②: Support multi-language implementation.
[0059] Beneficial effects of the present invention:
[0060] 1. The application configuration storage module provides a usage scenario for APP configuration sharing across resource pools;
[0061] 2. Complete the conversion from application configuration to plug-in configuration by configuring the adapter module, and support unified access capabilities for multiple authentication methods;
[0062] 3. The authentication and authorization management module supports managing access credentials for a certain type of service through consumers, which can be reused by different APIs, and can flexibly control access to the API through the consumer-restriciton plug-in without deleting consumer resources, avoiding the dependence and mutual influence of consumer configuration among APIs. This design can not only ensure the reuse of consumers among multiple APIs, but also support the configuration of multiple authentications and simultaneous authentication, which can provide users with more flexible application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0064] Figure 1 A library representation of application configuration sharing for a system for API gateway application access authorization and management across resource pools proposed by the present invention;
[0065] Figure 2 A schematic diagram of the application configuration storage and conversion and distribution structure of a cross-resource pool API gateway application access authorization and management system proposed by the present invention;
[0066] Figure 3 A schematic diagram of extracting plug-in configuration according to authentication type by an application configuration adapter module of an API gateway application access authorization and management system across resource pools proposed by the present invention;
[0067] Figure 4 A schematic diagram of a plug-in-based authentication and authorization management module for a cross-resource pool API gateway application access authorization and management system proposed by the present invention. DETAILED DESCRIPTION
[0068] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0069] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0070] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0071] Secondly, the present invention is described in detail with reference to the schematic diagram. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0072] Reference Figure 1-Figure 4 , as an embodiment of the present invention, provides a method for cross-resource pool API gateway application access authorization and management, the method comprising the following steps:
[0073] S1: When creating an application, the controller stores the application configuration in the national database, acting as a global configuration center. Other resource pools can share this configuration information.
[0074] In step S1, it includes the following sub-steps:
[0075] Step 1: When creating an application, we provide a general configuration template for the supported authentication types to help users quickly create applications, including application name, application authentication type, and application configuration YAML data;
[0076] Step 2: After the application is created, the user authorizes and releases the API;
[0077] Step 3: After the application is created, the user can quickly modify or delete the configuration information. After the change, the configuration will be automatically synchronized to the corresponding API according to the authorized relationship table;
[0078] S2: Authorization process;
[0079] In step S2, it includes the following sub-steps:
[0080] Step 1: When performing authorization actions;
[0081] Step 2: When the authorization and authentication management module receives the authorization instruction and plugin_config;
[0082] In step one, it includes the following sub-steps:
[0083] ①: The configuration adapter module obtains complete configuration information from the database according to app_id;
[0084] ②: Convert app_config (yaml) to auth_plugin_config according to app_auth_type;
[0085] ③: Send the authorization instruction and plugin_config to the authorization and authentication management module, and inform it of the list of APIs to be authorized;
[0086] ④: Write the relationship record of the application authorization API into the database;
[0087] In step 2, it includes the following sub-steps:
[0088] ①: Create a consumer resource based on app_id in the current instance. The consumer resource contains a consumer identifier with app_id as consumer_id, authentication information, and a quick authentication code;
[0089] ②: Update the resource configuration information of the API, that is, update the plugins configuration in the API resource, which includes: (i) writing an auth-plugin name identifier corresponding to app_auth_type, indicating that the API needs to be authenticated through this authentication method; (ii) the consumer-restriction plug-in, the whitelist and blacklist in the plug-in represent the allowed and unallowed consumer lists respectively. When authorizing, write consumer_id into the whitelist;
[0090] S3: Deauthorization process;
[0091] The deauthorization process consists of the following sub-steps:
[0092] Step 1: When performing the deauthorization action;
[0093] Step 2: When the authorization and authentication management module receives the access authorization instruction and api_id;
[0094] In step one, it includes the following sub-steps:
[0095] ①: Send the deauthorization instruction and plugin_config to the authorization and authentication management module, and inform it of the list of APIs to be authorized;
[0096] ②: Update the database and delete the relationship record of the application authorization API;
[0097] In step 2: You need to update the consumer-restriction plug-in in the API resource and remove consumer_id from the whitelist in the plug-in;
[0098] S4: User calls API application scenario.
[0099] In step S4, the application scenarios include:
[0100] 1: For unauthenticated APIs;
[0101] 2. When the API requires authentication and an application has been authorized to access the API;
[0102] 3. When the API requires authentication, and an application has been authorized to access the API (hmac-auth mode);
[0103] 4: Set app_auth_type to jwt mode.
[0104] A cross-resource pool API gateway application access authorization and management system, the system is applicable to any of the above methods, and the system includes:
[0105] 1: Cross-resource pool application configuration storage module based on database;
[0106] ①: When creating an application in the gateway console, the application configuration is stored in the global database, where the application configuration table records the characteristics of the created application, and the application authorization relationship table records which APIs the application has access rights to;
[0107] app_id is the unique identifier of the current application. Based on this identifier, configuration and authorization relationship are obtained and issued from the database. It is bound to the consumer in the authentication and authorization management module. Users can choose different authentication types, such as key-auth, basic-auth and other simple authentications, as well as hmac-auth, jwt-auth and other methods to cope with different usage scenarios. At the same time, it provides users with different authentication configuration templates, which are recorded through app_config.
[0108] ②: When authorizing / deauthorizing the API, send the configuration to the API (api_id) of each resource pool (region_id);
[0109] Perform batch authorization / deauthorization operations on APIs in each resource pool, and update the relationship between applications and APIs in the API authorization relationship table;
[0110] ③: When the APP configuration changes, traverse the relationship table, issue and update the application configuration information of each resource pool API according to the relationship records;
[0111] 2: Application configuration adaptation module;
[0112] ①: Receive a unified application authorization request body, including application ID, resource pool ID, instance ID, API unique identifier and authorization validity period;
[0113] ②: The application configuration adapter module is actually a configuration converter. It obtains the authentication plug-in type and configuration yaml data according to the application ID, and parses the yaml format into the authentication configuration in Map format to flexibly support authentication methods such as key-auth, basic-auth, hmac-auth, jwt-auth, etc.
[0114] ③: Send the plugin config map to the specified resource pool and different APIs of the instance. After the API configuration is completed, the authorization configuration takes effect;
[0115] 3: Plug-in-based authentication and authorization management module;
[0116] ①: After receiving the plugin configuration, the module creates a consumer resource based on app_id, which contains the authentication token information;
[0117] ②: Update the plugin information plugins in each api resource according to the api_id list to be authorized, including: auth_plugin corresponding to app_auth_type; update the whitelist of consumer-restriction plugin;
[0118] ③: Write multiple authentication plug-ins to each API to enable the same API to be authorized to different applications, and different applications use different authentication types;
[0119] 4: API calls SDK;
[0120] ①: Provide a unified SDK for API calls, with built-in signature implementation in the SDK, so that users can quickly get started when calling and avoid the cumbersome signature generation process;
[0121] ②: Support multi-language implementation.
[0122] During use, the application configuration storage module provides a scenario for sharing APP configurations across resource pools; the configuration adapter module completes the conversion from application configuration to plug-in configuration, supporting unified access capabilities for multiple authentication methods; the authentication and authorization management module supports managing access credentials for a certain type of service through consumers, which can be reused by different APIs, and can flexibly control access to APIs through the consumer-restriciton plug-in without deleting consumer resources, thus avoiding the dependence and mutual influence of consumer configurations between APIs. Such a design can not only ensure the reuse of consumers among multiple APIs, but also support the configuration of multiple authentications for simultaneous authentication; it can provide users with more flexible application scenarios.
[0123] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for cross-resource pool API gateway application access authorization and management, characterized in that: The method comprises the following steps: S1: When creating an application, the controller stores the application configuration in the national database and acts as a global configuration center; S2: Authorization process; S3: Deauthorization process; S4: User calls API application scenario.
2. According to claim 1, a method for cross-resource pool API gateway application access authorization and management is characterized in that: In step S1, it includes the following sub-steps: Step 1: When creating an application, we provide a general configuration template for the supported authentication types to help users quickly create applications, including application name, application authentication type, and application configuration YAML data; Step 2: After the application is created, the user authorizes and releases the API; Step 3: After the application is created, the user can quickly modify or delete the configuration information. After the change, the configuration will be automatically synchronized to the corresponding API according to the authorized relationship table.
3. According to a method for cross-resource pool API gateway application access authorization and management according to claim 1, it is characterized in that: In step S2, it includes the following sub-steps: Step 1: When performing authorization actions; Step 2: When the authorization and authentication management module receives the authorization instruction and plugin_config.
4. According to claim 3, a method for cross-resource pool API gateway application access authorization and management is characterized in that: In the step 1, it includes the following sub-steps: ①: The configuration adapter module obtains complete configuration information from the database according to app_id; ②: Convert app_config (yaml) to auth_plugin_config according to app_auth_type; ③: Send the authorization instruction and plugin_config to the authorization and authentication management module, and inform it of the list of APIs to be authorized; ④: Write the relationship record of the application authorization API into the database; In the step 2, it includes the following sub-steps: ①: Create a consumer resource based on app_id in the current instance. The consumer resource contains a consumer identifier with app_id as consumer_id, authentication information, and a quick authentication code; ②: Update the resource configuration information of the API, that is, you need to update the plugins configuration in the API resources, which includes: (a) writing an auth-plugin name identifier corresponding to app_auth_type, indicating that the API needs to be authenticated through this authentication method; (b) the consumer-restriction plug-in, the whitelist and blacklist in the plug-in respectively represent the allowed and disallowed consumer lists. When authorizing, write consumer_id into the whitelist.
5. According to a method for cross-resource pool API gateway application access authorization and management according to claim 1, it is characterized in that: The deauthorization process includes the following sub-steps: Step 1: When performing the deauthorization action; Step 2: When the authorization and authentication management module receives the contact authorization instruction and api_id.
6. According to claim 5, a method for cross-resource pool API gateway application access authorization and management is characterized in that: In the step 1, it includes the following sub-steps: ①: Send the deauthorization instruction and plugin_config to the authorization and authentication management module, and inform it of the list of APIs to be authorized; ②: Update the database and delete the relationship record of the application authorization API; In the step 2: it is necessary to update the consumer-restriction plug-in in the API resource and remove the consumer_id from the whitelist in the plug-in.
7. According to a method for cross-resource pool API gateway application access authorization and management according to claim 1, it is characterized in that: In step S4, the application scenarios include: 1: For unauthenticated APIs; 2. When the API requires authentication and an application has been authorized to access the API; 3. When the API requires authentication, and an application has been authorized to access the API (hmac-auth mode); 4: Set app_auth_type to jwt mode.
8. A cross-resource pool API gateway application access authorization and management system, characterized in that: The system is applicable to any one of the methods in claims 1 to 7 above, and the system comprises: 1: Cross-resource pool application configuration storage module based on database; 2: Application configuration adaptation module; 3: Plug-in-based authentication and authorization management module; 4: API calls SDK.
9. A cross-resource pool API gateway application access authorization and management system according to claim 8, characterized in that: In "one": ①: When creating an application in the gateway console, the application configuration is stored in the global database, where the application configuration table records the characteristics of the created application, and the application authorization relationship table records which APIs the application has access rights to; ②: When authorizing / deauthorizing the API, send the configuration to the API (api_id) of each resource pool (region_id); ③: When the APP configuration changes, traverse the relationship table, issue and update the application configuration information of each resource pool API according to the relationship records; In "two": ①: Receive a unified application authorization request body, including application ID, resource pool ID, instance ID, API unique identifier and authorization validity period; ②: The application configuration adapter module is actually a configuration converter. It obtains the authentication plug-in type and configuration YAML data according to the application ID, and parses the YAML format into the authentication configuration in Map format to flexibly support authentication methods; ③: Send the plugin config map to the specified resource pool and different APIs of the instance. After the API configuration is completed, the authorization configuration takes effect.
10. A cross-resource pool API gateway application access authorization and management system according to claim 8, characterized in that: In "three": ①: After receiving the plugin configuration, the module creates a consumer resource based on app_id, which contains the authentication token information; ②: Update the plugin information plugins in each api resource according to the api_id list to be authorized, including: auth_plugin corresponding to app_auth_type; Update the whitelist of the consumer-restriction plugin; ③: Write multiple authentication plug-ins to each API to enable the same API to be authorized to different applications, and different applications use different authentication types; In "four": ①: Provide a unified SDK for API calls, with built-in signature implementation in the SDK, so that users can quickly get started when calling and avoid the cumbersome signature generation process; ②: Support multi-language implementation.
Citation Information
Patent Citations
Method for realizing independent authentication of API gateway based on application
CN112818325A
API (Application Program Interface) gateway routing implementation method in cross-machine-room scene
CN113965434A
BS access database management system
CN114168669A
Big data hyper-fusion visual management method
CN117708223A
Application programming interface (API) service apparatus and application programming interface (API) service system
US20190227856A1
Cited By
API (Application Program Interface) calling management and control system and authentication method for different security protection levels in specific field
CN119449446A
An API call control system and authentication method with different security protection levels for specific domains
CN119449446B
