OAuth2 single sign-on method based on configuration item
By using a configuration-based OAuth2 single sign-on method, key information is extracted as configuration items, which solves the problems of poor maintainability and usability in the OAuth2 single sign-on technology integration process, achieves efficient code adaptation and maintenance, and reduces the integration cycle and cost.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-14
- Publication Date
- 2026-04-07
AI Technical Summary
Existing OAuth2 single sign-on technology suffers from poor maintainability and usability during integration, and the integration process is lengthy, with redundant code, high maintenance costs, and difficulty in adapting to various situations.
The OAuth2 single sign-on method based on configuration items is adopted. Key information in the OAuth2 authorization code mode process is extracted as configuration items, stored in configuration files, and used to assemble HTTP/HTTPS requests in the front end and back end, reducing code changes and improving versatility and adaptability.
The OAuth2 single sign-on implementation is highly maintainable, reduces the integration cycle and maintenance costs, improves code usability and adaptability, and reduces development and self-testing costs.
Smart Images

Figure CN116488880B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of single sign-on, in particular to an OAuth2 single sign-on method based on configuration items. BACKGROUND
[0002] Single sign-on (SSO) technology is mainly used to solve the trust problem between multiple applications, so as to break through the information island and achieve the effect of one login for multiple applications. The commonly used landing technologies at present include cas (single sign-on), OAuth2 (third-party login authorization) and jwt (client token), etc. Among them, OAuth2, as the most popular authorization mechanism at present, is widely spread and continuously adopted in application docking due to its good security and friendliness. OAuth2 is only a protocol, not a specific implementation, and the implementation methods of different companies are different. The traditional OAuth2 docking method is to pass through the api interface in the fixed process, adopt the back-end determination request method, input parameter information and return parameter content, etc. to obtain related information step by step, open the permission entrance and realize the login logic. Due to the differences in the interfaces implemented by different companies, the following needs to be done during the docking process Figure 1 Customized development is shown.
[0003] In actual application, the above-mentioned docking method mainly has the following disadvantages: 1. Poor maintainability and long docking period, each time the OAuth2 single sign-on is docked, customized development needs to be carried out according to the differences, and when the system is docked for many times, the project code is redundant and the maintenance cost is increased; 2. Poor usability and frequent code modification, a set of code cannot adapt to multiple situations, when the request method, input parameter information or return parameter content exist differences, the code needs to be modified differently, the larger the range of code changes, the higher the development and testing cost.
[0004] Therefore, how to improve the maintainability of single sign-on while reducing the maintenance cost has become a technical problem to be solved. SUMMARY
[0005] Therefore, in order to overcome the shortcomings of the prior art, the present application aims to provide an OAuth2 single sign-on method based on configuration items.
[0006] The present application provides an OAuth2 single sign-on method based on configuration items, comprising:
[0007] Step S1: extracting the key information in the OAuth2 authorization code mode flow code, and storing the extracted key information into a configuration file as configuration items;
[0008] Step S2: sending a user login request to an authentication server for authorization authentication through a front-end web, and transmitting a corresponding authorization code code into a back-end api;
[0009] Step S3: The backend api assembles a first HTTP / HTTPS request according to the configuration item, obtains access_token data from the authentication server;
[0010] Step S4: The backend api assembles a second HTTP / HTTPS request according to the configuration item and the access_token data, and obtains user data from the resource server;
[0011] Step S5: The backend api generates a business system token token according to the user data and returns it to the front-end web, and the front-end web performs user single sign-on according to the user single sign-on request and the returned business system token token.
[0012] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on configuration items of the present application, the configuration items in step S1 include configuration items composed of key information required for obtaining authorization code code, configuration items composed of key information required for obtaining access_token through authorization code code, and configuration items composed of key information required for obtaining user configuration through access_token.
[0013] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on configuration items of the present application, the configuration items in step S1 include configuration items composed of path information of the authentication server, configuration items composed of parameter names of the authorization code code, configuration items for assembling HTTP / HTTPS requests, configuration items composed of springEL expressions for obtaining request results access_token data, and configuration items composed of springEL expressions for obtaining user information of the request results.
[0014] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on configuration items of the present application, step S2 includes:
[0015] Step S21: receiving a user login request from the browser through the front-end web;
[0016] Step S22: The front-end web identifies the first login user according to whether the business system token token is carried in the user single sign-on request;
[0017] Step S23: The front-end web obtains the path information of the authentication server from the configuration item VUE_APP_SSO_LOGIN_ADDRESS, jumps to the authentication server according to the path information, and the path information includes authentication server address information, password of the business system registered in the authentication server, and redirection address;
[0018] Step S24: The authentication server performs identity authentication on the user according to the user login request, and when the user passes the identity authentication, jumps to the front-end web through the redirection address and returns the authorization code code to the front-end web;
[0019] Step S25: The front-end web obtains the parameter name of the authorization code code from the configuration item VUE_APP_SSO_CODEKEY, extracts the authorization code code returned by the authentication server according to the obtained parameter name of the authorization code code, and transmits the extracted authorization code code to the back-end API.
[0020] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on the configuration item comprises the following steps:
[0021] Step S31: The back-end API assembles a first HTTP / HTTPS request according to the configuration item, and sends the assembled first HTTP / HTTPS request to the authentication server.
[0022] Step S32: The authentication server receives the first HTTP / HTTPS request sent by the back-end API, and returns corresponding access_token reverse parameter information to the back-end API.
[0023] Step S33: The back-end API obtains a springEL expression from the configuration item accesstoken, and parses the access_token reverse parameter information according to the obtained springEL expression to obtain access_token data.
[0024] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on the configuration item comprises the following steps:
[0025] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on the configuration item comprises the following steps:
[0026] Step S41: The back-end API assembles a second HTTP / HTTPS request according to the configuration item and the access_token data, and sends the assembled second HTTP / HTTPS request to the resource server.
[0027] Step S42: The resource server receives the second HTTP / HTTPS request sent by the backend API, and returns the corresponding user reverse parameter information to the backend API;
[0028] Step S43: The backend API obtains a springEL expression from the configuration item userinfo, and parses the user reverse parameter information according to the obtained springEL expression to obtain user data.
[0029] As a preferred embodiment of the present application, in the OAuth2 single sign-on method based on the configuration item, in step S41, the backend API assembles the second HTTP / HTTPS request according to the configuration item and the access_token data, including: obtaining the request protocol from the configuration item restTemplateType, assembling the request header through the configuration item header, embedding the access_token data in the request header, obtaining the request method from the configuration item method, obtaining the request path from the configuration item url, and assembling the request protocol, the request header, the request method and the request path into the second HTTP / HTTPS request.
[0030] As a preferred embodiment of the present application, in the OAuth2 single sign-on method based on the configuration item, in step S43, the user data is obtained by parsing the user reverse parameter information according to the obtained springEL expression, including: obtaining user data matched with the business system permission system from the user reverse parameter detailed analysis, and the user data includes account name, password and mobile phone number.
[0031] As a preferred embodiment of the present application, the OAuth2 single sign-on method based on the configuration item further comprises: performing a logout operation by obtaining the configuration item VUE_APP_SSO_LOGINOUT_ADDRESS.
[0032] The OAuth2 single sign-on method based on the configuration item has the following beneficial effects:
[0033] 1. Strong maintainability and short interfacing period, the process code of the OAuth2 single sign-on implementation technology is commonly modified, when the check information and the synchronization information process are the same, all the key information is extracted to form a variable configuration item, each time the OAuth2 single sign-on is interfaced, no customization development is needed, only the configuration item file needs to be maintained in the later period, the interfacing process only involves the configuration file, and no code is involved, so that the development period is reduced.
[0034] 2. The availability is strong, and the adaptation difficulty of single sign-on is reduced by configuration injection without code modification. In the later period, only configuration items need to be maintained without code modification. One set of code can adapt to multiple cases. When the request mode, input parameter information and reverse parameter content exist differences, only differential configuration is needed. The smaller the code change range is, the lower the development and self-test cost is. The period of connection is reduced, the available line of code is improved, the maintenance cost is reduced, and the universal adaptability is improved. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0036] Figure 1 It is a schematic diagram of the OAuth2 connection process in the prior art.
[0037] Figure 2 It is a technical principle diagram of the OAuth2 single sign-on method based on configuration items of the present application.
[0038] Figure 3 It is a flowchart of the OAuth2 single sign-on method based on configuration items of the embodiment of the present application.
[0039] Figure 4 It is an implementation schematic diagram of the OAuth2 single sign-on method based on configuration items of the embodiment of the present application.
[0040] Figure 5 It is a flowchart of step S2 in the OAuth2 single sign-on method based on configuration items of the embodiment of the present application.
[0041] Figure 6 It is a flowchart of step S3 in the OAuth2 single sign-on method based on configuration items of the embodiment of the present application.
[0042] Figure 7 It is a flowchart of step S4 in the OAuth2 single sign-on method based on configuration items of the embodiment of the present application.
[0043] Figure 8 It is a structural schematic diagram of the device provided by the present application. DETAILED DESCRIPTION
[0044] The embodiments of the present application will be described in detail below with reference to the drawings.
[0045] It should be noted that the following embodiments and features in the embodiments can be combined with each other in the case of no conflict; and all other embodiments obtained by those skilled in the art based on the embodiments in the present disclosure without creative labor are within the scope of protection of the present disclosure.
[0046] It should be noted that various aspects of the embodiments described below are within the scope of the appended claims. As will be apparent, the aspects described herein can be implemented in various ways, and that any particular structure is chosen merely for convenience and / or simplicity and not to limit the scope of the application. One of ordinary skill in the art will appreciate from the present disclosure that one aspect can be implemented by a device without the other aspects, and that two or more aspects can be combined in any manner. For example, an apparatus can be implemented or a method can be practiced using any number of the aspects set forth herein. In addition, such an apparatus can be implemented or such a method can be practiced using other structure and / or functionality in addition to or other than one or more of the aspects set forth herein.
[0047] As shown in Figure 2 The technical principles of the present application are as follows:
[0048] The process code of the OAuth2 single sign-on implementation technology is commonly modified. When the check information and the synchronization information process are the same, all the key information is extracted to form a variable configuration item. The adaptation difficulty of the single sign-on is reduced by the configuration injection. In the later period, only the configuration item needs to be maintained without modifying the code, reducing the connection period length, improving the available lines of the code, reducing the maintenance cost, improving the universal adaptability, and improving the usability of the system.
[0049] The following are the explanations of the terms in each embodiment:
[0050] OAuth2 (Open Authorization): OAuth is an open network standard about authorization, allowing users to authorize third-party applications to access their information stored in another service provider without providing the third-party mobile application with the username and password or sharing all their data. The present method preferably uses the 2.0 version of Oauth, which is divided into four authorization modes: authorization code mode, implicit mode, password mode (resource owner password credentials), and client mode (client credentials).
[0051] Spring EL (short for SpEL): Spring EL expression is the Spring Expression Language, which supports the use of expressions in xml and annotations, similar to JSP EL, JSTL Expression Language. Spring development often involves calling various resources, including normal files, URLs, regular expressions, system variables, and other Bean properties, configuration files, and collections, etc. Users can use Spring's Expression Language to implement resource injection, without manually managing Spring Expression-related interfaces and instances. You only need to write Spring expressions, and Spring will automatically parse and convert the expressions.
[0052] HTTP / HTTPS request: HTTP (HyperText Transfer Protocol) is an application layer protocol for distributed, collaborative and hypermedia information systems. HTTPS (Hypertext Transfer Protocol Secure) is a transmission protocol for secure communication over computer networks. When making a network request, you need to determine the protocol type.
[0053] access_token data: In OAuth2 authorization code mode, the authorization code code is used as a request parameter to obtain the access_token data in the authentication server return result, and the access_token data is used as a request parameter to obtain the user data in the resource server return result.
[0054] Configuration item VUE_APP_SSO_LOGIN_ADDRESS: custom configuration item, stores the path information for requesting the authentication server, including authentication server address information, business system password registered in the authentication server, and redirection address after successful login to the authentication server.
[0055] Configuration item VUE_APP_SSO_CODEKEY: custom configuration item, stores the parameter name of the authorization code code, extracts the authorization code code returned by the authentication server according to the parameter name of the obtained authorization code code, and passes the extracted authorization code to the backend API.
[0056] Configuration item accesstoken: custom configuration item, stores the springEL expression, which is used to obtain the access_token data in the authentication server return result.
[0057] Data configuration item restTemplateType: custom configuration item, stores the request protocol type, which is used to determine whether it is an HTTP request or an HTTPS request.
[0058] Configuration item header: A custom configuration item that stores request header information and provides request header parameter configuration information when making HTTP / HTTPS requests.
[0059] Configuration item method: A custom configuration item that stores request method information. When making HTTP / HTTPS requests, it determines whether the request method is GET or POST.
[0060] Configuration item url: A custom configuration item that stores the address information of the target server when making HTTP / HTTPS requests.
[0061] The `param` configuration item is a custom configuration item that stores request body parameter information. When making HTTP / HTTPS requests, the parameter information needs to be included in the request body.
[0062] The userinfo configuration item is a custom configuration item that stores SpringEL expressions used to retrieve user data from the results returned by the resource server. This part of the configuration item needs to start from the permission system of the business system and extract key data that conforms to the permission system, such as username, password, and mobile phone number, from the back parameters to achieve permission adaptation.
[0063] VUE_APP_SSO_LOGINOUT_ADDRESS: A custom configuration item used to store logout API information. When a user logs out, the front end can directly call the logout API.
[0064] This invention provides an OAuth2 single sign-on method based on configuration items. Figure 3 This is a flowchart of the OAuth2 single sign-on method based on configuration items according to an embodiment of the present invention. Figure 4 This is a schematic diagram illustrating the implementation of the OAuth2 single sign-on method based on configuration items in an embodiment of the present invention.
[0065] like Figure 3 and Figure 4As shown, step S1 of the method in this embodiment is implemented as follows: extract key information from the OAuth2 authorization code mode flow code, and store the extracted key information as configuration items in the configuration file; the configuration items include configuration items composed of key information required to obtain the authorization code, such as configuration items composed of the path information of the authentication server, configuration items composed of the parameter names of the authorization code; configuration items composed of key information required to obtain the access_token through the authorization code, such as configuration items for assembling HTTP / HTTPS requests, configuration items composed of Spring EL expressions for obtaining the access_token data of the request result; configuration items composed of key information required to obtain the user configuration through the access_token, such as configuration items for assembling HTTP / HTTPS requests, configuration items composed of Spring EL expressions for obtaining the user information of the request result.
[0066] Step S2 of the method in this embodiment is implemented as follows: the user login request is sent to the authentication server for authorization and authentication through the front-end web, and the corresponding authorization code is passed to the back-end API. Figure 5 This is a flowchart of step S2 in the OAuth2 single sign-on method based on configuration items in this embodiment. Specifically, as shown below... Figure 5 As shown, step S2 of the method in this embodiment is implemented in the following manner:
[0067] Step S21: Receive user login requests from browsers via the front-end web interface;
[0068] Step S22: The front-end web identifies first-time login users based on whether the user's single sign-on request carries a business system token;
[0069] Step S23: The front-end web obtains the path information of the authentication server from the configuration item VUE_APP_SSO_LOGIN_ADDRESS, and redirects to the authentication server according to the path information. The path information includes the authentication server address information, the password of the business system registered on the authentication server, and the redirect address.
[0070] Step S24: The authentication server authenticates the user's identity based on the user's login request. After the user passes the authentication, the server redirects to the front-end web server and returns the authorization code to the front-end web server. Step S25: The front-end web server obtains the parameter name of the authorization code from the configuration item VUE_APP_SSO_CODEKEY, extracts the authorization code returned by the authentication server based on the obtained authorization code parameter name, and passes the extracted authorization code to the back-end API.
[0071] The configuration item VUE_APP_SSO_LOGIN_ADDRESS data structure for step S23 of this embodiment is shown below:
[0072] OAUTH.LOGIN.URL={\
[0073] "VUE_APP_SSO_CODEKEY": "Enter the name of the parameter containing the authorization code".
[0074] "VUE_APP_SSO LOGIN ADDRESS":"Enter the authentication server login path information",\
[0075] "VUE_APP_SSO_LOGINOUT_ADDRESS": "Enter the authentication server logout path information"\
[0076] }
[0077] Step S3 of the method in this embodiment is implemented as follows: The backend API assembles the first HTTP / HTTPS request according to the configuration items and obtains access_token data from the authentication server. The data structure of the configuration items in step S3 of the method in this embodiment is as follows:
[0078]
[0079]
[0080] Figure 6 This is a flowchart of step S3 in the OAuth2 single sign-on method based on configuration items of the present invention. Specifically, as shown below... Figure 6 As shown, step S3 of the method in this embodiment is implemented in the following manner:
[0081] Step S31: The backend API assembles the first HTTP / HTTPS request according to the configuration items. Specifically, it obtains the request protocol from the restTemplateType configuration item, assembles the request header through the header configuration item, obtains the request method from the method configuration item, obtains the request path from the url configuration item, and assembles the request parameters through the param configuration item. The request protocol, request header, request method, request path, and request parameters are assembled into the first HTTP / HTTPS request, and the assembled first HTTP / HTTPS request is sent to the authentication server.
[0082] Step S32: The authentication server receives the first HTTP / HTTPS request sent by the backend API and returns the corresponding access_token back parameter information to the backend API;
[0083] Step S33: The backend API retrieves the SpringEL expression from the configuration item accesstoken, parses the access_token back parameter information based on the retrieved SpringEL expression, and obtains the access_token data.
[0084] Step S4 of the method in this embodiment is implemented as follows: The backend API assembles a second HTTP / HTTPS request based on the configuration items and access_token data to obtain user data from the resource server. The data structure of the configuration items in step S4 of the method in this embodiment is shown below:
[0085]
[0086] Figure 7 This is a flowchart of step S4 in the OAuth2 single sign-on method based on configuration items of the present invention. Specifically, as shown below... Figure 7 As shown, step S4 of the method in this embodiment is implemented in the following manner:
[0087] Step S41: The backend API assembles a second HTTP / HTTPS request based on the configuration items and access_token data. Specifically, it obtains the request protocol from the restTemplateType configuration item, assembles the request header through the header configuration item, embeds the access_token data in the request header, obtains the request method from the method configuration item, obtains the request path from the url configuration item, assembles the request protocol, request header, request method, and request path into a second HTTP / HTTPS request, and sends the assembled second HTTP / HTTPS request to the resource server.
[0088] Step S42: The resource server receives the second HTTP / HTTPS request sent by the backend API and returns the corresponding user feedback information to the backend API;
[0089] Step S43: The backend API retrieves the SpringEL expression from the configuration item userinfo, parses the user feedback information based on the retrieved SpringEL expression, and obtains user data. Specifically, it retrieves user data that matches the business system's permission system from the detailed parsing of the user feedback. The user data includes username, password, and mobile phone number.
[0090] Step S5 of the method in this embodiment is implemented as follows: The backend API generates a business system token based on the user data and returns it to the frontend web. The frontend web performs single sign-on for the user based on the user's single sign-on request and the returned business system token.
[0091] The logging method in this embodiment also includes: performing a logout operation by obtaining the configuration item VUE_APP_SSO_LOGINOUT_ADDRESS.
[0092] like Figure 8 As shown, the present invention also provides a device including a processor 110, a communication interface 120, a memory 130 for storing a processor-executable computer program, and a communication bus 140. The processor 110, communication interface 120, and memory 130 communicate with each other via the communication bus 140. The processor 110 implements the aforementioned configuration-based OAuth2 single sign-on method by running the executable computer program.
[0093] The computer program in memory 130, when implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0094] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected based on actual needs to achieve the purpose of this embodiment. Those skilled in the art can understand and implement this without any creative effort.
[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0096] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A configuration-based OAuth2 single sign-on method, characterized in that, The method includes: Step S1: Extract key information from the OAuth2 authorization code flow code, and store the extracted key information as configuration items in the configuration file; Step S2: Send the user login request to the authentication server for authorization via the front-end web interface, and pass the corresponding authorization code to the back-end API; Step S3: The backend API assembles the first HTTP / HTTPS request according to the configuration items and obtains access_token data from the authentication server; Step S4: The backend API assembles a second HTTP / HTTPS request based on the configuration items and access_token data to retrieve user data from the resource server; Step S5: The backend API generates a business system token based on the user data and returns it to the frontend web. The frontend web then performs single sign-on for the user based on the user's single sign-on request and the returned business system token. The configuration items in step S1 include: configuration items consisting of the path information of the authentication server, configuration items consisting of the parameter name of the authorization code, configuration items for assembling the HTTP / HTTPS request, configuration items consisting of the access_token data used to obtain the request result using springEL expressions, and configuration items consisting of the user information used to obtain the request result using springEL expressions. Step S3 includes: the backend API obtains the springEL expression from the configuration item accesstoken, parses the access_token return parameter information according to the obtained springEL expression, and obtains the access_token data; Step S4 includes: the backend API obtains the SpringEL expression from the configuration item userinfo, parses the user return parameter information based on the obtained SpringEL expression, and obtains the user data.
2. The OAuth2 single sign-on method based on configuration items according to claim 1, characterized in that, The configuration items in step S1 include configuration items consisting of key information required to obtain the authorization code, configuration items consisting of key information required to obtain the access_token through the authorization code, and configuration items consisting of key information required to obtain the user configuration through the access_token.
3. The OAuth2 single sign-on method based on configuration items according to claim 1, characterized in that, Step S2 includes: Step S21: Receive user login requests from browsers via the front-end web interface; Step S22: The front-end web identifies first-time login users based on whether the user's single sign-on request carries a business system token; Step S23: The front-end web obtains the path information of the authentication server from the configuration item VUE_APP_SSO_LOGIN_ADDRESS, and redirects to the authentication server according to the path information. The path information includes the authentication server address information, the password of the business system registered on the authentication server, and the redirect address. Step S24: The authentication server authenticates the user's identity based on the user's login request. After the user passes the authentication, the server redirects the user to the front-end web page and returns the authorization code to the front-end web page. Step S25: The front-end web server obtains the parameter name of the authorization code "code" from the configuration item VUE_APP_SSO_CODEKEY, extracts the authorization code "code" returned by the authentication server based on the obtained authorization code "code" parameter name, and passes the extracted authorization code "code" to the back-end API.
4. The OAuth2 single sign-on method based on configuration items according to claim 1, characterized in that, Step S3 includes: Step S31: The backend API assembles the first HTTP / HTTPS request according to the configuration items and sends the assembled first HTTP / HTTPS request to the authentication server; Step S32: The authentication server receives the first HTTP / HTTPS request sent by the backend API and returns the corresponding access_token parameter information to the backend API.
5. The OAuth2 single sign-on method based on configuration items according to claim 4, characterized in that, In step S31, the backend API assembles the first HTTP / HTTPS request according to the configuration items, including: obtaining the request protocol from the configuration item restTemplateType, assembling the request header through the configuration item header, obtaining the request method from the configuration item method, obtaining the request path from the configuration item url, assembling the request parameters through the configuration item param, and assembling the request protocol, request header, request method, request path and request parameters into the first HTTP / HTTPS request.
6. The OAuth2 single sign-on method based on configuration items according to claim 1, characterized in that, Step S4 includes: Step S41: The backend API assembles a second HTTP / HTTPS request based on the configuration items and access_token data, and sends the assembled second HTTP / HTTPS request to the resource server; Step S42: The resource server receives the second HTTP / HTTPS request sent by the backend API and returns the corresponding user parameter information to the backend API.
7. The OAuth2 single sign-on method based on configuration items according to claim 6, characterized in that, In step S41, the backend API assembles a second HTTP / HTTPS request based on the configuration items and access_token data, including: obtaining the request protocol from the configuration item restTemplateType, assembling the request header through the configuration item header, embedding the access_token data in the request header, obtaining the request method from the configuration item method, obtaining the request path from the configuration item url, and assembling the request protocol, request header, request method, and request path into a second HTTP / HTTPS request.
8. The OAuth2 single sign-on method based on configuration items according to claim 1, characterized in that, In step S4, the user return parameter information is parsed according to the obtained springEL expression to obtain user data, including: parsing the user return parameter information to obtain user data that matches the business system permission system, wherein the user data includes username, password and mobile phone number.
9. The OAuth2 single sign-on method based on configuration items according to claim 1, characterized in that, The method also includes: performing a logout operation by obtaining the configuration item VUE_APP_SSO_LOGINOUT_ADDRESS.