System and method for realizing authentication and authorization service of multiple clients
Through the combination of OAuth2 Authorization Server and AuthenticationProvider components, multi-client authentication and authorization services are implemented, solving the security and flexibility problems of multi-client authentication in a distributed environment, providing multiple authentication methods and multi-factor authentication support, and enhancing improve system security and user experience.
Patent Information
- Application Number
- CN202410875682.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-03
AI Technical Summary
In a complex distributed environment, existing technology is difficult to achieve safe and convenient authentication and authorization for multiple clients, and cannot freely define authentication and authorization methods for different clients, which affects the overall security of the system and user privacy.
Using the client registration component based on OAuth2 Authorization Server and the authentication provider component of AuthenticationProvider, client information registration and management are implemented through the client registration component, and the authentication provider component is used to provide customized authentication and authorization logic, supporting multiple credential types. and multi-factor authentication, into the filter chain of Spring Security tools.
It realizes the authentication and authorization of users through different clients in a distributed environment, supports multiple authentication methods, enhances the security and flexibility of the system, and meets the authentication needs in complex security environments.
Smart Images

Figure CN118590308A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information systems, and in particular to a system and method for implementing multi-client authentication and authorization services. Background Art
[0002] Whether in the Internet or information system fields, users will face complex distributed environments. In order to ensure that users can safely and conveniently access protected resources through multiple clients in complex distributed environments while maintaining the overall security of the system and user privacy, a method that can achieve multi-client authentication and authorization is needed.
[0003] In order to enable users of an information system in a distributed environment to perform authentication and authorization through different clients, and to freely define authentication and authorization methods for different clients, the present invention proposes a system and method for implementing multi-client authentication and authorization services. Summary of the invention
[0004] In order to make up for the defects of the prior art, the present invention provides a simple and efficient system and method for realizing multi-client authentication and authorization services.
[0005] The present invention is achieved through the following technical solutions:
[0006] A system for implementing multi-client authentication and authorization services, including a client registration component and an authentication provider component;
[0007] The client registration component is based on the client repository RegisteredClientRepository of the OAuth2 Authorization Server, and the user registers information of different clients through the client registration component;
[0008] The authentication provider component is based on AuthenticationProvider, which is responsible for providing each client with the type and logic method of authentication authorization under different authorization types, and placing the authentication provider in the filter chain of the Spring Security tool.
[0009] The client registration component is responsible for implementing client information registration, and its specific functions include but are not limited to:
[0010] 9) Assign client ID and client key to the registered client;
[0011] 10) Apply for the authorization types and methods supported by the client;
[0012] 11) Apply for a scope for the client;
[0013] 12) Set JWT configuration items for the client;
[0014] 13) Add / register client;
[0015] 14) Query client information;
[0016] 15) Update client information;
[0017] 16) Delete the client.
[0018] The client registration component uses the RegisteredClientRepository of the OAuth2 Authorization Server (an authorization server used to implement the OAuth 2.0 protocol) to store and manage registered clients, implement client information persistence and query, ensure that the authorization server can effectively verify the client identity, check the client permissions, and execute the corresponding authorization process according to the client configuration.
[0019] The authentication provider component is used to implement a customized authentication and authorization logic method to form a customized authentication provider, including but not limited to a password authentication provider PasswordAuthenticationProvider, a mobile phone number verification code authentication provider SmsCaptchaAuthenticationProvider and a WeChat mini-program login authentication provider WeChatMiniProgramAuthenticationProvider, and is placed in the filter chain of the Spring Security tool, thereby enabling users to complete authentication and authorization of username and password login, mobile phone number verification code and WeChat mini-program login modes in different clients.
[0020] The mobile phone number verification code authentication includes two modes: graphic verification code and SMS verification code.
[0021] The functions of the authentication provider component include but are not limited to:
[0022] 1) Verify user credentials
[0023] The user credentials include but are not limited to username / password, digital certificate, API key and OAuth 2.0 token, and then execute corresponding verification logic based on the provided user credentials;
[0024] 2) Support multiple credential types including password, mobile phone number verification code and mini-program login
[0025] Implement multiple authentication providers for different credential types, and then automatically select the appropriate authentication provider for processing based on the type of authentication object passed in;
[0026] 3) Support multi-factor authentication
[0027] In complex security scenarios, it supports combining multiple authentication providers (AuthenticationProvider) to verify different types of credentials in turn to achieve multi-factor authentication.
[0028] A method for realizing multi-client authentication and authorization service adopts a client registration component based on the client repository RegisteredClientRepository of OAuth2 AuthorizationServer and an authentication provider component based on AuthenticationProvider to realize multi-client authentication and authorization of users in a distributed environment.
[0029] The following steps are involved:
[0030] Step S1: register and store different clients through the client registration component;
[0031] Step S2: The client registration component effectively verifies the client identity, checks the client permissions, and executes the corresponding authorization process according to the client configuration by persisting and querying the client information;
[0032] Step S3: The authentication provider component executes corresponding verification logic according to the different types of credentials provided;
[0033] Step S4: The authentication provider component automatically selects a suitable authentication provider, quickly implements a customized authentication provider and combines them to verify user credentials, thereby meeting the authentication and authorization requirements in a complex security environment.
[0034] A device for implementing multi-client authentication and authorization services, characterized in that it includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0035] A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and the computer program implements the above method steps when executed by a processor.
[0036] The beneficial effects of the present invention are: the system and method for implementing multi-client authentication and authorization services enable users of an information system in a distributed environment to perform authentication and authorization through different clients, and the authentication and authorization methods of different clients can be freely defined. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Attached Figure 1 A schematic diagram of a method for implementing multi-client authentication and authorization services according to the present invention. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0040] OAuth 2.0 Authorization Server is one of the core roles in the OAuth 2.0 protocol. It is responsible for authenticating client applications, authorizing users, and issuing access tokens for clients to access protected resources. The main responsibilities of OAuth 2.0 Authorization Server include client registration and management, user authorization, access token issuance and management, resource server interaction, security and auditing, etc. OAuth 2.0 Authorization Server is a core component responsible for handling client authentication, user authorization, and access token management. It plays a vital role in ensuring user data security and implementing cross-domain resource access control.
[0041] To implement authentication and authorization for users on multiple clients, you can register different client instances through the OAuth 2.0 Authorization Server, and define different authentication and authorization providers and put them in the filter chain to enable users to have different authentication and authorization methods on different clients.
[0042] The system for implementing multi-client authentication and authorization services includes a client registration component and an authentication provider component;
[0043] The client registration component is based on the client repository RegisteredClientRepository of the OAuth2 Authorization Server, and the user registers information of different clients through the client registration component;
[0044] The authentication provider component is based on AuthenticationProvider, which is responsible for providing each client with the type and logic method of authentication authorization under different authorization types, and placing the authentication provider in the filter chain of the Spring Security tool.
[0045] The client registration component is responsible for implementing client information registration, and its specific functions include but are not limited to:
[0046] 17) Assign client ID and client secret to the registered client;
[0047] 18) Apply for supported authorization types and authorization methods for the client;
[0048] 19) Apply for a scope for the client;
[0049] 20) Set JWT configuration items for the client;
[0050] 21) Add / register client;
[0051] 22) Query client information;
[0052] 23) Update client information;
[0053] 24) Delete the client.
[0054] The client registration component uses the RegisteredClientRepository of the OAuth2 Authorization Server (an authorization server used to implement the OAuth 2.0 protocol) to store and manage registered clients, implement client information persistence and query, ensure that the authorization server can effectively verify the client identity, check the client permissions, and execute the corresponding authorization process according to the client configuration.
[0055] The authentication provider component is used to implement a customized authentication and authorization logic method to form a customized authentication provider, including but not limited to a password authentication provider PasswordAuthenticationProvider, a mobile phone number verification code authentication provider SmsCaptchaAuthenticationProvider and a WeChat mini-program login authentication provider WeChatMiniProgramAuthenticationProvider, and is placed in the filter chain of the Spring Security tool, thereby enabling users to complete authentication and authorization of username and password login, mobile phone number verification code and WeChat mini-program login modes in different clients.
[0056] The mobile phone number verification code authentication includes two modes: graphic verification code and SMS verification code.
[0057] The functions of the authentication provider component include but are not limited to:
[0058] 1) Verify user credentials
[0059] The user credentials include but are not limited to username / password, digital certificate, API key and OAuth 2.0 token, and then execute corresponding verification logic based on the provided user credentials;
[0060] 2) Support multiple credential types including password, mobile phone number verification code and mini-program login
[0061] Implement multiple authentication providers for different credential types, and then automatically select the appropriate authentication provider for processing based on the type of authentication object passed in;
[0062] 3) Support multi-factor authentication
[0063] In complex security scenarios, it supports combining multiple authentication providers (AuthenticationProvider) to verify different types of credentials in turn to achieve multi-factor authentication.
[0064] The method for realizing multi-client authentication and authorization service adopts a client registration component based on the client repository RegisteredClientRepository of OAuth2 Authorization Server and an authentication provider component based on AuthenticationProvider to realize multi-client authentication and authorization of users in a distributed environment.
[0065] The following steps are involved:
[0066] Step S1: register and store different clients through the client registration component;
[0067] Step S2: The client registration component effectively verifies the client identity, checks the client permissions, and executes the corresponding authorization process according to the client configuration by persisting and querying the client information;
[0068] Step S3: The authentication provider component executes corresponding verification logic according to the different types of credentials provided;
[0069] Step S4: The authentication provider component automatically selects a suitable authentication provider, quickly implements a customized authentication provider and combines them to verify user credentials, thereby meeting the authentication and authorization requirements in a complex security environment.
[0070] The device for implementing multi-client authentication and authorization services comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0071] The readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method steps are implemented.
[0072] In summary, compared with the prior art, the system and method for implementing multi-client authentication and authorization services have the following characteristics:
[0073] (1) The client component can quickly store information from different clients.
[0074] (ii) The client component can be used to directly and effectively manage the client (add / delete / update / query).
[0075] (iii) Various types of credentials can be verified through the authentication provider component.
[0076] (iv) The authentication provider component can automatically select the appropriate authentication provider (AuthenticationProvider) to handle credential authentication.
[0077] (V) Through the authentication provider component, you can quickly implement custom authentication providers and combine them to meet the authentication and authorization requirements in complex security environments.
[0078] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A system for implementing multi-client authentication and authorization services, characterized in that: Includes client registration component and authentication provider component; The client registration component is based on the client repository RegisteredClientRepository of the OAuth2 Authorization Server, and the user registers information of different clients through the client registration component; The authentication provider component is based on AuthenticationProvider, which is responsible for providing each client with the type and logic method of authentication authorization under different authorization types, and placing the authentication provider in the filter chain of the Spring Security tool.
2. The system for implementing multi-client authentication and authorization services according to claim 1, characterized in that: The client registration component is responsible for implementing client information registration, and its specific functions include but are not limited to: 1) Assign a client ID and a client secret key to the registered client; 2) Apply for the authorization type and authorization method supported by the client; 3) Apply for a scope for the client; 4) Set JWT configuration items for the client; 5) Add / register client; 6) Query client information; 7) Update client information; 8) Delete the client.
3. The system for implementing multi-client authentication and authorization services according to claim 2, characterized in that: The client registration component uses the RegisteredClientRepository of the OAuth2 Authorization Server to store and manage registered clients, implement client information persistence and query, ensure that the authorization server AuthorizationServer can effectively verify the client identity, check the client permissions, and execute the corresponding authorization process according to the client configuration.
4. The system for implementing multi-client authentication and authorization services according to claim 1, characterized in that: The authentication provider component is used to implement a customized authentication and authorization logic method to form a customized authentication provider, including but not limited to a password authentication provider PasswordAuthenticationProvider, a mobile phone number verification code authentication provider SmsCaptchaAuthenticationProvider and a WeChat mini-program login authentication provider WeChatMiniProgramAuthenticationProvider, and is placed in the filter chain of the Spring Security tool, thereby enabling users to complete authentication and authorization of username and password login, mobile phone number verification code and WeChat mini-program login modes in different clients.
5. The system for implementing multi-client authentication and authorization services according to claim 4, characterized in that: The functions of the authentication provider component include but are not limited to: 1) Verify user credentials The user credentials include but are not limited to username / password, digital certificate, API key and OAuth 2.0 token, and then execute corresponding verification logic based on the provided user credentials; 2) Support multiple credential types including password, mobile phone number verification code and mini-program login Implement multiple authentication providers for different credential types, and then automatically select the appropriate authentication provider for processing based on the type of authentication object passed in; 3) Support multi-factor authentication In complex security scenarios, it supports combining multiple authentication providers to verify different types of credentials in sequence to achieve multi-factor authentication.
6. The system for implementing multi-client authentication and authorization services according to claim 5, characterized in that: The mobile phone number verification code authentication includes two modes: graphic verification code and SMS verification code.
7. A method for implementing multi-client authentication and authorization services, characterized in that: The client registration component based on the client repository RegisteredClientRepository of OAuth2AuthorizationServer and the authentication provider component based on AuthenticationProvider are used to implement multi-client authentication and authorization for users in a distributed environment.
8. The method for implementing multi-client authentication and authorization services according to claim 7, characterized in that: The following steps are involved: Step S1: register and store different clients through the client registration component; Step S2: The client registration component verifies the client identity and checks the client permissions by persisting and querying the client information, and executes the corresponding authorization process according to the client configuration; Step S3: The authentication provider component executes corresponding verification logic according to the different types of credentials provided; Step S4: The authentication provider component automatically selects a suitable authentication provider, implements a customized authentication provider and combines them to verify the user credentials, thereby meeting the authentication and authorization requirements in a complex security environment.
9. A device for implementing multi-client authentication and authorization services, characterized in that: It comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method according to any one of claims 7 to 8 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 7 to 8 is implemented.
