Service authentication method, system and related device
By extending the OAuth2 standard specification and creating a new authorization model, the problem of channel platform systems being unable to interface with SaaS systems was solved, enabling single sign-on and resource access permissions for clients, and improving product integration and user experience.
Patent Information
- Application Number
- CN202311037686.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-17
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2043-08-17
AI Technical Summary
In existing technologies, many channel partners' platform systems cannot interface with SaaS systems, resulting in customers being unable to log in and access SaaS system resources, thus affecting transaction efficiency.
This paper provides a service authentication method that extends the OAuth2 standard specification to create new authorization modes, including enterprise user authorization mode and single sign-on mode. It generates identity tokens using the client's access request parameters to enable resource access permissions between the client and the SaaS system.
This enables clients from different channels and platforms to be embedded into the SaaS system regardless of whether they have authentication capabilities, improving product integration and user experience while ensuring resource access permissions.
Smart Images

Figure CN116886428B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to service authentication methods, systems and related equipment. Background Technology
[0002] Software as a Service (SaaS) is a software delivery model that delivers software over the Internet. Vendors deploy application software on their own servers, and customers can order the application software services they need from the vendor via the Internet, paying fees based on the amount and duration of the ordered services, and obtaining the resources and services provided by the vendor through the Internet.
[0003] However, currently, many channel partners' platform systems cannot interface with SaaS systems, preventing their customers from logging into and accessing SaaS system resources, thus impacting transaction efficiency. Therefore, it is necessary to provide an effective solution. Summary of the Invention
[0004] This application provides service authentication methods, systems, and related equipment to meet the needs of clients from different channel platforms accessing SaaS system resources.
[0005] The first aspect of this application provides a service authentication method, including:
[0006] Enable the created authorization mode, which is implemented by inheriting from a class named TokenGranter;
[0007] According to the operating logic defined by the authorization mode, the current user information is obtained based on the access request parameters sent by the client;
[0008] Based on the access request parameters and the user information, an identity token is generated for the client, so that the client can obtain resource access permissions provided by the SaaS system through the connected channel when the token is verified as a valid token.
[0009] The method described in the first aspect of this application may be implemented using the content described in the second aspect of this application.
[0010] A second aspect of this application provides a service authentication system, including a processing unit, the processing unit being used for:
[0011] Enable the created authorization mode, which is implemented by inheriting from a class named TokenGranter;
[0012] According to the operating logic defined by the authorization mode, the current user information is obtained based on the access request parameters sent by the client;
[0013] Based on the access request parameters and the user information, an identity token is generated for the client, so that if the token is verified as a valid token, the client can obtain resource access permissions provided by the SaaS system through the connected channel.
[0014] A third aspect of this application provides an electronic device, including:
[0015] Central processing unit, memory, and input / output interfaces;
[0016] The memory is either a short-term storage memory or a persistent storage memory;
[0017] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method described in the first aspect of the embodiments of this application or any specific implementation thereof.
[0018] A fourth aspect of this application provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the method described in the first aspect of this application or any specific implementation thereof.
[0019] The fifth aspect of this application provides a computer program product comprising instructions or a computer program, which, when run on a computer, causes the computer to perform the method described in the first aspect of this application or any specific implementation thereof.
[0020] As can be seen from the above technical solutions, the embodiments of this application have at least the following advantages:
[0021] The authorization mode logic created through this application can obtain the current user information of the client, enabling all channel partners that interface with the client to embed the SaaS system, regardless of whether they have authentication capabilities. This allows each channel partner to access the SaaS system with single sign-on, thereby ensuring that the client can obtain resource access permissions to the SaaS system, improving the product integration effect between multiple parties, and enhancing the user experience. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0023] It should be noted that although the steps in the flowcharts (if any) involved in the embodiments are drawn sequentially according to the arrows, unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts involved in the embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0024] Figures 1 to 3 A flowchart illustrating the service authentication method for embodiments of this application;
[0025] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0027] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] In the following description, expressions such as "one specific implementation" or "one specific example" describe a subset of all possible embodiments. However, it is understood that "one specific implementation" or "one specific example" can be the same or different subset of all possible embodiments and can be combined with each other without conflict. In the following description, the term "multiple" means at least two. When a certain value mentioned in this application reaches a threshold (if it exists), in some specific examples, it may include the former being greater than the latter. When "any" or "at least one" or similar expressions are mentioned, it specifically refers to any one of the listed examples or any combination of these examples.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0030] The method described in this application will be further explained in detail below.
[0031] Please see Figures 1 to 3 The first aspect of this application provides a specific embodiment of a service authentication method, which includes the following operational steps:
[0032] 11. Enable the created authorization mode.
[0033] The spring-security-oauth2 protocol framework implements four classic OAuth2 modes: authorization code, password, client credentials, and implicit. However, these four classic modes do not support login authentication for systems such as WeChat Work, DingTalk, Lark, Yunzhijia, or internal enterprise OA systems (which can be installed on or connected to external clients). Platforms like WeChat Work, DingTalk, and Lark are mainstream third-party platforms, while internal enterprise OA systems are internal channels (generally lacking authentication capabilities). Furthermore, different systems support different authentication methods, which presents certain limitations. Using OAuth2 authentication technology in SaaS systems only supplements authentication capabilities; it cannot be directly used by third-party channels or internal enterprise systems. Therefore, a new authentication mode needs to be extended based on the OAuth2 standard specification. In the embodiments of this application, this new authentication mode supports querying user information (UserInfo or UserDetails) through access request parameters such as external user identifiers (i.e., open_user_id) or channel authorization codes, so that user-level tokens issued by the authentication center can be obtained from the user information; then, the client can request authentication from the SaaS system (e.g., Figures 2 to 3 The resource service provider (as shown) initiates an access request carrying the token, and after the token is verified as a valid token, it obtains the resource data returned by the SaaS system, thereby enabling mutual access between the SaaS system and the channel provider's system and improving service integration capabilities.
[0034] Specifically, the authorization mode of this application can be implemented by inheriting a class named TokenGranter, such as by inheriting the underlying abstract class AbstractTokenGranter to implement classes EnterpriseUserImplicitTokenGranter and SsoTokenGranter, to extend two new modes: enterprise user (enterprise_user_implicit) authorization mode and single sign-on (sso_code) mode. Customization and extension to implement the methods of class EnterpriseUserImplicit TokenGranter and class SsoTokenGranter can include calling the getDefaultTokenGranters method and the setTokenGranter method of the TokenGranter interface. Class analysis reveals the hierarchical structure of the entire implementation class relationship.
[0035] 12. The operation logic is limited by the authorization mode, and the current user information is obtained according to the access request parameters sent by the client.
[0036] (I) The following will explain the authorization mode for enterprise users (enterprise_user_implicit).
[0037] The main application scenario for the enterprise user authorization mode is when the enterprise (i.e., the client) does not have an authentication system or available authentication capabilities. Therefore, in some specific examples, to solve the problem that the channel party's system cannot connect to the SaaS system to achieve login access, when the channel party does not have authentication capabilities, step 12 may include: querying the current user information that is synchronously stored in the SaaS system based on the external user identifier open_user_id corresponding to the access request parameters; wherein, the access request parameters include the client identifier client_id and the client key client_secret, and the user information includes the user identifier and / or the user's contact number.
[0038] like Figure 2 As shown, for channel-side systems without authentication capabilities (which can be categorized as client-side systems), to achieve embedded single-point redirection to the SaaS system, enterprise users can synchronize personnel data to the SaaS system. This includes storing user identifiers (such as employee IDs) and / or user contact numbers (such as email addresses or mobile phone numbers). This user information can be indexed through an external userId (i.e., open_user_id) bound to it. The current user information can be used by an independent authentication center to generate a token, which can be carried to request access to the SaaS system (i.e.,... Figure 2 (Resource services). In short, the basis for obtaining user information in the enterprise user authorization mode is client_id + the key issued to the client, client_secret + external personnel information, open_user_id (equivalent to credential code).
[0039] The access address parameters for the above enterprise user authorization mode are shown in the following example:
[0040] http: / / localhost:8080 / oauth / token?
[0041] client_id=C20210823817470669KRWN
[0042] &client_secret=NToGirhIupOk7DYLZTlV44qZEzya5sNjTNAXFuUMuP6Ur9TDZ0g1UZYAI6DH4hR8ist8NTKvgGX2EKEfeSwkzpKZiuTqqG0vfu8En7I454w4Rzsp4ISymWqyGumNt38I
[0043] &grant_type=enterprise_user_implicit
[0044] &scope=all
[0045] &open_user_id=CbfrnPZ6JRCMFaHF1
[0046] &device_type=app
[0047] As explained above, the core implementation class of the enterprise user authorization mode in this application is `EnterpriseUserImplicitTokenGranter`, with an authorization type (grant_type) of `enterprise_user_implicit`. The authorization logic is as follows: Based on the `clientId`, `client_secret`, and the corresponding `open_user_id` fields in the request parameters, the current user information is queried. An authorization token object corresponding to the client (specifically, the current user operating the client) is generated from this current user information, allowing the client to hold this token to request and obtain resource services from the SaaS system. This authorization logic may also include verifying whether the current client supports the enterprise user authorization mode. This verification mainly checks whether the corresponding client information has been configured, i.e., whether permissions for the interfacing party (usually an internal enterprise system) have been granted.
[0048] (II) The following will explain the single sign-on (sso_code) mode.
[0049] The primary application scenario for Single Sign-On (SSO) is when a channel platform with authentication capabilities pre-integrates with a SaaS system. This channel platform includes, but is not limited to, WeChat Work, DingTalk, Lark, Yunzhijia, enterprise OA systems, enterprise financial shared service center platforms, and external partner channel platforms. Therefore, in some specific examples, when the channel has authentication capabilities, it retrieves the current user information based on the access request parameters sent by the client. This includes: retrieving the current user information based on the client information, support type (support_type), and channel authorization code (code) contained in the access request parameters; where support_type indicates the category of the channel that supports client integration, such as liuxi or qy_weixin.
[0050] like Figure 3 As shown, when facing a third-party channel system with authentication capabilities, different channel parameters can be obtained through a unified authorization interface to obtain the corresponding user-level token information, and then a request can be made to access the SaaS system carrying the token. Specifically, the access address parameters for the single sign-on mode can be exemplified as follows:
[0051] http: / / localhost:8080 / oauth / token?
[0052] client_id=C20210387090644EYXA2C
[0053] &client_secret=5q0wtzLkgMwN65GaikYc2Um9tSTptYUQ1eGWER9xrDA ZuI0u90WsWpGxv11plZoUH02Qwzwjn0hf4jq3BTIDYwTlybZUZzj4TnAxN2W10eBYusEVv0qY7d4aW415vFyI
[0054] &grant_type = sso_code
[0055] &scope=all
[0056] &support_type=qy_weixin
[0057] &code=123456
[0058] &device_type=app
[0059] The `support_type` field supports third-party channel types, such as `liuxi`, `qy_weixin`, `dingtalk`, `feishu`, and `cloudhome`. Simply add the corresponding type to the `support_type` field and implement the logic to support multiple channels. The value of the `code` field varies depending on the specific channel being integrated, and its specific definition depends on the logic implementation.
[0060] As explained above, the core implementation class of the single sign-on mode is SsoTokenGranter, and the authorization type (grant_type) is sso_code. The authorization logic is as follows: based on the support_type (the channel type supported by SSO) field in the request parameters, the corresponding channel user information query interface implementation class is obtained; based on the client_id, client_secret, support_type, and channel authorization code in the request parameters, the loadUserDetails method is called to query the current user information; and then, an authorization token object is generated based on this user information.
[0061] The user information query interface class for single sign-on channels is SsoUserDetailsService. In addition to the aforementioned loadUserDetails (query user information) method, it also provides the getSsoThirdType (get the current SSO channel type). In other words, different channel platforms have different implementations of SsoUserDetailsService, meaning the logic for retrieving user information can differ. The main differences lie in the implementation logic of the loadUserDetails and getUserInfo methods (which can be considered as getSsoThirdType). Below, we will use QyWeixinSsoUserDetailsService (the enterprise WeChat SSO user information query service class) as an example to first explain the main flow of the loadUserDetails logic in the SSO user information query interface:
[0062] 1) Obtain the authorization code from the tokenRequest (request information);
[0063] 2) Use the clientId and authorization code information to call getUserInfo to query enterprise WeChat user information;
[0064] 3) Obtain the current user information based on the SaaS system user ID bound to the enterprise WeChat user information.
[0065] The difference lies in the logic flow of the getUserInfo method, which is as follows (using Enterprise WeChat as an example of a third-party channel system):
[0066] 1) Verify that the client information corresponding to the clientId (equivalent to code) exists;
[0067] 2) Obtain the corresponding systemId (SaaS system identifier) from the client information, and obtain the Enterprise Micro third-party application ticket information, which may include third-party channel type information;
[0068] 3) Query the authorized access_token information based on the WeChat Pay ticket information;
[0069] 4) Query the current user information of Enterprise WeChat based on the access_token and code information;
[0070] The `loadUserDetails` method described above retrieves the corresponding third-party user information based on the third-party channel authorization code (`code`). It then queries and returns the OAuth2 authentication system user information based on the association identifier between the third-party user information and the user information in the OAuth2 authentication system. The upper-level calling logic generates an authorization token based on the user information. The `getSsoThirdType` method identifies the supported third-party channel types, such as those integrated with WeChat Work, DingTalk, and Lark. Different types have different logic implementations. For third-party channel code authentication, the corresponding authentication method needs to be called for correct parsing and authentication.
[0071] When the getUserInfo method is called, this embodiment of the application may further include the following process: verifying whether the current user is accessing the SaaS system for the first time, and popping up a login interface when the verification result is the first time; until the current user successfully logs in, establishing a binding relationship between client information and current user information, so that the current user information can be retrieved in a related manner from the client information. Therefore, the above logical flow of the getUserInfo method also includes process 5):
[0072] 5) Verify whether it's the first login and query whether the current user is bound to the corresponding SaaS user information based on the WeChat Work user information. The code serves as the bindkey to return the WeChat Work user information in a relevant manner. This first login verification determines whether the current user is accessing the SaaS system for the first time via single sign-on. If it is, an account and password input is required for login verification and binding (similar to the authorization confirmation process in a mini-program), thereby establishing a relationship between information and ensuring data security and matching.
[0073] It's important to note that Single Sign-On (SSO) can be understood as a combination of the classic third-party authorization code and client-side authentication. This allows the OAuth2 authentication system to support both its own authorization code authentication and third-party system authorization code authentication. With this capability, SaaS systems can be embedded into any third-party channel platform or internal enterprise system with authentication capabilities, resolving authentication differences between different channel platforms. Specifically, SSO (sso_code) is similar to OAuth2 authorization code, but different because the authorization code in OAuth2 comes from its own OAuth2 authentication system. In contrast, the authorization code in SSO comes from a third-party channel platform or internal enterprise authentication system (i.e., it's a third-party code). Therefore, by combining client-side authentication with channel authentication on top of the authorization code, a new authentication mode (sso_code) is formed, allowing the SaaS system's authorization token to be obtained by authenticating the third-party system's authorization code. In short, the SSO mode in this application uses your code to obtain my token, while the original authorization code mode only allows using my code to obtain my token.
[0074] 13. Generate an identity token for the client to gain access to resources of the SaaS system.
[0075] Based on the access request parameters and user information, an identity token is generated for the client, so that the client can obtain access to the resources provided by the SaaS system through the connected channel when the token is verified as a valid token.
[0076] In some specific examples, the single sign-on mode of this application can generate a unified identity token for different clients, so that SaaS resource providers can obtain a unified token instead of different tokens for multiple clients. This means that unified authentication can be performed even when facing different third-party channels, thereby reducing the difficulty of identifying each token and the access latency.
[0077] In summary, the authorization mode logic created through this application can obtain the current user information of the client, enabling all channel partners interfacing with the client to embed the SaaS system regardless of their authentication capabilities. This allows each channel partner to access the SaaS system via single sign-on, ensuring that the client can obtain resource access permissions to the SaaS system and improving product integration between multiple parties. Specifically, the technical implementation content of this application embodiment includes:
[0078] 1. Based on spring-security-oauth2, it extends the four OAuth2 modes by adding an enterprise user (enterprise_user_implicit) authorization mode and a single sign-on (sso_code) authorization mode.
[0079] 2. Extend the native authorization information retrieval interface ( / oauth / token) to enable the grant_type field to support enterprise_user_implicit, add the open_user_id parameter, and support third-party user IDs to obtain tokens.
[0080] 3. Extend the native authorization information acquisition interface ( / oauth / token) to enable the grant_type field to support the sso_code authorization mode. Add support_type and code parameters, where support_type is the supported channel platform type and code is the platform authorization code of the channel.
[0081] 4. The embedded access of the channel platform system uniformly uses / oauth / token to obtain authorization information. Based on the request parameters of different channel platforms, it obtains the corresponding platform user token authorization information and carries the token information to access the SaaS system.
[0082] In some specific examples, the method of this application embodiment may further include: if the token is verified as an invalid token, retry executing the running logic limited by the authorization mode, step 12 of obtaining the current user information according to the access request parameters sent by the client, or, indicating that the access request has failed to be authenticated.
[0083] In summary, this application's embodiments have been customized and extended based on the classic model, with code rewritten to add an enterprise user authorization (enterprise_user_implicit) mode and a single sign-on (SSO_code) mode. Both of these new authorization and authentication modes support the generation and issuance of user-level tokens. The tokens held by different channel partners can be identical, allowing the SaaS system or independent authentication center to easily and uniformly verify token validity, thereby reducing resource congestion and response latency. Furthermore, these two new authorization and authentication modes provide a single sign-on authentication interface and support integration with different channel platform systems' single sign-on interfaces. This enables single sign-on access to the SaaS system platform regardless of whether the third-party channel platform system has authentication functionality, ensuring the SaaS system can be embedded into third-party systems and improving product integration and competitiveness. Therefore, this application can meet the single sign-on access requirements of different enterprise customers (multi-channel) for SaaS systems, and offers richer access methods.
[0084] In practical applications, the specific implementation examples provided above can be implemented as needed, based on the corresponding functional principles and application logic.
[0085] A second aspect of this application provides a specific example of a service authentication system, the system including a processing unit, the processing unit being used for:
[0086] Enable the created authorization mode, which is implemented by inheriting from a class named TokenGranter;
[0087] Based on the operation logic defined by the authorization mode, the current user information is obtained according to the access request parameters sent by the client.
[0088] Based on the access request parameters and user information, an identity token is generated for the client, so that the client can obtain access to the resources provided by the SaaS system through the connected channel when the token is verified as a valid token.
[0089] Optionally, when the channel provider lacks authentication capabilities, the processing unit is specifically used for:
[0090] Based on the external user identifier open_user_id corresponding to the access request parameters, retrieve the current user information that is synchronously stored in the SaaS system;
[0091] The access request parameters include the client identifier (client_id) and the client secret (client_secret), and the user information includes the user identifier and / or the user's contact number.
[0092] Optionally, when the channel provider has authentication capabilities, the processing unit is specifically used for:
[0093] Based on the client information, support type (support_type), and channel authorization code (code) contained in the access request parameters, retrieve the current user information;
[0094] Here, support_type indicates the category of the channel partner that supports client integration.
[0095] Optionally, the processing unit is also used for:
[0096] Verify whether the current user is accessing the SaaS system for the first time, and pop up the login interface if the verification result indicates that it is the first time.
[0097] Only after the current user successfully logs in will a binding relationship be established between the client information and the current user information.
[0098] Optionally, the processing unit is specifically used for:
[0099] Call the loadUserDetails and / or getUserInfo methods.
[0100] Optionally, the processing unit is specifically used for:
[0101] Generate a unified identity token for different clients.
[0102] Optionally, the processing unit is also used for:
[0103] If the token is found to be invalid, retry the execution logic limited by the authorization mode, and proceed with the step of obtaining the current user information based on the access request parameters sent by the client, or indicate that the access request authentication failed.
[0104] In this embodiment, the operations performed by each unit of the service authentication system are similar to those described in the first aspect or any specific method embodiment of the first aspect, and will not be repeated here. Of course, the specific implementation process of each operation in the first aspect of this application can also be found in the relevant description of the second aspect.
[0105] Please see Figure 4 The electronic device 400 in this application embodiment may include one or more central processing units (CPUs) 401 and a memory 405, wherein the memory 405 stores one or more applications or data.
[0106] The memory 405 can be volatile or persistent storage. The program stored in the memory 405 can include one or more modules, each module including a series of instruction operations on the electronic device. Furthermore, the central processing unit 401 can be configured to communicate with the memory 405 and execute the series of instruction operations stored in the memory 405 on the electronic device 400.
[0107] Electronic device 400 may also include one or more power supplies 402, one or more wired or wireless network interfaces 403, one or more input / output interfaces 404, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0108] The central processing unit 401 can perform the operations performed by the first aspect or any specific method embodiment of the first aspect, which will not be described in detail here.
[0109] This application provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the method as described in the first aspect or any specific implementation thereof.
[0110] This application provides a computer program product containing instructions or computer programs, which, when run on a computer, causes the computer to perform the method described in the first aspect or any specific implementation thereof.
[0111] It is understood that, in the various embodiments of this application, the sequence number of each step does not imply the order of execution. The execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0112] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system (if it exists) and device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0113] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system or apparatus, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0114] The units described as separate components may or may not be physically separate. 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 units can be selected to achieve the purpose of this embodiment according to actual needs.
[0115] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0116] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it 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 all or part of the technical solution, can be embodied in the form of a software product. This computer software product (computer program product) is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a business server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A service authentication method, characterized in that, include: Enable the created authorization mode, which is implemented by inheriting from a class named TokenGranter; According to the operating logic defined by the authorization mode, the current user information is obtained based on the access request parameters sent by the client; When the channel provider has authentication capabilities, obtaining the current user information based on the access request parameters sent by the client includes: retrieving the current user information based on the client information, support type (support_type), and channel provider authorization code (code) contained in the access request parameters; wherein, support_type indicates the category to which the channel provider supports connecting to the client belongs; When the channel provider does not have authentication capabilities, obtaining the current user information based on the access request parameters sent by the client includes: querying the current user information that is synchronously stored in the SaaS system based on the external user identifier open_user_id corresponding to the access request parameters; wherein, the access request parameters include the client identifier client_id and the client secret, and the current user information includes the user identifier and / or the user contact number; Based on the access request parameters and the current user information, an identity token is generated for the client, so that if the token is verified as a valid token, the client can obtain resource access permissions provided by the SaaS system through the connected channel.
2. The service authentication method according to claim 1, characterized in that, Before retrieving the current user information based on the client information, support type (support_type), and channel authorization code contained in the access request parameters, the method further includes: Verify whether the current user is accessing the SaaS system for the first time, and pop up a login interface if the verification result is that it is the first time; The binding relationship between the client information and the current user information is established only after the current user successfully logs in.
3. The service authentication method according to claim 1, characterized in that, The process of obtaining the current user information includes calling the loadUserDetails and / or getUserInfo methods.
4. The service authentication method according to claim 1, characterized in that, Generating an identity token for the client includes: Generate a unified identity token for different clients.
5. The service authentication method according to claim 1, characterized in that, The method further includes: If the token is verified as invalid, the execution of the operation logic limited by the authorization mode will be retried, including the step of obtaining the current user information based on the access request parameters sent by the client, or the access request will be prompted that the authentication failed.
6. A service authentication system, characterized in that, Includes a processing unit, the processing unit being used for: Enable the created authorization mode, which is implemented by inheriting from a class named TokenGranter; According to the operating logic defined by the authorization mode, the current user information is obtained based on the access request parameters sent by the client; When the channel provider has authentication capabilities, obtaining the current user information based on the access request parameters sent by the client includes: retrieving the current user information based on the client information, support type (support_type), and channel provider authorization code (code) contained in the access request parameters; wherein, support_type indicates the category to which the channel provider supports connecting to the client belongs; When the channel provider does not have authentication capabilities, obtaining the current user information based on the access request parameters sent by the client includes: querying the current user information that is synchronously stored in the SaaS system based on the external user identifier open_user_id corresponding to the access request parameters; wherein, the access request parameters include the client identifier client_id and the client secret, and the current user information includes the user identifier and / or the user contact number; Based on the access request parameters and the current user information, an identity token is generated for the client, so that if the token is verified as a valid token, the client can obtain resource access permissions provided by the SaaS system through the connected channel.
7. An electronic device, characterized in that, include: Central processing unit, memory, and input / output interfaces; The memory is either a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, Includes instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Financial reconciliation service implementation method based on SaaS mode
CN111901404A
Integrated authorization system and method thereof
CN115396205A
