Micro-service-based authentication mode for authentication of various scenes

By introducing various scenario authentication modes into the microservice architecture and using technologies such as key parameters and signature authentication, the problems of application data security and API interface stability under microservices are solved, and authentication mechanisms suitable for different scenarios are implemented. , ensuring data security and interface stability.

CN118540071APending Publication Date: 2024-08-23HANGZHOU MAIDA ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310140092.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-21
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Under the microservice architecture, the security of application data and the stability of API interfaces are not good, especially when it is difficult to effectively manage service calls in different scenarios.

Method used

Adopt microservice-based authentication and authentication mode for each scenario, distinguish the namespaces of different business scenarios (api space, edge space, hide space, view space), use secret key parameters, signature authentication and password-free methods for authentication to ensure Data security and interface stability. Specific steps include using access_key_id and access_key_secret to obtain the jwt token, generate a signature, perform md5 encryption, and use signature authentication and password-free interaction in edge space and hide space.

Benefits of technology

A set of authentication and authentication systems suitable for different business scenarios has been established to ensure the security of application data and the stability of API interfaces under the platform's microservices, and to meet the authentication needs in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540071A
    Figure CN118540071A
Patent Text Reader

Abstract

The invention discloses a micro-service-based scene authentication mode, which is characterized in that after a user requests, different service scenes are distinguished according to a user request address, namespaces are divided into the following types: api space, authentication is carried out according to a secret key parameter before calling to obtain a jwt token, and the api space is divided into api space and a jwt token; the method comprises the following specific calling steps that a jwt token is obtained through authentication of acceskeyid and acceskeysecure secret key parameters, and the jwt carries authorization information; according to the authentication mode based on each scene under the micro-service, different authentication mechanisms are established under different business scenes, the security of application data and the stability of an API interface under the platform micro-service are ensured, and the authentication mode is suitable for a micro-service authentication system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of scene authentication and authorization mode, and specifically to an authentication and authorization mode for each scene based on microservices. Background Art

[0002] Based on the current development trend of the Internet, computer software is shifting from the traditional monolithic architecture model to the microservice architecture model. In actual scenarios, a complete microservice architecture design needs to consider service calls in various internal and external scenarios. Therefore, the security of application data and the stability of API interfaces under platform microservices are not good. For this reason, an authentication and authorization model based on various scenarios under microservices is proposed. Summary of the invention

[0003] In view of the deficiencies in the prior art, the present invention provides an authentication and authorization mode based on various scenarios under microservices, which solves the problems raised in the above background technology. Based on the current development trend of the Internet, computer software is shifting from the traditional monolithic architecture mode to the microservice architecture mode. In actual scenarios, a complete set of microservice architecture design needs to consider service calls in various internal and external scenarios. Therefore, the security of application data under the platform microservice and the stability of API interface are not good.

[0004] To achieve the above objectives, the present invention is implemented through the following technical solutions: an authentication mode based on various scenarios under microservices. After the user requests, the authentication mode distinguishes different business scenarios according to the user request address, and the namespace is divided into the following types:

[0005] API space, before calling, first authenticate according to the secret key parameters to obtain the jwt token. The specific calling steps are as follows: obtain the jwt token through the access_key_id and access_key_secret secret key parameters, and the jwt carries the authorization information; generate the sign signature and time parameters, and use md5hex for encryption; sign signature generation rules: organize the following json objects and then sort them by the ascii value of the object key to generate new json objects in different orders, traverse the json objects, generate a standard string according to the traversed json objects, and generate the sign signature according to the above concatenated string through md5 encryption;

[0006] Edge space, its specific calling steps are as follows: generate sign signature, time parameter, sign signature generation rule: organize the following json objects and sort them by the ascii value of the object key to generate new json objects in different orders, traverse the json objects, generate a standard string according to the traversed json objects, and generate a sign signature according to the above concatenated string through md5 encryption;

[0007] hide space, except for nginx port 80, other ports should be closed or accessed through IP authorization. The gateway layer of microservices performs permission verification and control on each namespace;

[0008] The view space is presented to the caller through interface interaction.

[0009] Furthermore, the edge space is directly called by signature authentication.

[0010] Furthermore, the hide space is an API interface call between modules in the same registration center under the microservice, and the interaction is performed in a password-free manner.

[0011] Furthermore, each pair of secret keys in the API space corresponds to a separate and unique signKey signature private key.

[0012] Furthermore, the edge space is directly called by signature authentication.

[0013] Furthermore, the hide space uses a password-free method for interaction.

[0014] The present invention provides an authentication mode for various scenarios based on microservices, which has the following beneficial effects:

[0015] Based on the authentication and authorization modes of various scenarios under microservices, a suitable microservice authentication and authorization system has been established from the actual business scenarios. This system satisfies the establishment of different authentication and authorization mechanisms in different business scenarios, ensures the security of application data and the stability of API interfaces under platform microservices, is suitable for the microservice authentication and authorization system, and satisfies the establishment of different authentication and authorization mechanisms in different business scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a schematic diagram of the system flow structure of the authentication mode in various scenarios based on microservices in the present invention. DETAILED DESCRIPTION

[0017] The following embodiments of the present invention are described in further detail in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0018] See also Figure 1 The present invention provides a technical solution: an authentication mode based on various scenarios under microservices. After the user requests, the authentication mode distinguishes different business scenarios according to the user request address, and the namespace is divided into the following types:

[0019] The api space (serving external product calls of third-party companies) provides external calls to third-party companies, so before the call, it is necessary to identify which company and which application the caller is from, so before the call, authentication is performed based on the secret key parameters to obtain the jwt token.

[0020] The specific calling steps are as follows: the third-party product obtains the jwt token through access_key_id and access_key_secret key parameters authentication, and the jwt contains authorization information; generates the sign signature and time parameters, and the encryption method is: md5hex

[0021] Signature generation rule: Organize the following JSON objects and sort them by the ascii value of the object key to generate a new JSON object in a different order;

[0022] Traverse the json object and generate a standard string based on the traversed json object. The string specification is as follows:

[0023] url={url}&method={method}×tamp={timestamp}&signKey={signKey}

[0024] Generate a sign signature through md5 encryption based on the above concatenated string, as shown below:

[0025] md5(url={url}&method={method}×tamp={timestamp}&signKey={signKey})

[0026] Each pair of secret keys (access_key_id, access_key_secret) corresponds to a unique signKey signature private key to ensure the security of the signature mechanism;

[0027] Edge space (serving other projects that are not in the company's microservice module) is called by internal company products, and the calling method is basically controllable, so there are generally no malicious calls. In order to improve the integration efficiency of the caller, the authentication and authorization step can be ignored, and the signature authentication method can be used for direct calling.

[0028] The calling steps are as follows:

[0029] Generate sign signature and time parameters,

[0030] Signature generation rules: Organize the following JSON objects and sort them by the ascii value of the object key to generate a new JSON object in a different order

[0031] Traverse the json object and generate a standard string based on the traversed json object. The string is standardized

[0032] as follows:

[0033] url={url}&method={method}×tamp={timestamp}&signKey={signKey}

[0034] Generate a sign signature through md5 encryption based on the above concatenated string, as shown below:

[0035] md5(url={url}&method={method}×tamp={timestamp}&signKey={signKey})

[0036] The feature of this mechanism is that as long as the signature authentication is passed, any API interface under the edge space can be called, making it more convenient and quick for the company's internal products to call the API interface under the microservice.

[0037] hide space (serving for calls between modules in the same registration center under microservices):

[0038] The API interface calls between modules in the same registration center under the microservice adopt a password-free way to interact.

[0039] In the hide space, you can interact in a password-free manner without worrying about security issues:

[0040] From the perspective of server security, except for nginx port 80, all other ports should be closed or accessible through IP authorization.

[0041] The gateway layer under the microservice performs permission verification and control on each namespace;

[0042] View space:

[0043] This space is used to solve the format problem returned after calling the API interface. Other namespaces return data in JSON format, while the view space presents it to the caller in an interactive interface.

[0044] The embodiments of the present invention are given for the purpose of illustration and description, and are not intended to be exhaustive or to limit the invention to the disclosed forms. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments are selected and described in order to better illustrate the principles and practical applications of the present invention and to enable those of ordinary skill in the art to understand the present invention and thereby design various embodiments with various modifications suitable for specific uses.

Claims

1. A microservice-based authentication model for various scenarios, characterized in that: After the user requests, this authentication mode distinguishes different business scenarios according to the user request address. The namespace is divided into the following types: API space, before calling, first authenticate according to the secret key parameters to obtain the jwt token. The specific calling steps are as follows: obtain the jwt token through the access_key_id and access_key_secret secret key parameters, and the jwt carries the authorization information; generate the sign signature and time parameters, and use md5hex for encryption; sign signature generation rules: organize the following json objects and then sort them by the ascii value of the object key to generate a new json object in a different order, traverse the json objects, generate a standard string according to the traversed json objects, and generate the sign signature according to the concatenated string through md5 encryption; Edge space, its specific calling steps are as follows: generate sign signature, time parameter, sign signature generation rule: organize the following json objects and sort them by the ascii value of the object key to generate new json objects in different orders, traverse the json objects, generate a standard string according to the traversed json objects, and generate a sign signature according to the concatenated string through md5 encryption; hide space, except for nginx port 80, other ports should be closed or accessed through IP authorization. The gateway layer of microservices performs permission verification and control on each namespace; The view space is presented to the caller through interface interaction.

2. According to claim 1, a microservice-based authentication mode for each scenario, characterized in that: The edge space is directly called by signature authentication.

3. According to the microservice-based authentication mode in various scenarios according to claim 1, it is characterized in that: The hide space is an API interface call between modules in the same registration center under the microservice, which interacts in a password-free manner.

4. According to the microservice-based authentication mode in various scenarios according to claim 1, it is characterized in that: Each pair of keys in the API space corresponds to a separate and unique signKey signature private key.

5. According to the microservice-based authentication mode in various scenarios according to claim 1, it is characterized in that: The edge space is directly called by signature authentication.

6. According to claim 1, a microservice-based authentication mode for each scenario, characterized in that: The hide space interacts in a non-cryptographic manner.