Method, storage medium, processor and system for synchronizing session information

By using a gateway with the same architecture in the cloud, edge, and terminal, login information is obtained and encrypted to generate session information, which solves the problem of high development and maintenance costs for synchronizing session information in the cloud, edge, and terminal, and achieves fast and secure synchronization of session information.

CN116962008BActive Publication Date: 2026-05-29ZHONGKE YUNGU TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHONGKE YUNGU TECH
Filing Date
2023-06-16
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

When synchronizing session information between cloud, edge, and device, the differences in architecture lead to high development and maintenance costs, inconsistent session information synchronization, and a tendency to fail under network latency. Furthermore, asynchronous synchronization is required, making it difficult to ensure the structured transformation and recognition of session information.

Method used

Cloud gateways and edge gateways using the same architecture generate session information by acquiring, verifying, and encrypting login information, and synchronize the session information through preset header information when the session expires, ensuring the consistency of session information between the edge and the cloud.

Benefits of technology

Significantly reduce development and maintenance costs, achieve rapid and secure synchronization of session information, ensure timely synchronization after edge session failure, and reduce the impact of network latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116962008B_ABST
    Figure CN116962008B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method, storage medium, processor and system for synchronizing session information. The method comprises: obtaining a first login request sent by an edge gateway; verifying first login information carried by the first login request, and generating first session information corresponding to the first login information if the authentication result of the first login information is passed; storing the first session information to a cloud session manager, and returning the first session information to the edge gateway, so that the edge gateway stores the first session information to an edge session manager; obtaining an edge session invalidation instruction sent by the edge gateway if the edge gateway detects that the first session information in the edge session manager is invalid; encrypting the first login information according to preset header information, and sending the encrypted first login information to the edge gateway, so as to synchronize the corresponding first session information in the edge session manager and the cloud session manager, thereby reducing development and operation and maintenance costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically to a method, storage medium, processor, and system for synchronizing session information. Background Technology

[0002] A cloud-edge hybrid architecture can be used for interoperability in cloud-edge-device configuration, data exchange, interface communication, unified authentication, and unified access control. Currently, when synchronizing session information between the cloud and edge, two sets of interface addresses need to be maintained because the edge and cloud use different architectures. If the cloud address changes, it needs to be repackaged, deployed, and maintained, resulting in high development and maintenance costs. Furthermore, if session information on either the cloud or the edge becomes invalid, asynchronous synchronization is required, which may occur when a request arrives before the session has been successfully synchronized, especially given network latency. Additionally, the cloud and edge also need to perform structured transformations of session information through code to ensure mutual recognition, making it difficult to synchronize session information between the cloud and the edge. Summary of the Invention

[0003] The purpose of this application is to provide a method, storage medium, processor, and system for synchronizing session information.

[0004] To achieve the above objectives, the first aspect of this application provides a method for synchronizing session information, applied to a cloud gateway, wherein the cloud gateway and the edge gateway are peer gateways using the same architecture, comprising:

[0005] Obtain the first login request sent by the edge gateway. The first login request carries the first login information of the edge user.

[0006] Verify the first login information, and if the authentication result of the first login information is successful, generate the first session information corresponding to the first login information;

[0007] The first session information is stored in the cloud session manager and then returned to the edge gateway so that the edge gateway stores the first session information in the edge session manager.

[0008] If the edge gateway detects that the first session information in the edge session manager has expired, the edge session expiration command sent by the edge gateway is obtained.

[0009] The first login information is encrypted according to the preset header information, and the encrypted first login information is sent to the edge gateway so that the edge gateway can regenerate the first session information based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

[0010] In this embodiment of the application, the method further includes: obtaining a second login request sent by a cloud user, the second login request carrying the cloud user's second login information; verifying the second login information, and generating second session information corresponding to the second login information if the authentication result of the second login information is successful; storing the second session information in a cloud session manager, and encrypting the second login information with preset header information; sending the encrypted second login information to an edge gateway, so that the edge gateway generates second session information based on the encrypted second login information, so that the second session information in the edge session manager is synchronized with the second session information in the cloud session manager.

[0011] In this embodiment of the application, the method further includes: before obtaining the first login request sent by the edge gateway or the second login request sent by the cloud user, obtaining the configuration request sent by the edge gateway; obtaining the configuration information corresponding to the configuration request from the cloud configuration center, so as to complete the initial configuration of the cloud gateway through the configuration information; and sending the configuration information to the edge gateway, so that the edge gateway can complete the initial configuration of the edge gateway through the configuration information.

[0012] In this embodiment of the application, the method further includes: after completing the initial configuration of the cloud gateway and the edge gateway, detecting whether the configuration information of the cloud configuration center has changed; if the configuration information of the cloud configuration center has changed, re-obtaining the changed configuration information from the cloud configuration center to update the configuration of the cloud gateway with the changed configuration information; sending a configuration change instruction to the edge gateway to make the edge gateway initiate a configuration request again, and updating the configuration of the edge gateway according to the re-initiated configuration request.

[0013] In this embodiment of the application, the method further includes: when the failure of the first session information in the cloud session manager is detected, sending a cloud session failure instruction to the edge gateway, so that the edge gateway encrypts the first login information according to the preset header information; obtaining the encrypted first login information sent by the edge gateway, and regenerating the first session information according to the encrypted first login information, so that the first session information in the cloud session manager is synchronized with the first session information in the edge session manager.

[0014] In this embodiment of the application, the method further includes: when the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, obtaining a first service request sent by the cloud user, wherein the first service request carries a first service route; when the routing forwarding identifier of the first service route is a cloud identifier, saving the first service route to the cloud gateway; and when the routing forwarding identifier of the first service route is an edge identifier, forwarding the first service route to the edge gateway.

[0015] A second aspect of this application provides a machine-readable storage medium storing instructions that, when executed by a processor, configure the processor to perform the aforementioned method for synchronizing session information.

[0016] A third aspect of this application provides a processor configured to perform the above-described method for synchronizing session information.

[0017] A fourth aspect of this application provides a method for synchronizing session information, applied to an edge gateway, wherein the edge gateway and the cloud gateway are peer gateways using the same architecture, comprising:

[0018] Send the first login request to the cloud gateway. The first login request carries the first login information of the edge user.

[0019] Receive the first session information. The first session information is generated and returned by the cloud gateway when verifying the first login information and the authentication result of the first login information is successful.

[0020] Store the first session information in the edge session manager;

[0021] If the edge session manager detects that the first session information is invalid, an edge session invalidation command is sent to the cloud gateway so that the cloud gateway encrypts the first login information using preset header information.

[0022] Obtain the encrypted first login information sent by the cloud gateway, and regenerate the first session information based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

[0023] In this embodiment of the application, the method further includes: when the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, obtaining a second service request sent by the edge user, the second service request carrying a second service route; when the routing forwarding identifier of the second service route is an edge identifier, saving the second service route to the edge gateway; and when the routing forwarding identifier of the second service route is a cloud identifier, forwarding the second service route to the cloud gateway.

[0024] A fifth aspect of this application provides a machine-readable storage medium storing instructions that, when executed by a processor, configure the processor to perform the aforementioned method for synchronizing session information.

[0025] The sixth aspect of this application provides a processor configured to perform the above-described method for synchronizing session information.

[0026] The seventh aspect of this application provides a method for synchronizing session information, wherein the cloud gateway and the edge gateway are peer gateways using the same architecture, including:

[0027] The edge gateway sends the first login request to the cloud gateway. The first login request carries the first login information of the edge user.

[0028] The cloud gateway verifies the first login information and, if the authentication result of the first login information is successful, generates the first session information corresponding to the first login information;

[0029] The cloud gateway stores the first session information in the cloud session manager and returns the first session information to the edge gateway;

[0030] The edge gateway stores the first session information in the edge session manager and checks whether the first session information in the edge session manager has expired.

[0031] If the edge gateway detects that the first session information in the edge session manager has expired, the edge gateway sends an edge session expiration command to the cloud gateway.

[0032] The cloud gateway encrypts the first login information using preset header information and sends the encrypted first login information to the edge gateway.

[0033] The edge gateway regenerates the first session information based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

[0034] In this embodiment of the application, the method further includes: when the cloud gateway detects that the first session information in the cloud session manager has expired, the cloud gateway sends a cloud session expiration instruction to the edge gateway; the edge gateway encrypts the first login information according to the preset header information and sends the encrypted first login information to the cloud gateway; the cloud gateway regenerates the first session information according to the encrypted first login information, so that the first session information in the cloud session manager is synchronized with the first session information in the edge session manager.

[0035] An eighth aspect of this application provides a machine-readable storage medium storing instructions that, when executed by a processor, configure the processor to perform the aforementioned method for synchronizing session information.

[0036] The ninth aspect of this application provides a processor configured to perform the above-described method for synchronizing session information.

[0037] The tenth aspect of this application provides a system for synchronizing session information, the system comprising:

[0038] A cloud gateway, including the aforementioned processor, configured to execute the aforementioned method for acquiring data; and

[0039] The edge gateway includes the processor described above, which is configured to execute the method described above for collecting data.

[0040] Through the above technical solution, mutual recognition and trust between the cloud gateway and the edge gateway, which adopt the same architecture, are achieved, which greatly reduces the development and operation and maintenance costs. Edge authentication requires sending a request to the cloud. The cloud can perform authentication based on the request sent by the edge. After the session information of the edge expires, the session information can be synchronized to the edge in a timely manner through the cloud, while ensuring the security of the session information synchronized between the cloud and the edge.

[0041] Other features and advantages of the embodiments of this application will be described in detail in the following detailed description section. Attached Figure Description

[0042] The accompanying drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the following detailed description to explain the embodiments of this application, but do not constitute a limitation on the embodiments of this application. In the drawings:

[0043] Figure 1 This illustration schematically shows an application environment diagram of a method for synchronizing session information according to an embodiment of this application;

[0044] Figure 2 This illustration schematically shows a first flowchart of a method for synchronizing session information according to an embodiment of this application;

[0045] Figure 3 This illustration schematically shows a second flowchart of a method for synchronizing session information according to an embodiment of this application;

[0046] Figure 4 This schematically illustrates a third flowchart of a method for synchronizing session information according to an embodiment of this application;

[0047] Figure 5 This schematically illustrates a fourth flowchart of a method for synchronizing session information according to an embodiment of this application;

[0048] Figure 6 The illustration schematically shows a fifth flowchart of a method for synchronizing session information according to an embodiment of this application;

[0049] Figure 7 A schematic diagram illustrating the gateway initialization configuration according to an embodiment of this application is shown.

[0050] Figure 8This illustration schematically shows a service routing and forwarding diagram according to an embodiment of this application;

[0051] Figure 9 A timing diagram illustrating a method for synchronizing session information according to an embodiment of this application is shown schematically.

[0052] Figure 10 The diagram illustrates the internal structure of a computer device according to an embodiment of this application. Detailed Implementation

[0053] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0054] The method for synchronizing session information provided in this application can be applied to, for example... Figure 1 In the application environment shown, cloud gateway 101 communicates with edge gateway 102 via a network. Cloud gateway 101 and edge gateway 102 are peer gateways using the same architecture.

[0055] Figure 2 A schematic flowchart illustrating a method for synchronizing session information according to an embodiment of this application is shown. Figure 2 As shown, in one embodiment of this application, a method for synchronizing session information is provided. This embodiment mainly applies this method to the above-mentioned... Figure 2 Taking cloud gateway 101 as an example, the following steps are included:

[0056] Step 201: Obtain the first login request sent by the edge gateway. The first login request carries the first login information of the edge user.

[0057] Step 202: Verify the first login information, and if the authentication result of the first login information is successful, generate the first session information corresponding to the first login information.

[0058] Step 203: Store the first session information in the cloud session manager and return the first session information to the edge gateway so that the edge gateway stores the first session information in the edge session manager.

[0059] Step 204: If the edge gateway detects that the first session information in the edge session manager has expired, obtain the edge session expiration instruction sent by the edge gateway.

[0060] Step 205: Encrypt the first login information according to the preset header information, and send the encrypted first login information to the edge gateway so that the edge gateway can regenerate the first session information according to the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

[0061] The gateway is used for authentication, rate limiting, and routing. The cloud gateway and the edge gateway are peer gateways using the same architecture. Session information can include user roles and permissions. When synchronizing session information, the processor can obtain the first login request sent by the edge gateway. This first login request carries the edge user's first login information. This first login information can include the edge user's basic login information, such as the edge login account and corresponding password. The processor can verify the first login information. For example, if the edge login account matches the corresponding password, the authentication result of the first login information is considered successful. If the authentication result of the first login information is successful, the processor can generate first session information corresponding to the first login information. For example, the first session information includes the edge user's role and permissions.

[0062] The processor can store the first session information in the cloud session manager and return it to the edge gateway, causing the edge gateway to store the first session information in its own session manager. At this point, both the cloud gateway and the edge gateway's session managers contain the first session information. However, in practice, if the edge device experiences a restart or other operation, the first session information in the edge session manager becomes invalid. In this case, the edge gateway can detect the invalidation of the first session information in its session manager and can send an edge session invalidation command to the cloud gateway. The processor can then receive the edge session invalidation command sent by the edge gateway.

[0063] Upon receiving an edge session expiration instruction, the processor can encrypt the first login information based on preset header information. This preset header information uses an HTTP request mechanism and may include security authentication information, such as accept (supported receiving methods), accept-encoding (supported encoding types), accept-language (supported language types), and connection (supported connection methods). The processor can then send the encrypted first login information to the edge gateway. The edge gateway can then regenerate the first session information based on the encrypted login information, ensuring synchronization between the first session information in the edge session manager and the cloud session manager.

[0064] Through the above technical solution, mutual recognition and trust between the cloud gateway and the edge gateway, which adopt the same architecture, are achieved, which greatly reduces the development and operation and maintenance costs. Edge authentication requires sending a request to the cloud. The cloud can perform authentication based on the request sent by the edge. After the session information of the edge expires, the session information can be synchronized to the edge in a timely manner through the cloud, while ensuring the security of the session information synchronized between the cloud and the edge.

[0065] In one embodiment, the method further includes: obtaining a second login request sent by a cloud user, the second login request carrying the cloud user's second login information; verifying the second login information, and generating second session information corresponding to the second login information if the authentication result of the second login information is successful; storing the second session information in a cloud session manager, and encrypting the second login information with preset header information; sending the encrypted second login information to an edge gateway, so that the edge gateway generates second session information based on the encrypted second login information, so that the second session information in the edge session manager is synchronized with the second session information in the cloud session manager.

[0066] The processor can obtain a second login request sent by a cloud user. This second login request carries the cloud user's second login information. This second login information may include the cloud user's basic login information, such as their cloud login account and corresponding password. The processor can verify this second login information. For example, if the cloud login account matches the corresponding cloud login password, the authentication result of the second login information is considered successful. At this point, the processor can generate second session information corresponding to the second login information. For example, the second session information includes the cloud user's role and cloud user permissions.

[0067] The processor can store the second session information in the cloud session manager and encrypt the second login information according to preset header information. The preset header information is an HTTP request mechanism and may include security authentication information, such as accept (supported receiving methods), accept-encoding (supported encoding types), accept-language (supported language types), and connection (supported connection methods). The processor can then send the encrypted second login information to the edge gateway, enabling the edge gateway to generate second session information based on the encrypted second login information, thus synchronizing the second session information in the edge session manager with that in the cloud session manager. That is, if the cloud gateway's cloud session manager stores the second session information, it can synchronize this second session information to the edge gateway's edge session manager using the above method.

[0068] In one embodiment, the method further includes: before obtaining the first login request sent by the edge gateway or the second login request sent by the cloud user, obtaining the configuration request sent by the edge gateway; obtaining the configuration information corresponding to the configuration request from the cloud configuration center, so as to complete the initial configuration of the cloud gateway through the configuration information; and sending the configuration information to the edge gateway, so that the edge gateway can complete the initial configuration of the edge gateway through the configuration information.

[0069] To better synchronize session information between the edge gateway and the cloud gateway, unified configuration can be performed on both before receiving the first login request from the edge gateway or the second login request from the cloud user. Specifically, the processor can receive the configuration request sent by the edge gateway. Then, the processor can obtain the configuration information corresponding to the configuration request from the cloud configuration center to complete the initial configuration of the cloud gateway. Next, the processor can send the configuration information to the edge gateway so that the edge gateway can complete its initial configuration. In this scheme, the configurations of both the cloud gateway and the edge gateway are managed uniformly through the cloud configuration center. The edge gateway can retrieve remote configurations through the proxy service provided by the cloud gateway, enabling better synchronization of session information between the edge gateway and the cloud gateway.

[0070] In one embodiment, the method further includes: after completing the initial configuration of the cloud gateway and the edge gateway, detecting whether the configuration information of the cloud configuration center has changed; if the configuration information of the cloud configuration center has changed, retrieving the changed configuration information from the cloud configuration center to update the configuration of the cloud gateway with the changed configuration information; sending a configuration change instruction to the edge gateway to make the edge gateway initiate a configuration request again, and updating the configuration of the edge gateway according to the re-initiated configuration request.

[0071] After completing the initial configuration of the cloud gateway and edge gateway, the processor can detect whether the configuration information in the cloud configuration center has changed. If the configuration information in the cloud configuration center has changed, the processor can retrieve the changed configuration information from the cloud configuration center to update the configuration of the cloud gateway. The processor can also send a configuration change command to the edge gateway, causing the edge gateway to re-initiate a configuration request, and update the configuration of the edge gateway based on the re-initiated configuration request. In this scheme, when the configuration information in the cloud configuration center changes, the corresponding configuration information of the cloud gateway and edge gateway will also change accordingly.

[0072] In one embodiment, the method further includes: when a first session information failure is detected in the cloud session manager, sending a cloud session failure instruction to the edge gateway, so that the edge gateway encrypts the first login information according to preset header information; obtaining the encrypted first login information sent by the edge gateway, and regenerating the first session information according to the encrypted first login information, so that the first session information in the cloud session manager is synchronized with the first session information in the edge session manager.

[0073] If the processor detects that the first session information in the cloud session manager has expired, it can send a cloud session expiration command to the edge gateway, causing the edge gateway to encrypt the first login information according to preset header information. The edge gateway then sends the encrypted first login information to the processor. The processor can obtain this encrypted first login information and regenerate the first session information based on it, thus synchronizing the first session information in the cloud session manager with that in the edge session manager. This scheme can promptly synchronize session information to the cloud via the edge after the cloud session information expires, while ensuring the security of synchronizing session information between the cloud and the edge.

[0074] For example, such as Figure 3 The diagram illustrates another method for synchronizing session information. At the edge, an edge gateway and its corresponding session manager are deployed; at the cloud, a cloud gateway and its corresponding session manager are deployed. After a user initiates a login request at the edge, the edge gateway sends the request to the cloud gateway. After successful login verification, the cloud gateway generates corresponding session information. The cloud gateway then writes this session information to the cloud session manager and returns the login session to the edge gateway, thus writing the session information to the edge session manager. At this point, the session information at the edge and cloud is synchronized. If the session information in either the edge or cloud session manager becomes invalid, the invalid end can send an invalidation command to the valid end. The valid end can then encrypt and transmit the user's login information from the edge to the invalid end using the user context header. This allows the invalid end to recover the corresponding session information through dynamic session recovery, thereby synchronizing the session information between the edge and cloud.

[0075] In one embodiment, the method further includes: when the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, obtaining a first service request sent by the cloud user, the first service request carrying a first service route; when the routing forwarding identifier of the first service route is a cloud identifier, saving the first service route to the cloud gateway; and when the routing forwarding identifier of the first service route is an edge identifier, forwarding the first service route to the edge gateway.

[0076] When the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, the processor can obtain the first service request sent by the cloud user. This first service request carries the first service route. If the routing forwarding identifier of the first service route is a cloud identifier, the processor can save the first service route to the cloud gateway. If the routing forwarding identifier of the first service route is an edge identifier, the processor can forward the first service route to the edge gateway. Furthermore, if it is necessary to forward the first service route to the edge gateway, i.e., to perform cross-domain forwarding of the first service route, the forwarding can carry information such as the session ID, user context information, and security verification header information.

[0077] In one embodiment, a storage medium is provided on which a program is stored, which, when executed by a processor, implements the above-described method for synchronizing session information, the method being applied to a cloud gateway.

[0078] In one embodiment, a processor is provided for running a program, wherein the program executes the above-described method for synchronizing session information, the method being applied to a cloud gateway.

[0079] Figure 4 A schematic flowchart illustrating a method for synchronizing session information according to an embodiment of this application is shown. Figure 4 As shown, in one embodiment, another method for synchronizing session information is provided. This embodiment mainly applies this method to the above-mentioned... Figure 2 Taking the edge gateway 102 as an example, the following steps are included:

[0080] Step 401: Send the first login request to the cloud gateway. The first login request carries the first login information of the edge user.

[0081] Step 402: Receive the first session information. The first session information is generated and returned by the cloud gateway when verifying the first login information and the authentication result of the first login information is successful.

[0082] Step 403: Store the first session information in the edge session manager.

[0083] Step 404: If the edge session manager detects that the first session information is invalid, send an edge session invalidation command to the cloud gateway so that the cloud gateway encrypts the first login information using preset header information.

[0084] Step 405: Obtain the encrypted first login information sent by the cloud gateway, and regenerate the first session information based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

[0085] The gateway is used for authentication, rate limiting, and routing. The cloud gateway and edge gateway are peer gateways using the same architecture. Session information may include user roles and permissions. When synchronizing session information, the processor can send a first login request to the cloud gateway. This first login request carries the edge user's initial login information. This information may include the edge user's basic login information, such as the edge login account and corresponding password. After receiving the first login information, the cloud gateway can verify it. For example, if the edge login account matches the corresponding password, the authentication result is considered successful. If the authentication result is successful, the cloud gateway can generate first session information corresponding to the first login information. Furthermore, the cloud gateway can store this first session information in the cloud session manager and send it to the processor.

[0086] The processor can receive the first session information and store it in the edge session manager. At this point, both the cloud gateway and the edge gateway's session manager contain the first session information. However, in practice, if the edge device experiences a restart or other operation, the first session information in the edge session manager becomes invalid. In this case, the processor can detect the invalidation of the first session information in the edge session manager. The processor can then send an edge session invalidation command to the cloud gateway. The cloud gateway can encrypt the first login information using preset header information and send the encrypted first login information to the processor. The preset header information uses an HTTP request mechanism and can include security authentication information, such as accept (supported receiving methods), accept-encoding (supported encoding types), accept-language (supported language types), and connection (supported connection methods). The processor can obtain the encrypted first login information sent by the cloud gateway and regenerate the first session information based on the encrypted first login information, thus synchronizing the first session information in the edge session manager with that in the cloud session manager.

[0087] Through the above technical solution, mutual recognition and trust between the cloud gateway and the edge gateway, which adopt the same architecture, are achieved, which greatly reduces the development and operation and maintenance costs. Edge authentication requires sending a request to the cloud. The cloud can perform authentication based on the request sent by the edge. After the session information of the edge expires, the session information can be synchronized to the edge in a timely manner through the cloud, while ensuring the security of the session information synchronized between the cloud and the edge.

[0088] In one embodiment, the method further includes: when the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, obtaining a second service request sent by the edge user, the second service request carrying a second service route; when the routing forwarding identifier of the second service route is an edge identifier, saving the second service route to the edge gateway; and when the routing forwarding identifier of the second service route is a cloud identifier, forwarding the first service route to the cloud gateway.

[0089] When the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, the processor can obtain the second service request sent by the edge user, in which the second service request carries the second service route. If the routing forwarding identifier of the second service route is the edge identifier, the processor can save the second service route to the edge gateway; if the routing forwarding identifier of the second service route is the cloud identifier, the processor can forward the second service route to the cloud gateway. Furthermore, if it is necessary to forward the second service route to the cloud gateway, that is, to perform cross-domain forwarding of the second service route, the forwarding can carry information such as sessionID, user context information, and security verification header information.

[0090] In one embodiment, a storage medium is provided on which a program is stored, which, when executed by a processor, implements the method described above for synchronizing session information, the method being applied to an edge gateway.

[0091] In one embodiment, a processor is provided for running a program, wherein the program executes the above-described method for synchronizing session information, the method being applied to an edge gateway.

[0092] Figure 5 A schematic flowchart illustrating a method for synchronizing session information according to an embodiment of this application is shown. Figure 5 As shown, in one embodiment, another method for synchronizing session information is provided, comprising the following steps:

[0093] Step 501: The edge gateway sends a first login request to the cloud gateway. The first login request carries the first login information of the edge user.

[0094] Step 502: The cloud gateway verifies the first login information and, if the authentication result of the first login information is successful, generates the first session information corresponding to the first login information.

[0095] Step 503: The cloud gateway stores the first session information in the cloud session manager and returns the first session information to the edge gateway.

[0096] Step 504: The edge gateway stores the first session information in the edge session manager and checks whether the first session information in the edge session manager is invalid.

[0097] Step 505: If the edge gateway detects that the first session information in the edge session manager has expired, the edge gateway sends an edge session expiration command to the cloud gateway.

[0098] Step 506: The cloud gateway encrypts the first login information using preset header information and sends the encrypted first login information to the edge gateway.

[0099] Step 507: The edge gateway regenerates the first session information based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

[0100] Gateways are used for authentication, rate limiting, and routing. The cloud gateway and edge gateway are peer gateways using the same architecture. Session information can include user roles and permissions. When synchronizing session information, the edge gateway sends a first login request to the cloud gateway. This first login request carries the edge user's initial login information. This information can include the edge user's basic login information, such as the edge login account and corresponding password. After receiving the first login information, the cloud gateway can verify it. For example, if the edge login account matches the corresponding password, the authentication result is considered successful. If the authentication result is successful, the cloud gateway can generate first session information corresponding to the first login information. Further, the cloud gateway can store this first session information in its cloud session manager and return it to the edge gateway. The edge gateway can receive the first session information and store it in its edge session manager. At this point, both the cloud gateway and the edge gateway's session managers contain the first session information.

[0101] In practice, if the edge device experiences a restart or other operation, the first session information in the edge session manager becomes invalid. That is, the edge gateway can detect whether the first session information in the edge session manager is invalid. When the edge gateway detects invalid first session information in the edge session manager, it sends an edge session invalidation command to the cloud gateway. At this time, the cloud gateway encrypts the first login information using preset header information and sends the encrypted first login information to the edge gateway. The preset header information uses an HTTP request mechanism and can include security authentication information, such as accept (supported receiving methods), accept-encoding (supported encoding types), accept-language (supported language types), and connection (supported connection methods). The edge gateway regenerates the first session information based on the encrypted first login information to synchronize the first session information in the edge session manager with that in the cloud session manager.

[0102] Through the above technical solution, mutual recognition and trust between the cloud gateway and the edge gateway, which adopt the same architecture, are achieved, which greatly reduces the development and operation and maintenance costs. Edge authentication requires sending a request to the cloud. The cloud can perform authentication based on the request sent by the edge. After the session information of the edge expires, the session information can be synchronized to the edge in a timely manner through the cloud, while ensuring the security of the session information synchronized between the cloud and the edge.

[0103] In one embodiment, the method further includes: when the cloud gateway detects that the first session information in the cloud session manager has expired, the cloud gateway sends a cloud session expiration instruction to the edge gateway; the edge gateway encrypts the first login information according to preset header information and sends the encrypted first login information to the cloud gateway; the cloud gateway regenerates the first session information according to the encrypted first login information so that the first session information in the cloud session manager is synchronized with the first session information in the edge session manager.

[0104] If the cloud gateway detects that the first session information in the cloud session manager has expired, it sends a cloud session expiration command to the edge gateway. The edge gateway encrypts the first login information according to preset header information and sends the encrypted first login information to the cloud gateway. The preset header information uses an HTTP request mechanism and may include security authentication information, such as accept (supported receiving methods), accept-encoding (supported encoding types), accept-language (supported language types), and connection (supported connection methods). The cloud gateway then regenerates the first session information based on the encrypted first login information to synchronize the first session information in the cloud session manager with that in the edge session manager. This scheme enables timely synchronization of session information from the edge to the cloud after the session information in the cloud expires, while also ensuring the security of synchronizing session information between the cloud and the edge.

[0105] In one embodiment, such as Figure 6 The diagram shows a flowchart of a method for synchronizing session information.

[0106] When synchronizing session information, edge users can send requests to the edge gateway through their clients, operations personnel can send requests to the cloud gateway through the management backend, and drivers and other operators can send requests through mini-programs or apps. The edge gateway and cloud gateway can distribute bidirectional requests. The edge deployment includes an edge gateway, a POD (edge-side business service), and a MySQL (relational database). The edge business service can provide production management services and data synchronization services. The production management service is used for local production management, while the data synchronization service is used for edge-to-cloud data synchronization. MySQL is used to store data produced at the edge. The cloud deployment includes a cloud gateway, a POD (cloud-side business service), and a MySQL database. The cloud business service can provide operations-related services such as customer and order management. The edge and cloud can synchronize session information through a session consistency mechanism. Under the premise of a unified session, the edge and cloud can use Feign to call the proxy to achieve mutual access between edge-to-cloud and cloud-to-edge services.

[0107] For example, such as Figure 7The diagram illustrates a gateway initialization configuration. At the edge, an edge gateway and local configuration are deployed; at the cloud, a cloud gateway and configuration center are deployed. When unified configuration of the edge and cloud gateways is required, the edge gateway can request remote configuration from the cloud gateway. The cloud gateway can then retrieve the corresponding edge configuration from the configuration center and return it to the edge gateway. The edge gateway can write this edge configuration to its local configuration cache, thus completing its initial configuration. Subsequently, if the configuration information in the configuration center changes, a configuration change notification can be sent to the edge gateway, causing it to re-initiate the remote configuration request to update its configuration information accordingly.

[0108] For example, such as Figure 8 The diagram illustrates a service routing and forwarding process. An edge user initiates a request to the edge gateway, which forwards the service route based on the route identifier carried in the request. For example, the route identifier could be a local service route 1 or a cloud service route 1. The edge gateway can save the local service route 1 locally and forward the cloud service route 1 to the cloud gateway. Cloud services may include services that collect data such as supplier information, orders, and contracts. Edge services may include services related to production data, such as collecting production plans. For example, if the edge is deployed at a mixing plant, an edge user may initiate a request to collect material supplier data for that plant. In this case, the edge gateway can obtain the request and forward it to the cloud gateway to collect the material supplier data.

[0109] In one embodiment, such as Figure 9 As shown, a timing diagram is provided for a method of synchronizing session information.

[0110] When the edge and cloud systems start up, the edge gateway can send a configuration request to the cloud gateway. The cloud gateway can retrieve the corresponding configuration information from the cloud configuration center based on the configuration request and send this information to the edge gateway. The edge gateway can store the corresponding configuration information locally. After determining that the configuration information in the cloud configuration center has changed, the cloud gateway can send a configuration change notification to the edge gateway. The edge gateway can update the corresponding configuration information based on this notification. After both the edge and cloud gateways have completed configuration, edge users can send login requests to the edge gateway as needed, and the edge gateway can forward these requests to the cloud gateway. The cloud gateway can authenticate the login information carried in the login request. After successful authentication, the cloud gateway can generate session information corresponding to this login information. The cloud gateway can write this session information to the cloud session manager and return it to the edge gateway. The edge gateway can then write the returned session information to the edge session manager.

[0111] If the edge gateway detects that the session information in the edge session manager is invalid, it can send an invalidation notification to the cloud gateway. Upon receiving this notification, the cloud gateway can encrypt the login information according to a custom header and send the encrypted login information to the edge gateway. The edge gateway can decrypt the encrypted login information and regenerate session information corresponding to the decrypted login information. This regenerated session information is identical to the session information in the cloud session manager. The edge gateway can then write this session information to the edge session manager. At this point, the session information on the edge is synchronized with the session information on the cloud. Similarly, if the cloud gateway detects that the session information in the cloud session manager is invalid, it can send an invalidation notification to the edge gateway. Upon receiving this notification, the edge gateway can encrypt the login information according to a custom header and send the encrypted login information to the cloud gateway. The cloud gateway can decrypt the encrypted login information and regenerate session information corresponding to the decrypted login information. This regenerated session information is identical to the session information in the edge session manager. The cloud gateway can write this session information to the cloud session manager. At this point, the session information on the edge device is synchronized with the session information on the cloud device.

[0112] Cloud users can send login requests to the cloud gateway as needed. The cloud gateway can authenticate the login information carried in the login request. After successful authentication, the cloud gateway can generate session information corresponding to the login information. The cloud gateway can write this session information to the cloud session manager. Then, the cloud gateway can encrypt the login information according to custom header information and send the encrypted login information to the edge gateway. The edge gateway can decrypt the encrypted login information and generate session information corresponding to the decrypted login information. The generated session information is identical to the session information in the cloud session manager. The edge gateway can write this session information to the edge session manager. At this point, the edge's session information is synchronized with the cloud's session information.

[0113] Edge users can send service requests to the edge gateway as needed. These service requests carry the corresponding service route. When the edge gateway determines that the forwarding identifier of the service route is an edge identifier, it can retain that service route locally. When the edge gateway determines that the forwarding identifier of the service route is a cloud identifier, it can forward the service route to the cloud. Cloud users can send service requests to the cloud gateway as needed. These service requests carry the corresponding service route. When the cloud gateway determines that the forwarding identifier of the service route is a cloud identifier, it can retain that service route locally. When the cloud gateway determines that the forwarding identifier of the service route is an edge identifier, it can forward the service route to the edge.

[0114] Through the above technical solution, mutual recognition and trust between the cloud gateway and the edge gateway, which adopt the same architecture, are achieved, which greatly reduces the development and operation and maintenance costs. Edge authentication requires sending a request to the cloud. The cloud can perform authentication based on the request sent by the edge. It can promptly synchronize the session information from the cloud to the edge after the session information on the edge expires, and it can also promptly synchronize the session information from the edge to the cloud after the session information on the cloud expires, while ensuring the security of synchronizing the session information between the cloud and the edge.

[0115] In one embodiment, a storage medium is provided on which a program is stored, which, when executed by a processor, implements the method described above for synchronizing session information.

[0116] In one embodiment, a processor is provided for running a program, wherein the program executes the method described above for synchronizing session information during runtime.

[0117] Figure 2-6 This is a flowchart illustrating a method for synchronizing session information in one embodiment. It should be understood that, although... Figure 2-6 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2-6 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0118] In one embodiment, a system for synchronizing session information is provided, the system comprising:

[0119] A cloud gateway, including the aforementioned processor, configured to execute the aforementioned method for acquiring data; and

[0120] The edge gateway includes the processor described above, which is configured to execute the method described above for collecting data.

[0121] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown. The computer device includes a processor A01, a network interface A02, memory (not shown), and a database (not shown) connected via a system bus. The processor A01 provides computing and control capabilities. The memory includes internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02, and a database (not shown). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 stored in the non-volatile storage medium A04. The database stores data such as session information. The network interface A02 communicates with external terminals via a network connection. When executed by the processor A01, the computer program B02 implements a method for synchronizing session information.

[0122] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0123] This application provides an apparatus including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements method steps for synchronizing session information.

[0124] This application also provides a computer program product that, when executed on a data processing device, is adapted to execute a program having method steps for synchronizing session information.

[0125] 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.

[0126] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0127] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0128] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0129] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0130] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0131] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0132] 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.

[0133] 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 method for synchronizing session information, characterized in that, Applied to a cloud gateway, wherein the cloud gateway and the edge gateway are peer gateways using the same architecture, the method includes: Obtain the first login request sent by the edge gateway, wherein the first login request carries the first login information of the edge user; Verify the first login information, and if the authentication result of the first login information is successful, generate the first session information corresponding to the first login information; The first session information is stored in the cloud session manager, and the first session information is returned to the edge gateway so that the edge gateway stores the first session information in the edge session manager; If the edge gateway detects that the first session information in the edge session manager has expired, the edge session expiration instruction sent by the edge gateway is obtained. The first login information is encrypted according to preset header information, and the encrypted first login information is sent to the edge gateway, so that the edge gateway regenerates the first session information according to the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager. The preset header information is an HTTP request mechanism, including security authentication information.

2. The method for synchronizing session information according to claim 1, characterized in that, The method further includes: Obtain the second login request sent by the cloud user, the second login request carrying the cloud user's second login information; Verify the second login information, and if the authentication result of the second login information is successful, generate the second session information corresponding to the second login information; The second session information is stored in the cloud session manager, and the second login information is encrypted using the preset header information; The encrypted second login information is sent to the edge gateway so that the edge gateway generates the second session information based on the encrypted second login information, thereby synchronizing the second session information in the edge session manager with the second session information in the cloud session manager.

3. The method for synchronizing session information according to claim 1 or 2, characterized in that, The method further includes: Before obtaining the first login request sent by the edge gateway or the second login request sent by the cloud user, obtain the configuration request sent by the edge gateway; The configuration information corresponding to the configuration request is obtained from the cloud configuration center, so as to complete the initial configuration of the cloud gateway through the configuration information; The configuration information is sent to the edge gateway so that the edge gateway can complete the initial configuration of the edge gateway using the configuration information.

4. The method for synchronizing session information according to claim 3, characterized in that, The method further includes: After completing the initial configuration of the cloud gateway and the edge gateway, check whether the configuration information of the cloud configuration center has changed; If the configuration information in the cloud configuration center changes, the changed configuration information is retrieved from the cloud configuration center again to update the configuration of the cloud gateway using the changed configuration information; A configuration change instruction is sent to the edge gateway so that the edge gateway re-initiates the configuration request and updates the configuration of the edge gateway according to the re-initiated configuration request.

5. The method for synchronizing session information according to claim 1, characterized in that, The method further includes: If the cloud session manager detects that the first session information has expired, a cloud session expiration command is sent to the edge gateway so that the edge gateway encrypts the first login information according to the preset header information. The encrypted first login information sent by the edge gateway is obtained, and the first session information is regenerated based on the encrypted first login information, so that the first session information in the cloud session manager is synchronized with the first session information in the edge session manager.

6. The method for synchronizing session information according to claim 1, characterized in that, The method further includes: When the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, the first service request sent by the cloud user is obtained, and the first service request carries the first service route; If the routing forwarding identifier of the first service route is a cloud identifier, the first service route is saved to the cloud gateway; If the routing forwarding identifier of the first service route is an edge identifier, the first service route is forwarded to the edge gateway.

7. A method for synchronizing session information, characterized in that, Applied to an edge gateway, wherein the edge gateway and the cloud gateway are peer gateways using the same architecture, the method includes: Send a first login request to the cloud gateway, the first login request carrying the first login information of the edge user; Receive first session information, which is generated and returned by the cloud gateway when verifying the first login information and the authentication result of the first login information is successful; Store the first session information in the edge session manager; If the edge session manager detects that the first session information has expired, an edge session expiration instruction is sent to the cloud gateway so that the cloud gateway encrypts the first login information using preset header information, wherein the preset header information is an HTTP request mechanism that includes security authentication information; The encrypted first login information sent by the cloud gateway is obtained, and the first session information is regenerated based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

8. The method for synchronizing session information according to claim 7, characterized in that, The method further includes: When the first session information in the edge session manager is synchronized with the first session information in the cloud session manager, a second service request sent by the edge user is obtained, and the second service request carries a second service route. If the routing forwarding identifier of the second service route is an edge identifier, the second service route is saved to the edge gateway; If the routing forwarding identifier of the second service route is a cloud identifier, the second service route is forwarded to the cloud gateway.

9. A method for synchronizing session information, characterized in that, The cloud gateway and the edge gateway are peer gateways using the same architecture. The method includes: The edge gateway sends a first login request to the cloud gateway, and the first login request carries the first login information of the edge user; The cloud gateway verifies the first login information, and if the authentication result of the first login information is successful, it generates first session information corresponding to the first login information; The cloud gateway stores the first session information in the cloud session manager and returns the first session information to the edge gateway; The edge gateway stores the first session information in the edge session manager and detects whether the first session information in the edge session manager has expired. If the edge gateway detects that the first session information in the edge session manager has expired, the edge gateway sends an edge session expiration command to the cloud gateway. The cloud gateway encrypts the first login information using preset header information and sends the encrypted first login information to the edge gateway. The preset header information is an HTTP request mechanism that includes security authentication information. The edge gateway regenerates the first session information based on the encrypted first login information, so that the first session information in the edge session manager is synchronized with the first session information in the cloud session manager.

10. The method for synchronizing session information according to claim 9, characterized in that, The method further includes: If the cloud gateway detects that the first session information in the cloud session manager has expired, the cloud gateway sends a cloud session expiration command to the edge gateway. The edge gateway encrypts the first login information according to the preset header information and sends the encrypted first login information to the cloud gateway. The cloud gateway regenerates the first session information based on the encrypted first login information, so that the first session information in the cloud session manager is synchronized with the first session information in the edge session manager.

11. A machine-readable storage medium storing instructions thereon, characterized in that, When executed by a processor, this instruction causes the processor to be configured to perform the method for synchronizing session information according to any one of claims 1 to 6.

12. A processor, characterized in that, It is configured to perform the method for synchronizing session information as described in any one of claims 1 to 6.

13. A machine-readable storage medium storing instructions thereon, characterized in that, When executed by a processor, this instruction causes the processor to be configured to perform the method for synchronizing session information as described in claim 7 or 8.

14. A processor, characterized in that, It is configured to perform the method for synchronizing session information as described in claim 7 or 8.

15. A system for synchronizing session information, characterized in that, The system includes: The cloud gateway includes the processor as claimed in claim 12; and An edge gateway, including the processor as described in claim 14.