A method, apparatus and related equipment for authentication processing across business systems.

By unifying the management of the token acquisition interface and cache at the agent service layer, the problem of improper token management in cross-business subsystem calls is solved, achieving efficient and reliable cross-system authentication processing and reducing the overhead of duplicate authentication.

CN123122960APending Publication Date: 2026-11-17AISINO CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611416651.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-11
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In enterprise-level SaaS platforms, when intelligent agents make calls across business subsystems, existing authentication processing methods suffer from problems such as coupled authentication logic, redundant implementation, and improper token management, making it difficult to adapt to the differences in authentication protocols among different business subsystems.

Method used

A unified Token acquisition interface is set up in the intelligent agent service layer. The Token cache and cache key construction rules of the target business subsystem are determined by the instruction information. The Token cache of each business subsystem is managed independently, and the Token is queried or authentication is initiated in the cache to achieve isolated storage and unified acquisition of Token.

Benefits of technology

It reduces network interaction and processing overhead, improves the speed and reliability of cross-business system calls, avoids token misuse and overwriting, and supports cross-system calls without needing to know the underlying authentication details.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123122960A_ABST
    Figure CN123122960A_ABST
Patent Text Reader

Abstract

This application discloses a cross-business system authentication processing method, apparatus, and related equipment, applied to an agent service layer located between an AI agent and at least two business subsystems. The method receives a token acquisition request through a unified token acquisition interface. This request carries a session identifier of the current business session and indication information for the target business subsystem. Based on this indication information, it determines the token cache and cache key construction rules corresponding to the target business subsystem. The token caches corresponding to the first and second business subsystems are independent of each other, and their cache key construction rules are different. A target cache key is constructed according to the determined cache key construction rules and based on the session identifier, and then used to query the determined token cache. If a valid token exists, it returns; otherwise, authentication is initiated according to the authentication method adopted by the target business subsystem, and the obtained token is associated with and written into the token cache before returning. This method masks the authentication differences between business subsystems, achieving isolated management and reuse of tokens.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer information processing and artificial intelligence technology, and in particular to an authentication processing method, apparatus and related equipment for cross-business systems. Background Technology

[0002] With the development of large language models and artificial intelligence agent technologies, the processing method of driving business operations with natural language commands is gradually being applied to enterprise-level Software as a Service (SaaS) platforms. In such platforms, artificial intelligence agents (hereinafter referred to as agents) select and invoke corresponding business tools based on the natural language commands input by the user, and the business tools access the corresponding business subsystems to complete the business operations.

[0003] Enterprise-level SaaS platforms typically consist of multiple independently built business subsystems. These subsystems are often developed by different teams at different times and each has its own independent user system and authentication mechanism. Therefore, when an agent performs business operations across subsystems, it needs to obtain authentication credentials (hereinafter referred to as Tokens) recognized by the corresponding subsystem before it can call its business interfaces.

[0004] In existing technologies, there are two main ways to handle authentication across business systems: one is for each business tool to handle the authentication process of the business subsystems it calls, that is, each business tool constructs an authentication request, parses the authentication response and saves the obtained token; the other is to set up a unified single sign-on authentication module, which performs unified authentication for multiple business subsystems, and all business subsystems share the same token.

[0005] However, both of the above approaches have shortcomings when applied to agent-driven cross-business system invocation scenarios. The former approach couples business tools with the specific authentication process; the more business tools there are, the more authentication logic needs to be repeatedly implemented and maintained. When a new business subsystem is integrated, the invocation method on the agent side also needs to be modified synchronously. The latter approach relies on the premise that all business subsystems use the same authentication protocol, making it difficult to apply to situations where the authentication protocols and parameter structures of different business subsystems differ. Furthermore, the indiscriminate unified management of tokens across business subsystems can easily lead to token misuse.

[0006] Therefore, how to enable intelligent agents to reliably complete business calls across business subsystems without needing to be aware of the underlying authentication details, when the authentication mechanisms of each business subsystem are different, has become an important problem that urgently needs to be solved in the industry. Summary of the Invention

[0007] In view of this, embodiments of this application provide a cross-business system authentication processing method, apparatus, and related equipment to at least partially solve the above-mentioned problems.

[0008] In a first aspect, embodiments of this application provide a cross-business system authentication processing method applied to an intelligent agent service layer. The intelligent agent service layer is positioned between an artificial intelligence agent and at least two business subsystems. The at least two business subsystems include a first business subsystem and a second business subsystem, and the authentication method used by the second business subsystem differs from that used by the first business subsystem. The method includes: The token acquisition request is received through the unified token acquisition interface. The token acquisition request carries the session identifier of the current business session and the indication information for indicating the target business subsystem. The target business subsystem is one of the at least two business subsystems. Based on the instruction information, determine the Token cache and cache key construction rules corresponding to the target business subsystem; wherein, the Token cache corresponding to the first business subsystem and the Token cache corresponding to the second business subsystem are independent of each other, and the cache key construction rules corresponding to the first business subsystem and the cache key construction rules corresponding to the second business subsystem are different; According to the determined cache key construction rules, construct the target cache key based on the session identifier, and query the determined token cache using the target cache key; If a valid token corresponding to the target cache key exists in the determined token cache, return the valid token; If no valid token corresponding to the target cache key exists in the determined token cache, authentication is initiated to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem, the token returned by the target business subsystem is obtained, the token is associated with the target cache key and written into the determined token cache, and the token is returned.

[0009] Secondly, based on the cross-business system authentication processing method described in the first aspect of this application, embodiments of this application also provide a cross-business system authentication processing apparatus, applied to an intelligent agent service layer. The intelligent agent service layer is disposed between an artificial intelligence agent and at least two business subsystems. The at least two business subsystems include a first business subsystem and a second business subsystem, and the authentication method used by the second business subsystem is different from the authentication method used by the first business subsystem. The apparatus includes: The request receiving module is used to receive a token acquisition request through the unified token acquisition interface. The token acquisition request carries the session identifier of the current business session and indication information for indicating the target business subsystem. The configuration determination module is used to determine the Token cache and cache key construction rules corresponding to the target business subsystem according to the indication information; wherein, the Token cache corresponding to the first business subsystem and the Token cache corresponding to the second business subsystem are independent of each other, and the cache key construction rules corresponding to the first business subsystem and the cache key construction rules corresponding to the second business subsystem are different; The cache query module is used to construct a target cache key based on the session identifier according to the determined cache key construction rules, and query the determined token cache using the target cache key; The authentication processing module is used to initiate authentication to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem when there is no valid token corresponding to the target cache key in the determined token cache, obtain the token returned by the target business subsystem, and associate the token with the target cache key and write it into the determined token cache. The Token return module is used to return the valid Token when a valid Token corresponding to the target cache Key exists in the determined Token cache, and to return the Token after the authentication processing module obtains the Token.

[0010] Thirdly, embodiments of this application also provide a computer storage medium storing computer-executable instructions, which, when executed, perform any of the cross-business system authentication processing methods described in the first aspect of embodiments of this application.

[0011] Fourthly, embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any of the cross-business system authentication processing methods described in the first aspect of embodiments of this application.

[0012] This application provides a cross-business system authentication processing method, apparatus, and related equipment. By setting a unified Token acquisition interface at the agent service layer between the AI ​​agent and multiple business subsystems, and subsequently determining the Token cache and cache key construction rules corresponding to the target business subsystem according to the indication information in the Token acquisition request, the differences in authentication protocols and parameter structures among the various business subsystems are converged within the agent service layer. This eliminates the need for the AI ​​agent to be aware of the underlying authentication details or to change its existing calling methods when accessing new business subsystems. Simultaneously, by establishing independent Token caches for different business subsystems and ensuring that the cache key construction rules for each subsystem are different, the various business subsystems... The tokens can be stored separately according to their own authentication semantics, which avoids interference or misuse of tokens from different business subsystems due to unified management. It also ensures that multiple tokens that may exist within the same business subsystem in the same session are stored in different cache entries, preventing token overwriting and cross-use. Furthermore, by first querying the determined token cache with the target cache key, and only initiating authentication with the target business subsystem if no valid token is found, multiple business calls within the cache validity period of the same business session only require one actual authentication process. This significantly reduces the network interaction and processing overhead caused by duplicate authentication, improving the response speed and reliability of cross-business system calls by the agent. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0014] Figure 1 A schematic diagram illustrating the workflow of a cross-business system authentication processing method provided in this application embodiment; Figure 2 A schematic diagram illustrating the workflow of another cross-business system authentication processing method provided in this application embodiment; Figure 3 A schematic diagram of a data structure for an agent login context and a dual-Token isolated cache provided in an embodiment of this application; Figure 4 An exemplary workflow diagram of an authentication processing method across business systems provided in this application embodiment; Figure 5A schematic diagram of the structure of an authentication processing device for cross-business systems provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0015] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.

[0016] It should be understood that the steps described in the method embodiments of this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.

[0017] Example 1 To facilitate understanding of the methods described in the embodiments of this application, an exemplary application environment for the methods described in the embodiments of this application is first described below. It should be specifically noted that the following descriptions of the components and their interrelationships are merely examples provided for the purpose of illustrating the methods described in the embodiments of this application, and are not necessary conditions for implementing the methods described in the embodiments of this application. The methods described in the embodiments of this application can be implemented in systems with different deployment forms and different module division methods. For example, the components in the intelligent agent service layer can be deployed on the same physical device or distributed across multiple physical devices; the authentication proxy module described below can be implemented as an independent service process or as a functional component running within a business service process; the distributed cache module described below can be implemented using an independently deployed cache service or using local storage, a database, or any other storage method capable of accessing data by session identifier. All of the above implementation methods do not affect the implementation of the methods described in the embodiments of this application, and the embodiments of this application do not impose any limitations on them. In an exemplary application environment, the AI ​​agent, the agent service layer, the distributed cache module, and at least two business subsystems communicate through a standard protocol. The AI ​​agent does not directly access the business logic of the business subsystems or the data in the distributed cache module, but rather performs unified scheduling through the agent service layer.

[0018] In this embodiment, the AI ​​agent (hereinafter referred to as the agent) serves as the entry point for users to initiate business requests. It can consist of a large language model inference engine and a Model Context Protocol (MCP) client, used to convert natural language commands issued by the user through the dialogue interface into structured call requests to specific business tools, and to convert the execution results returned by the business tools into natural language responses to the user. The MCP is a standardized protocol for communication between the agent and the tool server. It can use a Server-Sent Events (SSE) transmission mode to achieve real-time message push from the server to the agent. Specifically, the agent subscribes to the server's message channel via SSE and sends tool call requests to the server using the POST method of the Hypertext Transfer Protocol (HTTP). It should be noted that in this embodiment, the agent itself is unaware of the underlying authentication mechanism and does not directly hold any tokens from any business subsystem. All authentication-related operations are delegated to the agent service layer. This design allows the agent to focus on natural language understanding and business logic orchestration without needing to worry about the differences in authentication protocols among various business subsystems or the lifecycle management of tokens. In multi-node deployment scenarios, load balancers can be configured with sticky sessions. Sticky sessions refer to a load balancing configuration method that always routes connections of the same business session to the same service node, ensuring that SSE connections of the same business session will not migrate between multiple service nodes and avoiding message loss caused by SSE connection disconnection.

[0019] In this embodiment, a Token refers to an authentication credential issued by the business subsystem to the caller after successful authentication, used to prove the caller's identity and permissions in subsequent business interface calls. It typically has a certain validity period and needs to be submitted along with the request via request headers when making a business interface call. A business session refers to a continuous dialogue process between an agent and a user. A session identifier is a string used to uniquely identify the business session. It is generated by the agent when creating a business session and can include a fixed prefix and a globally unique identifier to ensure that session identifiers for different business sessions are not duplicated.

[0020] The intelligent agent service layer is used to accept invocation requests from intelligent agents and is responsible for obtaining tokens and invoking business interfaces. In an optional implementation of this application embodiment, the intelligent agent service layer may include a business tool group and an authentication proxy module, and may further include an encryption authentication module. It should be noted that the business tool group, authentication proxy module, and encryption authentication module here are logical units divided according to function. In implementation, they can be implemented by independent program modules or merged into the same program module. This application embodiment does not limit their specific division method and deployment location.

[0021] The business toolkit consists of multiple business tools. Each tool is declared as an invokable tool and registered with the MCP server through a tool registration mechanism, allowing agents to choose and invoke it during dialogue. The business toolkit acts as a bridge between the agent and the authentication proxy module; that is, the agent does not directly call the authentication proxy module, but indirectly uses the Token acquisition service provided by the authentication proxy module by calling the business tools. Before executing a business operation, each business tool first requests the Token of the corresponding business subsystem from the authentication proxy module. After obtaining the Token, it is attached to the business interface call request, and then the business interface of the corresponding business subsystem is called. This indirect calling design decouples the Token acquisition logic from the business logic. The business tool only needs to focus on the calling method and parameter construction of the business interface, while the acquisition, caching, and refreshing of the Token are handled transparently by the authentication proxy module.

[0022] The authentication proxy module handles tasks such as receiving token acquisition requests, cache querying, authentication initiation, account set switching, and cache writing. It exposes two types of interfaces: token acquisition and cache clearing. The token acquisition interface is the unified token acquisition interface described in this embodiment. In an optional implementation of this embodiment, the authentication proxy module may include a cache-first loading engine, a first token cache, a second token cache, a target account set parser, and an account set switching executor. The cache-first loading engine is the core scheduler of the authentication proxy module, used to uniformly execute the strategy logic of "checking the cache first, and loading only if no valid token is found." This engine receives a token cache instance and a token loading function as parameters. It first queries the token cache using the cache key. If a valid token exists, it directly returns that valid token. If no valid token exists, it calls the token loading function to obtain a new token, writes it to the token cache, and then returns. This unified loading mode allows the token acquisition logic for different business subsystems to share the same cache scheduling framework. The only differences are the token cache instance, cache key construction rules, and token loading function passed in. This accommodates the differences in authentication methods among various business subsystems while maintaining a unified token acquisition interface.

[0023] In this embodiment of the application, the authentication proxy module can run as a singleton component in the service container. A singleton component is a component that has only one instance in a runtime environment. That is, there is only one instance of the authentication proxy module in the entire intelligent agent service layer. All business tools share this instance. The first token cache and the second token cache are also managed by this unique instance, thereby ensuring the global consistency of the token cache.

[0024] The encryption authentication module performs symmetric encryption on the authentication request body of business subsystems using encryption authentication methods. It may include a key manager, an encryption engine, and an encoder. The key manager reads the key and initialization vector required for symmetric encryption from an external configuration file. Using external configuration rather than hard-coding in the source code ensures that the key can be replaced according to the deployment environment and that the key does not appear in the source code. The encryption engine encrypts the plaintext according to a preset symmetric encryption algorithm. The encoder encodes the encrypted ciphertext byte array into a printable string, enabling the encryption result to be transmitted through a structured data format. It should be noted that the encryption authentication module may only provide encryption functionality without decryption. Decryption is performed by the authentication server of the corresponding business subsystem. This one-way encryption design eliminates the need for the agent service layer to possess decryption capabilities, thus reducing the risk of key leakage.

[0025] The distributed caching module stores the agent's login context and supports reading by session identifier. In one optional implementation of this application, the distributed caching module can be implemented using a key-value storage engine, storing the agent's login context in a hash structure with the session identifier as the storage key. A hash structure is a composite data structure consisting of multiple fields and their values, suitable for storing objects containing multiple fields. Each field can be read and updated independently, and the operation of reading all fields is atomic, thus ensuring the consistency of the context data. The distributed caching module can also use a connection pool to manage connections with the storage engine. The connection pool maintains a set of reusable connection instances, avoiding the overhead of creating and destroying connections for each operation, while limiting the maximum number of connections to prevent connection leaks from causing resource exhaustion.

[0026] The first and second business subsystems provide specific business service capabilities and employ different authentication methods. For example, the first business subsystem can be a platform management subsystem, including an authentication interface and a business interface. The authentication interface receives authentication requests containing a session identifier, application identifier, and password, verifies these three pieces of information, and returns a Token upon successful verification. Its business interface is used to handle platform-related businesses such as enterprise management, work assignment statistics, and customer statistics. Since the application identifier and password used by the first business subsystem are pre-configured static values ​​that do not change with the user or business session, the Token of the first business subsystem is only related to the session identifier of the current business session and does not depend on the user's identity information. The second business subsystem can be an accounting subsystem, including an authentication interface, an account set switching interface, and a business interface. The authentication interface receives authentication requests carrying encrypted authentication data, decrypts and verifies the encrypted authentication data, and returns a Token upon successful verification. The account set switching interface receives account set switching requests with a Token in the request header and a target account set identifier in the request body, executes the account set switching operation, and returns the switching result. Its business interface is used to handle accounting-related businesses such as voucher generation, bank data retrieval, and period-end carry-forward. Since the second business subsystem adopts a dynamic authentication method based on user identity and role identifier, where the role identifier refers to the identifier used to indicate the role category to which the operating user belongs in the business subsystem, the token of the second business subsystem is directly bound to the identity of the operating user.

[0027] In this embodiment of the application, an account set refers to a set of independent and self-contained accounting data in an accounting business subsystem. The same enterprise can have multiple account sets, and the accounting data between different account sets are isolated from each other. An account set identifier is an identifier used to uniquely identify an account set. Account set switching refers to switching the operation scope associated with the current session to a specific account set. Only after the account set switching is completed will the business interface called subsequently perform operations in the context of the account set and return the business data under the account set.

[0028] It should be noted that this application embodiment uses two business subsystems, the first business subsystem and the second business subsystem, as examples for illustration. However, the method described in this application embodiment is not limited to the case of two business subsystems. When the number of business subsystems is three or more, it is only necessary to configure the corresponding Token caching and cache Key construction rules for the newly added business subsystems. This application embodiment does not limit the specific number of business subsystems.

[0029] Based on the above exemplary application environment, this application embodiment provides a cross-business system authentication processing method, which is applied to the intelligent agent service layer, such as... Figure 1 As shown, Figure 1 This application provides a schematic diagram illustrating the workflow of an authentication processing method across business systems, including: Step S101: Receive a Token acquisition request through the unified Token acquisition interface. The Token acquisition request carries the session identifier of the current business session and indication information for indicating the target business subsystem.

[0030] This embodiment of the application specifies that the intelligent agent service layer provides a unified token acquisition interface. The unified token acquisition interface refers to a single interface for callers to obtain tokens from various business subsystems, with the calling method independent of the target business subsystem. That is, regardless of which business subsystem is being called, the caller's method of requesting the token is the same; the difference lies only in the indication information carried in the token acquisition request. This indication information indicates the target business subsystem for this token acquisition request. Its specific form can be a business subsystem identifier, a business tool type identifier, or different method names provided by the unified token acquisition interface for different business subsystems. This embodiment of the application does not impose any restrictions on this. Through this design of a unified interface plus indication information, the caller's calling method is fixed, and the differences in authentication protocols and parameter structures among various business subsystems will not be transmitted to the caller. This allows the intelligent agent to initiate cross-business subsystem calls without being aware of the underlying authentication details. For example, in the aforementioned exemplary application environment, the unified token acquisition interface can be exposed by the authentication proxy module, and the token acquisition request can be sent by the target business tool in the business tool group. The returned token is then returned to the target business tool accordingly.

[0031] Step S102: Based on the instruction information, determine the Token cache and cache key construction rules corresponding to the target business subsystem; wherein, the Token cache corresponding to the first business subsystem and the Token cache corresponding to the second business subsystem are independent of each other, and the cache key construction rules corresponding to the first business subsystem and the cache key construction rules corresponding to the second business subsystem are different.

[0032] For ease of understanding, several technical terms involved in the embodiments of this application will be explained here first. A Token cache refers to a storage structure used to store acquired Tokens for subsequent reuse. It organizes data in the form of a cache key corresponding to a cache entry. A cache entry refers to a stored item in the Token cache corresponding to a cache key, which stores at least one Token. A cache key is a retrieval identifier that uniquely identifies a cache entry in the Token cache. A cache key construction rule refers to the rule on which the cache key is generated, that is, it specifies which information from the current business session is combined into the cache key and in what way. A valid Token refers to the Token stored in the cache entry when there is a cache entry in the determined Token cache that corresponds to the target cache key, and the Token stored in the cache entry has not expired. In the embodiments of this application, for ease of description, the Token cache corresponding to the first business subsystem is referred to as the first Token cache, and the Token cache corresponding to the second business subsystem is referred to as the second Token cache.

[0033] In this embodiment, the two aspects of "which Token cache to use to store the Token" and "what rules to use to construct the cache Key" are bound to the target business subsystem and selected uniformly according to the instruction information. The significance of this approach is twofold: First, the Token caches of different business subsystems are completely isolated in data structure. Read and write operations on one Token cache will not affect another, thus ensuring that Tokens from different business subsystems do not interfere with each other or are misused due to different expiration dates or usage formats. Second, the cache Key construction rules corresponding to different business subsystems are different, allowing Tokens from each business subsystem to be stored separately at a granularity adapted to their own authentication semantics. That is, the cache Key is constructed from the information that determines the Token's value, thus preventing multiple Tokens that should be stored separately from each other from overwriting each other within the same business subsystem. Furthermore, since both the Token cache and cache Key construction rules are configured according to the business subsystem, when integrating a new business subsystem, only a corresponding set of Token cache and cache Key construction rules needs to be added, without modifying the unified Token acquisition interface itself or the calling method between the agent and the caller, thus exhibiting good scalability.

[0034] In one optional implementation of this application, the first Token cache and the second Token cache can be implemented using thread-safe mapping structures that support concurrent access, such as instances of ConcurrentHashMap. ConcurrentHashMap is a mapping structure that supports multi-threaded concurrent read and write without additional synchronization locks, making it suitable for the performance requirements of the intelligent agent service layer in high-frequency access to the Token cache in multi-user concurrent scenarios.

[0035] Step S103: Construct a target cache key according to the session identifier based on the determined cache key construction rules, and query the determined token cache with the target cache key.

[0036] In this embodiment of the application, it is specified that the cache key construction rules corresponding to each business subsystem shall use the session identifier of the current business session as one of the information on which the cache key is constructed, so that the constructed target cache key can at least distinguish different business sessions. That is, the tokens obtained by different business sessions are stored in different cache entries, avoiding mutual leakage and misuse of tokens between business sessions.

[0037] Step S104: If a valid token corresponding to the target cache key exists in the determined token cache, return the valid token.

[0038] If a valid token exists in the identified token cache, the valid token is read directly from the token cache and returned. This process does not involve network interaction with the business subsystem, so it takes very little time, for example as little as milliseconds, thereby significantly reducing the network round trips and processing overhead caused by repeated authentication.

[0039] Step S105: If there is no valid token corresponding to the target cache key in the determined token cache, initiate authentication to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem, obtain the token returned by the target business subsystem, associate the token with the target cache key and write it into the determined token cache, and return the token.

[0040] The statement that there is no valid token corresponding to the target cache key in the determined token cache includes two scenarios: there is no cache entry corresponding to the target cache key in the determined token cache, and although there is a cache entry corresponding to the target cache key in the determined token cache, the token stored in the cache entry has expired.

[0041] This embodiment of the application, through the processing order of "first checking the cache, and then initiating authentication if no valid token is found" defined in steps S103 to S105 above, ensures that multiple business calls within the cache validity period of the same business session only need to perform the actual authentication process once, avoiding the resource consumption caused by repeatedly initiating authentication requests to the business subsystem for each business call; at the same time, since the authentication and cache writing processes are both completed within the intelligent agent service layer, the caller only needs to call a unified token acquisition interface to obtain a usable token, without having to worry about details such as cache query, authentication request construction, authentication response parsing, and cache writing.

[0042] Optionally, in one implementation of this application embodiment, the authentication process of each business subsystem can be encapsulated into a Token loading function corresponding to that business subsystem. In step S102, the Token loading function corresponding to the target business subsystem is determined together according to the indication information. In step S105, authentication is initiated by calling the determined Token loading function. The Token loading function is a callable processing unit that encapsulates the authentication process of a business subsystem. When called, it constructs an authentication request according to the authentication method required by the business subsystem, initiates authentication to the authentication interface of the business subsystem, and extracts the Token from the authentication response. By encapsulating the authentication process of each business subsystem into independent Token loading functions, the differences in authentication protocols, parameter structures, and encryption requirements among the business subsystems are converged within their respective Token loading functions. The aforementioned cache-first loading engine only needs to receive two parameters—the Token cache instance and the Token loading function—to complete the scheduling. Therefore, when accessing a new business subsystem, only a corresponding Token loading function needs to be added, without modifying the cache scheduling framework itself.

[0043] Optionally, in one implementation of this application embodiment, the cache key construction rule corresponding to the first business subsystem is to construct the cache key based on the session identifier; the cache key construction rule corresponding to the second business subsystem is to construct the cache key based on the session identifier and the user identity identifier, wherein the user identity identifier is the identity identifier of the user who initiated this business operation corresponding to the current business session. For example, the cache key of the first token cache can be the original value of the session identifier, and the cache key of the second token cache can be formed by concatenating the session identifier and the user identity identifier using a preset separator; the user identity identifier can be the user's contact information, such as the mobile phone number registered by the user in the system, or it can be other information that can uniquely identify the user's identity, such as the user's account or user number, and this application embodiment does not impose any restrictions on this. The user identity identifier can be read from the intelligent agent login context associated with the session identifier stored in the distributed cache module.

[0044] The reason for using different cache key construction rules for the two token caches in this embodiment is as follows: The first business subsystem's token acquisition relies solely on the session identifier and pre-configured application credentials. The token corresponding to the same session identifier is identical at any given time; therefore, using the session identifier as the cache key uniquely identifies a cache entry. However, the second business subsystem's token acquisition depends on the user identity identifier. The same session identifier may correspond to different user identity identifiers at different times. For example, if an administrator switches accounts within the same business session, the user identity identifier changes. If the cache key only contains the session identifier, the token acquired by the new account will overwrite the token of the old account, making the old account's token unavailable in the cache, thus causing business call failure. By including the user identity identifier in the cache key of the second token cache, tokens for different user identities are stored in different cache entries. Even if an account switch occurs within the same business session, the old and new tokens will not overwrite each other, thus ensuring proper token isolation in multi-user identity scenarios. As can be seen, the embodiments of this application do not simply split the cache mechanically according to the number of business subsystems. Instead, based on the different binding relationships between the token and identity of each business subsystem, different granularity cache keys are matched for them. That is, for business subsystems whose tokens are only related to business sessions, a session-level cache key is used, and for business subsystems whose tokens are bound to user identities, a dual-dimensional cache key of session and user identity is used. This differentiated cache key construction rule is adapted to the authentication semantics of each business subsystem.

[0045] Optionally, in one implementation of this application embodiment, the step of associating the Token with the target cache key and writing it into the determined Token cache includes: setting an expiration timestamp for the Token, and associating a cache entry containing the Token and the expiration timestamp with the target cache key and writing it into the determined Token cache, wherein the expiration timestamp is the sum of the writing time and a preset cache validity period. Correspondingly, the step of querying the determined Token cache with the target cache key includes: when a cache entry corresponding to the target cache key is found, determining whether the Token in the cache entry has expired based on the relationship between the current system time and the expiration timestamp in the cache entry; determining that the Token has expired when the current system time reaches or exceeds the expiration timestamp; and determining the expired Token as an invalid Token.

[0046] In this embodiment, a cache entry may include two fields: a Token value and an expiration timestamp. For example, the preset cache validity period can be set to 24 hours, meaning the expiration timestamp is set to the time of writing plus 24 hours. When querying the cache entry subsequently, if the current system time is less than the expiration timestamp, the Token in the cache entry is determined to be valid; otherwise, it is determined to have expired and needs to be retrieved again. This embodiment determines the validity of the Token by recording the expiration timestamp within the cache entry and comparing it during queries. This ensures that the Token validity determination does not rely on additional probe calls to the business subsystem or external periodic cleanup tasks. Expiration identification and automatic renewal can be completed in the same process of Token retrieval, further improving the reliability of the Token retrieval process. It should be noted that the preset cache validity period can be configured according to the actual validity period of the Tokens issued by each business subsystem, and should preferably be slightly less than the Token validity period on the business subsystem side to avoid situations where the cache is determined to be valid while the business subsystem side has determined it to be invalid. This embodiment does not limit the specific value of the preset cache validity period.

[0047] Optionally, in one implementation of this application embodiment, when the indication information indicates that the target business subsystem is the second business subsystem, the method further includes: before constructing the target cache key based on the session identifier, using the session identifier as the cache key, reading the agent login context associated with the session identifier from the distributed cache module, and obtaining the user identity identifier from the agent login context; when there is no agent login context associated with the session identifier in the distributed cache module, determining that the current business session is invalid and returning a login timeout exception; when the user identity identifier in the agent login context is empty, returning a Token acquisition failure exception.

[0048] In this embodiment, the intelligent agent login context refers to a data structure written to the distributed cache module when a business session is established. This structure describes information such as the user's identity, affiliated organization, operating company, and account set corresponding to the business session. It uses the session identifier as the storage key and serves as the data source for subsequent authentication processing and account set switching. For example... Figure 3 As shown, Figure 3 This is a schematic diagram of a data structure for an intelligent agent login context and a dual-Token isolated cache provided in an embodiment of this application. In an optional implementation of this embodiment, the intelligent agent login context is stored in a Hash structure with its storage key = session identifier. It can include five types of information: organization information, including organization identifier, organization type, and organization name, used to identify the accounting agency to which the user belongs; user identity, including user identifier, user name, user contact information, and administrator identifier, used to identify the identity of the currently operating user, wherein the user contact information is both a key credential for authentication by the second business subsystem and a cache key for constructing the second token cache; enterprise information, This includes five categories of information: Enterprise Identifier, Enterprise Name, Enterprise Tax Identifier, Enterprise Type, and Accounting Standards, used to identify the enterprise entity operated on by the user. Enterprise Type and Accounting Standards can influence the branching logic of business tools. Account Set Information, including the default account set identifier, account set name, whether the default account set identifier is used, and the current accounting period, is used to identify the account set operated on by the user in the accounting-related business subsystem. The default account set identifier is the default source of the target account set during automatic account set switching. Source Identifier, including the source subsystem identifier and session association field value, is used to distinguish which entry point the user entered the system from, while the session association field value is used for session association when calling the business interface of the first business subsystem. These five categories of information together constitute the complete context required by the intelligent agent when performing cross-business system business operations. Figure 3The data structure of the dual-Token isolated cache is also shown. The cache key of the first Token cache is the session identifier, and the cache key of the second Token cache is the session identifier plus the user identity identifier. The cache entries in both Token caches contain two fields: the Token value and the expiration timestamp.

[0049] In this embodiment, two types of exceptions are distinguished during the reading of the agent login context, and different exception information is returned for each. The technical significance is as follows: If the distributed caching module does not have an agent login context associated with the session identifier, it indicates that the business session has expired or the user has not logged in. In this case, a login timeout exception is returned, instructing the caller to guide the user to re-establish the business session. If the agent login context exists but the user identity identifier is empty, it indicates that although the business session is valid, it lacks the identity information necessary to initiate authentication with the second business subsystem. In this case, a token acquisition failure exception is returned. By performing the above pre-verification before constructing the target cache key and initiating authentication, incorrect cache keys due to missing context can be avoided, as well as authentication requests destined to fail to the business subsystem can be avoided. This allows exceptions to be promptly identified within the agent service layer and fed back to the caller with clear semantics.

[0050] Optionally, in one implementation of this application embodiment, when the target business subsystem is the second business subsystem, the step of initiating authentication to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem includes: constructing a plaintext authentication request containing the user identity identifier, role identifier, and current timestamp; serializing the plaintext authentication request, encrypting the serialized plaintext authentication request using a symmetric encryption algorithm, and encoding the encrypted ciphertext to obtain encrypted authentication data; sending the authentication request carrying the encrypted authentication data to the authentication interface of the second business subsystem, and receiving the Token returned by the second business subsystem after decrypting and verifying the encrypted authentication data; returning a Token acquisition failure exception when the received Token is empty; wherein, the current timestamp is used by the second business subsystem to determine whether the authentication request exceeds a preset valid time based on the difference between the current timestamp and the time of receiving the authentication request after decryption, and rejecting the authentication request when the preset valid time is exceeded.

[0051] In one optional implementation of this application, the aforementioned symmetric encryption algorithm can employ the Advanced Encryption Standard (AES) algorithm, combined with Cipher Block Chaining (CBC) mode and PKCS5 padding, i.e., a combination of AES / CBC / PKCS5 Padding. In CBC mode, each plaintext block is XORed with the preceding ciphertext block before encryption, resulting in different ciphertexts for the same plaintext block at different positions, thus enhancing encryption strength. PKCS5 padding automatically fills the plaintext block when its length is insufficient to fill the entire block. For example, both the key and the initialization vector can be 16 bytes long. The byte sequence of the key is used to construct the encryption key object, and the byte sequence of the initialization vector is used to construct the initialization vector object for CBC mode. After being initialized to encryption mode, the encryptor instance performs encryption on the plaintext byte sequence. The encrypted ciphertext can be encoded using Base64 encoding. Base64 encoding is an encoding method that converts a byte array into printable characters, that is, it encodes the ciphertext byte array into a printable string, so that the encryption result can be transmitted over the network in a structured data format (such as JSON format).

[0052] The technical significance of introducing a current timestamp into the plaintext authentication request in this embodiment is to prevent replay attacks. A replay attack refers to an attack method in which an attacker intercepts a legitimate request and resends it to impersonate a legitimate caller. After decrypting the encrypted authentication data, the second business subsystem verifies the difference between the current timestamp and the time when the authentication request was received. If the difference exceeds a preset valid time, the authentication request is rejected. This ensures that even if the encrypted authentication data is intercepted during transmission, the attacker cannot reuse the data to complete authentication after the preset valid time has passed. Simultaneously, since the plaintext authentication request contains sensitive information such as user identity and role identification, symmetric encryption before transmission can prevent this information from being exposed in plaintext on the network. Furthermore, this embodiment encapsulates the above-mentioned encrypted authentication process within the authentication process corresponding to the second business subsystem. The caller is completely unaware of the existence of this encryption process when calling the unified token acquisition interface, thus introducing stronger authentication requirements without increasing the complexity for the caller.

[0053] Optionally, in one implementation of the embodiments of this application, such as Figure 2 As shown, Figure 2 A schematic diagram illustrating the workflow of another cross-business system authentication processing method provided in this application embodiment, which is implemented in... Figure 1This implementation builds upon the method shown, further encapsulating the authentication process of each business subsystem with a Token loading function, and completing the account set switching before returning the Token. It should be noted that, to avoid conflict with... Figure 1 The step labels in the methods shown are confusing. Figure 2 Each step of the method shown is individually labeled as steps S201 to S210, wherein steps S201 to S203 are respectively associated with... Figure 1 Steps S101 to S103 of the method shown correspond to steps S204 and S205 respectively. Figure 1 Steps S104 and S105 of the method shown correspond to each other, except that the Token obtained in steps S204 and S205 is not returned immediately, but is returned by step S210 after the account set switching process described in steps S206 to S209 is completed. Figure 2 The methods shown include: Step S201: Receive a Token acquisition request through the unified Token acquisition interface. The Token acquisition request carries the session identifier of the current business session and indication information for indicating the target business subsystem. The indication information also indicates that the Token acquisition request is a Token acquisition request with account set switching.

[0054] Step S202: Based on the instruction information, determine the Token cache, cache key construction rules, and Token loading function corresponding to the target business subsystem.

[0055] Step S203: Construct a target cache key according to the session identifier based on the determined cache key construction rules, and query the determined token cache with the target cache key.

[0056] Step S204: If a valid token corresponding to the target cache key exists in the determined token cache, the valid token corresponding to the target cache key is determined as the token obtained this time.

[0057] Step S205: If there is no valid token corresponding to the target cache key in the determined token cache, call the determined token loading function to initiate authentication, obtain the token, associate it with the target cache key, and write it into the determined token cache.

[0058] Step S206: When the target account set identifier is included in the Token acquisition request, the account set corresponding to the target account set identifier is determined as the target account set.

[0059] Step S207: When the target account set identifier is not included in the Token acquisition request and the default account set identifier in the agent login context is not empty, the account set corresponding to the default account set identifier is determined as the target account set.

[0060] Step S208: When the target account set identifier is not included in the Token acquisition request and the default account set identifier in the agent login context is empty, return an account set switching failure exception.

[0061] Step S209: Attach the Token to the request header of the account set switching request, and send the account set switching request carrying the target account set to the account set switching interface of the second business subsystem to complete the account set switching.

[0062] Step S210: After confirming that the account set switch is successful, return the Token.

[0063] The target account set determination process defined in steps S206 to S208 is as follows: First, it is determined whether the Token acquisition request includes the target account set identifier. If it does, step S206 is executed. If it does not, it is further determined whether the default account set identifier in the agent login context is empty. If it is not empty, step S207 is executed; if it is empty, step S208 is executed. After determining the target account set by executing step S206 or step S207, steps S209 and S210 are executed. When executing step S208, this Token acquisition process ends by returning an account set switching failure exception.

[0064] Accounting-related business subsystems typically employ a multi-account architecture, where a single enterprise can have multiple independent accounts. Before operating on accounting data, the current session must be switched to the target account. The target account determination logic defined in this embodiment adopts a two-level resolution strategy of "explicit specification first, default account as a fallback." Its technical significance lies in the following: In some business scenarios, users may need to temporarily operate on a non-default account. In this case, the business tool can pass the user-specified target account identifier along with the token acquisition request, and the intelligent agent service layer will preferentially use this explicitly specified value. However, in most conventional scenarios, the business tool does not specify the target account identifier; the intelligent agent service layer automatically extracts the default account identifier from the intelligent agent login context as the target account, thereby automating account switching so that neither the user nor the intelligent agent needs to be aware of the account switching operation. Compared to the previous approach where the caller explicitly initiates the account set switch by carrying the account set identifier, this embodiment merges the account set switch into the Token acquisition process. The switch is completed before the Token is returned, ensuring that when the business tool obtains the Token, the current session is already in the context of the target account set, allowing direct invocation of business interfaces. This simplifies the caller's processing flow and avoids the risk of reading or writing incorrect account set data due to missed account set switch steps. Furthermore, since both levels of resolution are completed within the intelligent agent service layer, no modifications to the second business subsystem itself are required.

[0065] Optionally, in one implementation of this application embodiment, when the indication information further indicates that the Token acquisition request is a switch-free Token acquisition request, after associating the Token with the target cache Key and writing it into the second Token cache, the sending of the account set switching request is skipped, that is, skipped. Figure 2 In steps S206 to S209 of the method shown, the Token is directly returned to the target business tool, so that the target business tool carries the Token to call the batch business interface of the second business subsystem, and the batch business interface constructs the operation context according to the identifier of each account set it processes.

[0066] The difference between the token acquisition process without switching described in this embodiment and the aforementioned token acquisition process with account set switching is that the determination of the target account set and the account set switching are no longer executed after the token is written to the second token cache. This implementation method is mainly applicable to the following two scenarios: First, the batch business interfaces of the second business subsystem (such as batch voucher generation, batch period-end carry-forward, etc.) construct operation identities and operation contexts according to each account set identifier processed. The caller does not need to and should not switch to a specific account set in advance. If the caller completes the account set switching in advance, it will limit the processing scope of the batch business interface. Second, some users who enter the system from the platform side do not have a default account set identifier in their smart agent login context. If the account set switching is still executed according to the fixed process, the account set switching failure exception will be returned because there is neither an explicitly specified target account set identifier nor a default account set identifier, which will interrupt the token acquisition process that could have been completed normally. This application embodiment distinguishes between two request types—one with account set switching and one without—using indication information on the unified Token acquisition interface. This allows the same authentication and caching framework to adapt to both types of business call scenarios simultaneously, improving the adaptability of cross-business calls.

[0067] Optionally, in one implementation of this application embodiment, the method further includes: in response to an authentication failure status returned after the business interface of the target business subsystem is called, determining that the Token corresponding to the target business subsystem is invalid; when determining that the Token corresponding to the first business subsystem is invalid, constructing a cache Key based on the session identifier and deleting the cache entry corresponding to the cache Key in the first Token cache; when determining that the Token corresponding to the second business subsystem is invalid, constructing a cache Key based on the session identifier and the user identity identifier and deleting the cache entry corresponding to the cache Key in the second Token cache; after the corresponding cache entry is deleted, in response to receiving a Token acquisition request carrying the session identifier and indicating the same target business subsystem again, re-initiating authentication to the authentication interface of the target business subsystem to obtain a new Token because the Token cache determined by the query was not hit, and writing the new Token into the determined Token cache.

[0068] The core function of the cache clearing mechanism defined herein is to provide a means of proactively refreshing tokens, rather than passively waiting for cache entries to expire naturally. In some scenarios, a token may be revoked by the business subsystem within the preset cache validity period, such as when an administrator modifies a user's permissions or when the user logs in again on another platform, causing the old token to become invalid. If the cache entry is not proactively cleared, the caller will continue to use the expired token to call the business interface, causing the business call to fail continuously until the cache entry expires naturally and a new token is obtained. By linking the token expiration detection result with the cache clearing action, the clearing of the corresponding cache entry can be triggered immediately when an authentication failure is detected. Subsequent token acquisition requests will automatically re-execute the authentication process due to cache misses, significantly shortening the token refresh time window and improving system availability. It should be noted that because the cache key construction rules for the first and second token caches are different, the cache key must also be constructed according to the corresponding business subsystem's cache key construction rules when clearing cache entries. This ensures that only cache entries corresponding to the specific business subsystem, business session, and user identity are cleared, and that tokens for other business subsystems or other user identities are not mistakenly deleted. This is an extension of the differentiated cache key construction rules in the token expiration handling process. Furthermore, a cache clearing log can be recorded after clearing cache entries. The log can include information such as the clearing type, session identifier, and clearing time to facilitate troubleshooting and auditing.

[0069] Optionally, in one implementation of this application embodiment, after receiving the Token, the target business tool appends the Token to the business interface call request according to the appending method corresponding to the target business subsystem, including: when the target business subsystem is the first business subsystem, appending the Token to the authentication request header field of the business interface call request with its original value, and appending the session association field value obtained from the smart agent login context to the session association request header field of the business interface call request; when the target business subsystem is the second business subsystem, appending the Token to the authentication request header field of the business interface call request with a preset prefix.

[0070] For example, when calling the business interface of the first business subsystem, the original value of the Token (i.e., without any prefix) can be set to the Authorization field of the HTTP request header, and the session association field value read from the smart agent login context can be set to the Cookie field of the HTTP request header to complete the session association with the first business subsystem. When calling the business interface of the second business subsystem, the Token can be set to the Authorization field of the HTTP request header in the form of "Bearer" prefix followed by a space and then the Token value. This embodiment of the application further defines the differentiated attachment method of the Token in the usage stage. Its technical significance is that the differences between the various business subsystems are not only reflected in the Token acquisition method, but also in the Token carrying format. By agreeing on the Token attachment method according to the category to which the business tool belongs, the entire link from Token acquisition to Token use can be adapted to heterogeneous business subsystems, avoiding business interface call failures due to Token carrying format mismatch.

[0071] Furthermore, in one implementation of this application embodiment, the business tools in the business tool group can be divided into three categories according to the business subsystems they call and the required token types: platform-type business tools, which obtain the token of the first business subsystem only through the unified token acquisition interface; accounting-type business tools, which obtain the token of the second business subsystem with account set switching through the unified token acquisition interface; and batch-type business tools, which obtain the token of the second business subsystem without switching through the unified token acquisition interface. The above classification corresponds to the indication information received by the unified token acquisition interface. The category to which the business tool belongs is determined when it registers with the MCP server. Therefore, the intelligent agent does not need to additionally determine which authentication method should be used when selecting a business tool, further reducing the processing complexity on the intelligent agent side.

[0072] Furthermore, in an optional implementation of this application embodiment, after the business tool calls the business interface of the business subsystem, it can automatically trigger the cache clearing interface of the authentication proxy module based on the authentication failure status returned by the business subsystem, thereby realizing the linkage between token expiration and token refresh at the granularity of the business interface. For example, when the first business subsystem returns an authentication failure status indicating that the token is invalid, the business tool sends the session identifier of the current business session to the authentication proxy module, which then deletes the cache entry corresponding to the session identifier in the first token cache. When the second business subsystem returns an authentication failure status indicating that the token is invalid, the authentication proxy module constructs a cache key based on the session identifier and user identity identifier of the current business session and deletes the corresponding cache entry in the second token cache. Subsequently, the business tool can re-initiate the token acquisition request, and the cache-first loading engine will re-execute the authentication process due to a cache miss. This implementation can link the token expiration detection process and the token refresh process at the granularity of the business interface, making it particularly suitable for application scenarios in enterprise-level SaaS platforms where permission adjustments are frequent and user login status changes are numerous.

[0073] Furthermore, in another optional implementation of this application embodiment, the authentication parameters, token cache, cache key construction rules, and token loading functions corresponding to different business subsystems can be configured as authentication strategies. When a new business subsystem is accessed, a corresponding authentication strategy can be added, allowing the agent service layer to select the appropriate authentication strategy based on the target business subsystem indicated by the indication information in the token acquisition request, without changing the calling method between the agent and the caller, or modifying the unified token acquisition interface itself. For example, for business subsystems where the token is only related to the business session, the authentication strategy can stipulate the use of the session identifier to construct the cache key; for business subsystems where the token is bound to the user identity, the authentication strategy can stipulate the use of both the session identifier and the user identity identifier to construct the cache key; for business subsystems that need to encrypt the authentication request, the corresponding encryption processing flow can be associated in their authentication strategy. In this way, while maintaining the unified token acquisition interface, access to business subsystems using different authentication mechanisms can be extended, thereby further improving the scalability of the method described in this application embodiment. It should be noted that the above-mentioned optional implementation methods still belong to the technical framework of unified authentication adaptation of heterogeneous business subsystems within the intelligent agent service layer, and do not change the overall technical concept of this application, which is to shield the authentication differences of business subsystems with a unified token acquisition interface and to isolate and manage tokens by constructing rules with mutually independent token caches and different cache keys.

[0074] For ease of understanding, the embodiments of this application are described herein in conjunction with... Figure 4 The complete implementation process of the above method is illustrated by example. Figure 4 As shown, Figure 4 This is an exemplary workflow diagram of an authentication processing method across business systems provided in an embodiment of this application. The process starts from the start node, first enters the request type judgment node, and then obtains the indication information in the request based on the Token, which is divided into three paths.

[0075] The first path is for the scenario where the target business subsystem is the first business subsystem. The first token cache is queried using the session identifier as the cache key. If the cache hits and the token has not expired, it is directly returned without initiating a network request. If the cache misses or the token has expired, an authentication request containing the session identifier, application identifier, and password is constructed and sent to the authentication interface of the first business subsystem. The first business subsystem verifies the above three pieces of information and returns a token upon successful verification. It then extracts the token from the response, encapsulates it along with the expiration timestamp into a cache entry, writes it to the first token cache, and returns the token to the target business tool. The business tool then sets the token to the Authorization field of the HTTP request header with its original value, reads the session association field value from the smart agent login context, sets it to the Cookie field of the HTTP request header, and calls the business interface of the first business subsystem.

[0076] The second path is for cases where the target business subsystem is the second business subsystem and the request type involves account set switching. First, the agent login context is read and the user identity identifier is extracted. If the context does not exist, a login timeout exception is returned; if the user identity identifier is empty, a Token acquisition failure exception is returned. Then, the second Token cache is queried using the combination of the session identifier and the user identity identifier as the cache key. If the cache is hit and has not expired, the authentication process is skipped. If the cache is missed or has expired, a symmetric encryption authentication process is executed. This involves constructing a plaintext authentication request containing the user identity identifier, role identifier, and current timestamp, serializing it, encrypting it using AES / CBC / PKCS5Padding algorithms, and then Base64 encoding it before sending it to the authentication interface of the second business subsystem. If the returned Token is empty, a T is returned. If the token acquisition fails, an exception is thrown; otherwise, the returned token along with its expiration timestamp is written to the second token cache. Next, the target account set is determined, and the account set switching interface of the second business subsystem is called to complete the account set switching. Specifically, it checks if the token acquisition request includes the target account set identifier; if so, that identifier is used; otherwise, the default account set identifier is extracted from the agent login context. If both are empty, an account set switching failure exception is returned. The token is then appended to the request header in Bearer format, and the account set switching request carrying the target account set identifier is sent to the account set switching interface of the second business subsystem. If the account set switching fails, an account set switching failure exception is returned; otherwise, the token is returned to the target business tool. The business tool then sets the token in Bearer format to the Authorization field of the HTTP request header, calls the business interface of the second business subsystem, and at this point, the business interface performs operations within the context of the target account set and returns the business data under that account set.

[0077] The third path is for the case where the target business subsystem is the second business subsystem and the request type is switch-free. This path performs the same context reading, cache query, and symmetric encryption authentication process as the path with account set switching. After writing the Token along with the expiration timestamp into the second Token cache, it skips the account set switching and directly returns the Token to the target business tool. The business tool then uses this Token to call the batch business interface of the second business subsystem.

[0078] In the three paths mentioned above, the calling method perceived by the business tools and the intelligent agents is completely consistent, that is, they all initiate a token acquisition request to the unified token acquisition interface and obtain a usable token. The selection of token cache, construction of cache key, construction and encryption of authentication request, parsing of authentication response, writing of cache, and switching of account set are all transparently completed by the intelligent agent service layer inside itself.

[0079] The cross-business system authentication processing method provided in this application establishes a unified Token acquisition interface at the agent service layer between the agent and multiple business subsystems. Following this interface, it determines the Token cache and cache key construction rules corresponding to the target business subsystem according to the indicated information. This consolidates the differences in authentication protocols, parameter structures, encryption requirements, and Token carrying formats among the various business subsystems within the agent service layer. This eliminates the need for the agent and caller to be aware of the underlying authentication details or to change their existing calling methods when accessing new business subsystems. By establishing independent Token caches for different business subsystems and using different cache key construction rules adapted to their respective authentication semantics, it achieves Token isolation between the session dimension and the user identity dimension, avoiding the issue of Tokens from different business subsystems being managed uniformly. This approach avoids mutual interference or misuse, and also prevents token misuse and business call failures caused by the overwriting of old and new tokens when switching user identities within the same business session. By first checking the cache and then initiating authentication if no valid token is found, and by using validity judgment based on the expiration timestamp, the network interaction and processing overhead caused by repeated authentication are significantly reduced. By merging account set switching into the token acquisition process and adopting a two-level resolution strategy of explicitly specifying priority and defaulting account set as a fallback, account set switching is automated. By distinguishing between request types with and without account set switching on the unified token acquisition interface, the same authentication and caching framework can simultaneously adapt to both regular accounting business and batch multi-account set business calling scenarios, thus providing a basic method for intelligent agents to achieve secure and reliable cross-business system business operations in enterprise-level SaaS platforms.

[0080] Example 2 Based on the cross-business system authentication processing method provided in the above embodiments of this application, this application also provides a corresponding cross-business system authentication processing apparatus, such as... Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of a cross-business system authentication processing device 20 provided in an embodiment of this application. The cross-business system authentication processing device 50 is applied to the intelligent agent service layer and includes: The request receiving module 501 is used to receive a token acquisition request through the unified token acquisition interface. The token acquisition request carries the session identifier of the current business session and indication information for indicating the target business subsystem. The configuration determination module 502 is used to determine the Token cache and cache key construction rules corresponding to the target business subsystem according to the indication information; wherein, the Token cache corresponding to the first business subsystem and the Token cache corresponding to the second business subsystem are independent of each other, and the cache key construction rules corresponding to the first business subsystem and the cache key construction rules corresponding to the second business subsystem are different; The cache query module 503 is used to construct a target cache key based on the session identifier according to the determined cache key construction rules, and query the determined token cache with the target cache key; The authentication processing module 504 is used to initiate authentication to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem when there is no valid token corresponding to the target cache key in the determined token cache, obtain the token returned by the target business subsystem, and associate the token with the target cache key and write it into the determined token cache. The Token return module 505 is used to return the valid Token when a valid Token corresponding to the target cache Key exists in the determined Token cache, and to return the Token after the authentication processing module 504 obtains the Token.

[0081] Optionally, in one implementation of this application embodiment, the cache key construction rule corresponding to the first business subsystem is to construct the cache key based on the session identifier, and the cache key construction rule corresponding to the second business subsystem is to construct the cache key based on the session identifier and the user identity identifier, wherein the user identity identifier is an identifier read from the intelligent agent login context associated with the session identifier stored in the distributed cache module.

[0082] Optionally, in one implementation of this application embodiment, the authentication processing module 504 is further configured to: set an expiration timestamp for the Token, and associate the cache entry containing the Token and the expiration timestamp with the target cache key and write it into the determined Token cache; correspondingly, the cache query module 503 is further configured to, when querying a cache entry corresponding to the target cache key, determine whether the Token in the cache entry has expired based on the relationship between the current system time and the expiration timestamp in the cache entry, and determine the expired Token as an invalid Token.

[0083] Optionally, in one implementation of this application embodiment, the device 50 further includes a context reading module 506. Figure 5(Not shown in the image), the context reading module 506 is used to read the agent login context associated with the session identifier from the distributed cache module using the session identifier as the cache key when the indication information indicates that the target business subsystem is the second business subsystem, and to obtain the user identity identifier from the agent login context; when there is no agent login context associated with the session identifier in the distributed cache module, the current business session is determined to be invalid and a login timeout exception is returned; when the user identity identifier in the agent login context is empty, a token acquisition failure exception is returned.

[0084] Optionally, in one implementation of this application embodiment, the authentication processing module 504 is further configured to: construct a plaintext authentication request containing the user identity identifier, role identifier, and current timestamp when the target business subsystem is the second business subsystem; serialize the plaintext authentication request, encrypt the serialized plaintext authentication request using a symmetric encryption algorithm, and encode the encrypted ciphertext to obtain encrypted authentication data; send the authentication request carrying the encrypted authentication data to the authentication interface of the second business subsystem, and receive the Token returned by the second business subsystem after decryption and verification; and return a Token acquisition failure exception when the received Token is empty.

[0085] Optionally, in one implementation of this application embodiment, the device 50 further includes an account set processing module 507. Figure 5 (Not shown in the image), the account set processing module 507 is used when the indication information also indicates that the Token acquisition request is a Token acquisition request with account set switching: It determines whether the Token acquisition request includes a target account set identifier; if it does, the account set corresponding to the target account set identifier is determined as the target account set; if it does not, the account set corresponding to the default account set identifier in the agent login context is determined as the target account set; if both are empty, an account set switching failure exception is returned. After determining the target account set, the Token corresponding to the second business subsystem is appended to the request header of the account set switching request, and the account set switching request carrying the target account set is sent to the account set switching interface of the second business subsystem. After determining that the account set switching is successful, the Token return module 505 is triggered to return the Token. The account set processing module 507 is also used when the indication information also indicates that the Token acquisition request is a Token acquisition request without switching, to skip sending the account set switching request.

[0086] Optionally, in one implementation of this application embodiment, the device 50 further includes a cache clearing module 508. Figure 5(Not shown in the image), the cache clearing module 508 is used to respond to the authentication failure status returned after the business interface of the target business subsystem is called, determine that the token corresponding to the target business subsystem is invalid, construct a cache key according to the cache key construction rules corresponding to the business subsystem, and delete the cache entry corresponding to the cache key in the corresponding token cache.

[0087] The cross-business system authentication processing device provided in this application embodiment shields the differences in authentication methods among various business subsystems through a unified token acquisition interface, and achieves isolated token management through mutually independent token caches and different cache key construction rules. Each module has clear functions and the process is complete and controllable. It can provide intelligent agents with transparent automatic token acquisition and cache management capabilities in a heterogeneous authentication environment of multiple business subsystems.

[0088] Example 3 This application also provides a computer storage medium storing a computer program that, when executed by a processor, implements any of the cross-business system authentication processing methods described in the foregoing embodiments of this application.

[0089] Furthermore, embodiments of this application also provide an electronic device, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of the structure of an electronic device 60 provided in an embodiment of this application. The electronic device 60 includes: One or more processors 601, communication interface 602, memory 603 and communication bus 604, the processors 601, memory 603 and communication interface 602 communicate with each other through communication bus 604; Memory 603 is used to store one or more programs; When the one or more programs are executed by the one or more processors 601, the one or more processors 601 implement any of the cross-business system authentication processing methods described in the foregoing embodiments of this application.

[0090] This application has now described specific embodiments of the subject matter. In some cases, the actions described in the claims can be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing can be advantageous.

[0091] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0092] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0093] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0094] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0095] This application can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific transactions or implement specific abstract data types. This application can also be practiced in distributed computing environments where transactions are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0096] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0097] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A cross-business system authentication processing method, characterized in that, The method is applied to an intelligent agent service layer, which is positioned between an artificial intelligence agent and at least two business subsystems. The at least two business subsystems include a first business subsystem and a second business subsystem, and the authentication method used by the second business subsystem differs from that used by the first business subsystem. The token acquisition request is received through the unified token acquisition interface. The token acquisition request carries the session identifier of the current business session and the indication information for indicating the target business subsystem. The target business subsystem is one of the at least two business subsystems. Based on the instruction information, determine the Token cache and cache key construction rules corresponding to the target business subsystem; wherein, the Token cache corresponding to the first business subsystem and the Token cache corresponding to the second business subsystem are independent of each other, and the cache key construction rules corresponding to the first business subsystem and the cache key construction rules corresponding to the second business subsystem are different; According to the determined cache key construction rules, construct the target cache key based on the session identifier, and query the determined token cache using the target cache key; If a valid token corresponding to the target cache key exists in the determined token cache, return the valid token; If no valid token corresponding to the target cache key exists in the determined token cache, authentication is initiated to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem, the token returned by the target business subsystem is obtained, the token is associated with the target cache key and written into the determined token cache, and the token is returned.

2. The cross-business system authentication processing method according to claim 1, characterized in that, The cache key construction rule for the first business subsystem is to construct the cache key based on the session identifier; the cache key construction rule for the second business subsystem is to construct the cache key based on the session identifier and the user identity identifier, wherein the user identity identifier is the identity identifier of the user who initiated this business operation corresponding to the current business session.

3. The cross-business system authentication processing method according to claim 1, characterized in that, The step of associating the Token with the target cache Key and writing it into the determined Token cache includes: Set an expiration timestamp for the Token, and associate the cache entry containing the Token and the expiration timestamp with the target cache key and write it into the determined Token cache. The expiration timestamp is the sum of the time of writing and the preset cache validity period. The step of querying the Token cache determined by the target cache key includes: When a cache entry corresponding to the target cache key is found, the relationship between the current system time and the expiration timestamp in the cache entry is used to determine whether the token in the cache entry has expired. When the current system time reaches or exceeds the expiration timestamp, the token is determined to have expired and is identified as an invalid token.

4. The cross-business system authentication processing method according to claim 2, characterized in that, When the indication information indicates that the target business subsystem is the second business subsystem, the method further includes: Before constructing the target cache key based on the session identifier, the agent login context associated with the session identifier is read from the distributed cache module using the session identifier as the cache key, and the user identity identifier is obtained from the agent login context; wherein, the agent login context is a data structure written to the distributed cache module when the current business session is established, and the agent login context includes at least the user identity identifier and the default account identifier; If no smart agent login context associated with the session identifier exists in the distributed caching module, the current business session is determined to be invalid, and a login timeout exception is returned. If the user identity identifier in the smart agent login context is empty, a Token acquisition failure exception is returned.

5. The cross-business system authentication processing method according to claim 4, characterized in that, When the target business subsystem is the second business subsystem, the step of initiating authentication to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem includes: Construct a plaintext authentication request that includes the user's identity identifier, role identifier, and current timestamp; The plaintext authentication request is serialized, the serialized plaintext authentication request is encrypted using a symmetric encryption algorithm, and the encrypted ciphertext is encoded to obtain encrypted authentication data. Send the authentication request carrying the encrypted authentication data to the authentication interface of the second business subsystem, and receive the Token returned by the second business subsystem after decrypting and verifying the encrypted authentication data; If the received token is empty, return a token acquisition failure exception; The current timestamp is used by the second business subsystem to determine whether the authentication request exceeds a preset valid time after decryption based on the difference between the current timestamp and the time when the authentication request was received, and to reject the authentication request if the preset valid time has been exceeded.

6. The cross-business system authentication processing method according to claim 4, characterized in that, When the indication information further indicates that the Token acquisition request is a Token acquisition request with account set switching, the method further includes: before returning the Token, determining whether the Token acquisition request includes a target account set identifier; When the target account set identifier is included in the Token acquisition request, the account set corresponding to the target account set identifier is determined as the target account set; When the target account set identifier is not included in the Token acquisition request, the account set corresponding to the default account set identifier in the smart agent login context is determined as the target account set; If the target account set identifier is not included in the Token acquisition request and the default account set identifier in the agent login context is empty, an account set switching failure exception is returned. After determining the target account set, the token corresponding to the second business subsystem is appended to the request header of the account set switching request, and the account set switching request carrying the target account set is sent to the account set switching interface of the second business subsystem. After determining that the account set switching is successful based on the response returned by the second business subsystem, the token is returned.

7. The cross-business system authentication processing method according to claim 4, characterized in that, When the indication information also indicates that the Token acquisition request is a Token acquisition request without switching, after the Token is associated with the target cache key and written into the determined Token cache, the sending of the account set switching request is skipped, and the Token is returned directly, so that the recipient of the Token carries the Token to call the batch business interface of the second business subsystem, and the batch business interface constructs the operation context according to the account set identifier it processes.

8. The cross-business system authentication processing method according to claim 2, characterized in that, The method further includes: In response to the authentication failure status returned after the business interface of the target business subsystem is called, it is determined that the token corresponding to the target business subsystem is invalid. When it is determined that the Token corresponding to the first business subsystem has expired, a cache key is constructed based on the session identifier, and the cache entry corresponding to the cache key in the Token cache corresponding to the first business subsystem is deleted; When it is determined that the Token corresponding to the second business subsystem has expired, a cache key is constructed based on the session identifier and the user identity identifier, and the cache entry corresponding to the cache key in the Token cache corresponding to the second business subsystem is deleted; After the corresponding cache entry is deleted, in response to receiving a Token acquisition request again carrying the session identifier and indicating the same target business subsystem, the system re-initiates authentication with the authentication interface of the target business subsystem to obtain a new Token because the Token cache determined by the query was not hit, and writes the new Token into the determined Token cache.

9. A cross-business system authentication processing device, characterized in that, An application is made to an intelligent agent service layer, which is positioned between an artificial intelligence agent and at least two business subsystems, including a first business subsystem and a second business subsystem, wherein the authentication method used by the second business subsystem is different from that used by the first business subsystem; the device includes: The request receiving module is used to receive a token acquisition request through the unified token acquisition interface. The token acquisition request carries the session identifier of the current business session and indication information for indicating the target business subsystem. The target business subsystem is one of the at least two business subsystems. The configuration determination module is used to determine the Token cache and cache key construction rules corresponding to the target business subsystem according to the indication information; wherein, the Token cache corresponding to the first business subsystem and the Token cache corresponding to the second business subsystem are independent of each other, and the cache key construction rules corresponding to the first business subsystem and the cache key construction rules corresponding to the second business subsystem are different; The cache query module is used to construct a target cache key based on the session identifier according to the determined cache key construction rules, and query the determined token cache using the target cache key; The authentication processing module is used to initiate authentication to the authentication interface of the target business subsystem according to the authentication method adopted by the target business subsystem when there is no valid token corresponding to the target cache key in the determined token cache, obtain the token returned by the target business subsystem, and associate the token with the target cache key and write it into the determined token cache. The Token return module is used to return the valid Token when a valid Token corresponding to the target cache Key exists in the determined Token cache, and to return the Token after the authentication processing module obtains the Token.

10. A computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions, which, when executed, perform the cross-business system authentication processing method as described in any one of claims 1 to 8.