A delay method, device, equipment and storage medium

By extending the validity period of the identity returned by the server, the problem of frequent login by the client is solved, saving software resources and improving efficiency.

CN116137572BActive Publication Date: 2025-07-11CHINA NAT PETROLEUM CORP +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111356461.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-16
Publication Date
2025-07-11
Estimated Expiration
2041-11-16

AI Technical Summary

Technical Problem

In the prior art, the identity returned by the server is short, resulting in frequent login by the client and wasting software resources.

Method used

The server determines whether the identity is within the validity period, and when the extension conditions are met, the validity period of the identity is extended, and the client's identity is updated through the normal request process.

Benefits of technology

Reduces the number of logins on the client, saves software resources, and simplifies the identification delay process and improves efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116137572B_ABST
    Figure CN116137572B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, device and storage medium for extension. Among them, the method for extension includes: after receiving a request carrying a first identifier sent by a client, judging whether the first identifier is within the valid period according to the first time included in the first identifier; if the first identifier is within the valid period, judging whether a target time difference meets a preset extension condition, where the target time difference is the absolute value of the time difference between the current time and the first time; if the target time difference meets the extension condition, extending the first time included in the first identifier to a second time to obtain a second identifier including the second time; sending a request result carrying the second identifier to the client so that the client updates the stored identifier with the second identifier, where the updated stored identifier includes the second time; through the above method, the validity period of the identifier is extended when the identifier has not expired, which is beneficial to reducing the number of client logins and saving software resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technologies, and in particular, to a method, device, equipment, and storage medium for extension. Background Art

[0002] In the prior art, when receiving a request sent by a client, the server needs to first verify the identity information of the user who has successfully logged in to the client, and only when the verification is successful, will it respond to the request; therefore, every time the client sends a request to the server, it needs to first log in to obtain identity information, and then send the obtained identity information to the server.

[0003] To simplify the process of the client sending a request to the server, when the client logs in for the first time, the server can, according to the identity information sent by the client, return an identifier for verifying the client's identity information to the client, so that when the client sends a request each time, it does not need to log in, and only needs to send this identifier to the server, and the server can perform identity verification based on this identifier. However, the above identifier sent by the server to the client has a short validity period, and when the validity period ends, the client needs to log in again; during this process, the shorter the validity period, the more frequently the client logs in, thus wasting more software resources. Summary of the Invention

[0004] In view of this, embodiments of this application provide a method, device, equipment, and storage medium for extension, which can extend the validity period of an identifier when the identifier has not expired, which is beneficial to reducing the number of logins of the client and saving software resources.

[0005] It mainly includes the following aspects:

[0006] In a first aspect, an embodiment of this application provides a method for extension, which is applied to a server, and the method for extension includes:

[0007] After receiving a request carried with a first identifier sent by a client, judge whether the first identifier is within the validity period according to a first time included in the first identifier, where the first identifier is an identifier set by the server for representing the identity information of the user who has successfully logged in to the client;

[0008] If the first identifier is within the validity period, judge whether a target time difference meets a preset extension condition, where the target time difference is the absolute value of the time difference between the current time and the first time;

[0009] If the target time difference meets the extension condition, extend the first time included in the first identifier to a second time to obtain a second identifier including the second time;

[0010] Send the request result carrying the second identifier to the client so that the client uses the second identifier to update the stored identifier, where the updated stored identifier includes the second time.

[0011] Optionally, before determining whether the first identifier is within the valid period at the first time included in the first identifier, the extension method further includes:

[0012] Decrypt the first identifier using the stored key;

[0013] Determine whether the decryption is successful;

[0014] If the decryption is successful, obtain the first time included in the first identifier.

[0015] Optionally, the first time includes the generation time of the first identifier and / or the expiration time of the first identifier. Determining whether the first identifier is within the valid period includes:

[0016] When the first time includes the generation time, determine whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the first preset threshold, the first identifier is within the valid period;

[0017] When the first time includes the expiration time, determine whether the current time is earlier than or equal to the expiration time. If it is earlier than or equal to the expiration time, the first identifier is within the valid period.

[0018] Optionally, determining whether the target time difference meets the preset extension condition includes:

[0019] When the first time includes the generation time, determine whether the first target time difference is greater than or equal to a second preset threshold. If it is greater than or equal to the second preset threshold, the first target time difference meets the extension condition, where the first target time difference is the absolute value of the time difference between the current time and the generation time;

[0020] When the first time includes the expiration time, determine whether the second target time difference is less than or equal to a third preset threshold. If it is less than or equal to the third preset threshold, the second target time difference meets the extension condition, where the second target time difference is the absolute value of the time difference between the current time and the expiration time.

[0021] Optionally, if the first identifier is not within the valid period, the extension method further includes:

[0022] Send a prompt message indicating that the first identifier is invalid to the client.

[0023] In a second aspect, an embodiment of the present application provides a deferral device, which is applied to a server. The deferral device includes:

[0024] A first judgment module, configured to, after receiving a request carrying a first identifier sent by a client, judge whether the first identifier is within the validity period according to a first time included in the first identifier, where the first identifier is an identifier set by the server for the client to represent the identity information of the user who successfully logs in to the client;

[0025] A second judgment module, configured to, if the first identifier is within the validity period, judge whether a target time difference meets a preset deferral condition, where the target time difference is the absolute value of the time difference between the current time and the first time;

[0026] A deferral module, configured to, if the target time difference meets the deferral condition, defer the first time included in the first identifier to a second time to obtain a second identifier including the second time;

[0027] A sending module, configured to send a request result carrying the second identifier to the client, so that the client updates the stored identifier with the second identifier, where the updated stored identifier includes the second time.

[0028] Optionally, before the first judgment module judges whether the first identifier is within the validity period according to the first time included in the first identifier, it is further configured to:

[0029] Decrypt the first identifier using a stored key;

[0030] Judge whether the decryption is successful;

[0031] If the decryption is successful, obtain the first time included in the first identifier.

[0032] Optionally, the first time includes the generation time of the first identifier and / or the expiration time of the first identifier. When the first judgment module judges whether the first identifier is within the validity period, it is specifically configured to:

[0033] When the first time includes the generation time, judge whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the first preset threshold, the first identifier is within the validity period;

[0034] When the first time includes the expiration time, judge whether the current time is earlier than or equal to the expiration time. If it is earlier than or equal to the expiration time, the first identifier is within the validity period.

[0035] Optionally, when the second determination module is used to determine whether the target time difference meets a preset extension condition, it is specifically used for:

[0036] When the first time includes the generation time, determine whether the first target time difference is greater than or equal to a second preset threshold. If it is greater than or equal to the second preset threshold, the first target time difference meets the extension condition, where the first target time difference is the absolute value of the time difference between the current time and the generation time;

[0037] When the first time includes the deadline, determine whether the second target time difference is less than or equal to a third preset threshold. If it is less than or equal to the third preset threshold, the second target time difference meets the extension condition, where the second target time difference is the absolute value of the time difference between the current time and the deadline.

[0038] Optionally, if the first identifier is not within the validity period, the extension device further includes:

[0039] A prompt module for sending a prompt message indicating the invalidity of the first identifier to the client.

[0040] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of any one of the extension methods in the first aspect are implemented.

[0041] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of any one of the extension methods in the first aspect are executed.

[0042] The technical solution provided by the embodiment of the present application may include the following beneficial effects:

[0043] The extension method provided by the embodiments of the present application requires the server to only send a first identifier to the client. When the client sends a request, it carries this first identifier. The server first determines whether the first identifier is within the valid period. If it is within the valid period, it determines whether the first identifier is about to expire, that is: it determines whether the absolute value of the time difference between the current time and the first time included in the first identifier meets the extension condition. If the extension condition is met, the first time is extended to the second time, and a second identifier including the second time is carried on the request result of the above request and sent to the client, so that the client can use the second identifier to update the stored identifier; through the above process of the present application, the validity period of the identifier is extended when the identifier has not expired, which is beneficial to reducing the number of client logins and saving software resources. In addition, only one identifier is required for the interaction between the server and the client, and the interaction process utilizes the normal process of the client sending a request and the server responding to the request, without the need to add a new interaction process, which is beneficial to simplifying the process of identifier extension, thereby improving the efficiency of identifier extension.

[0044] To make the above objects, features, and advantages of the present application more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes a detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for the embodiments. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0046] Figure 1 Shows the flowchart of an extension method provided by Embodiment 1 of the present application;

[0047] Figure 2 Shows the flowchart of another extension method provided by Embodiment 1 of the present application;

[0048] Figure 3 Shows the structural schematic diagram of an extension device provided by Embodiment 2 of the present application;

[0049] Figure 4 Shows the structural schematic diagram of a computer device provided by Embodiment 3 of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0050] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part rather than all of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative efforts fall within the scope of protection of this application.

[0051] Currently, in order to extend the validity period, the server will return a short-term validity identifier and a long-term validity identifier to the client when the client logs in for the first time. When the client sends a request, it carries the short-term validity identifier to the server. The server determines whether the short-term validity identifier has expired. If it has expired, the server returns a prompt message to the client, reminding the client that the short-term validity identifier has expired. Then the client sends the long-term validity identifier to the server, so that the server generates a new short-term validity identifier based on the long-term validity identifier and returns the short-term validity identifier to the client to update the short-term validity identifier stored on the client. However, this process requires multiple interactions between the client and the server, which is rather cumbersome and results in a low efficiency of identifier extension.

[0052] Based on this, the embodiments of this application provide a method, device, equipment, and storage medium for extension, which will be described below through embodiments.

[0053] Embodiment 1

[0054] Figure 1 The flowchart of a method for extension provided in Embodiment 1 of this application is shown. As Figure 1 shown, this method for extension is applied to the server and can be implemented through the following steps:

[0055] Step S101: After receiving a request sent by the client and carrying a first identifier, determine whether the first identifier is within the validity period according to the first time included in the first identifier, where the first identifier is an identifier set by the server for the client to represent the identity information of the user who has successfully logged in to the client.

[0056] Specifically, when the user successfully logs in on the client side using the login information, the client side sends the login information to the server side. The server side obtains the identity information of the user based on the received login information and uses a unique identifier to represent the identity information, that is: the first identifier is used to represent the identity information of the user. Among them, the first identifier is, for example, a token; after determining the first identifier, the first identifier is returned to the client side, and the client side carries the first identifier for each request initiated by the server side in the logged-in state.

[0057] It should be noted that the above first identifier may include the identity information of the above user or may not include the identity information of the above user, and no specific limitation is made here.

[0058] It should be noted again that generally, the above first identifier needs to have a validity period. Therefore, the first identifier set by the server side includes a first time. The server side can determine the validity period of the first identifier based on the first time, so as to determine whether the first identifier is within the validity period; in addition, in order to improve the security of the identity information of the above user, before the server side returns the above first identifier to the client side, it is necessary to encrypt the first identifier and store the key used for decryption.

[0059] Step S102: If the above first identifier is within the above validity period, determine whether the target time difference meets the preset extension condition, where the above target time difference is the absolute value of the time difference between the current time and the above first time.

[0060] Specifically, if the first identifier is within the validity period, it means that the first identifier has not expired. In order to extend the period when the first identifier has not expired, it is necessary to first calculate the absolute value of the time difference between the current time and the first time, that is: calculate the target time difference and determine whether the target time difference meets the preset extension condition.

[0061] It should be noted that if the first time includes year, month, day and time (hour, minute, second), then the current time also includes year, month, day and time (hour, minute, second). If the first time only includes year, month and day, then the current time also only includes year, month and day.

[0062] For example: if the first time is March 21, 2021, then the current time is April 1, 2021; if the first time is March 21, 2021, 19:00, then the current time is April 1, 2021, 15:21.

[0063] Step S103: If the above target time difference meets the above extension condition, extend the first time included in the above first identifier to the second time to obtain a second identifier including the second time.

[0064] Specifically, if the target time difference meets the extension condition, it indicates that the first identifier is about to expire, and the first time included in the first identifier needs to be extended. The server extends the first time through components such as gateways, filters, or interceptors, and after the extension, the second time is obtained. The first identifier including the second time is used as the second identifier.

[0065] It should be noted that the difference between the first identifier and the second identifier is only that: the time included in the first identifier is the first time, and the time included in the second identifier is the second time obtained after the extension.

[0066] Step S104: Send the request result carrying the above-mentioned second identifier to the above-mentioned client, so that the above-mentioned client uses the above-mentioned second identifier to update the stored identifier, where the updated stored identifier includes the second time.

[0067] Specifically, after obtaining the second identifier, in order to reduce the interaction between the client and the server and save software resources, the second identifier is carried on the request result (i.e., the response) obtained according to the above request, and the request result carrying the second identifier is sent to the client, so that the client uses the received second identifier to replace the stored identifier to achieve the purpose of updating the stored identifier. The stored identifier was the identifier including the first time before the update and is the above-mentioned second identifier after the update.

[0068] It should be noted that if the above-mentioned first identifier is within the validity period and the above-mentioned target time difference meets the extension condition, the above-mentioned request result is obtained by the server according to the obtained second identifier. If the above-mentioned first identifier is within the validity period but the above-mentioned target time difference does not meet the extension condition, the above-mentioned request result is obtained by the server according to the first identifier.

[0069] In Figure 1In the provided extension method, the server only needs to send a first identifier to the client. The client carries this first identifier when sending a request. The server first determines whether the first identifier is within the valid period. If it is within the valid period, it determines whether the first identifier is about to expire, that is: it determines whether the absolute value of the time difference between the current time and the first time included in the first identifier meets the extension condition. If the extension condition is met, the first time is extended to a second time, and a second identifier including the second time is carried on the request result of the above request and sent to the client, so that the client uses this second identifier to update the stored identifier. Through the above process of this application, the validity period of the identifier is extended when the identifier has not expired, which is beneficial to reducing the number of client logins and saving software resources. In addition, only one identifier is needed for the interaction between the server and the client, and the interaction process utilizes the normal process of the client sending a request and the server responding to the request, without the need to add a new interaction process, which is beneficial to simplifying the process of identifier extension, thereby improving the efficiency of identifier extension.

[0070] In another feasible implementation, before the server sends the request result carrying the above second identifier to the above client, it needs to encrypt the second identifier.

[0071] In another feasible implementation, after the client receives the request result, it determines whether the request result carries a second identifier. If it carries a second identifier, it determines whether the second identifier is the same as the stored identifier. If they are the same, it uses the second identifier to replace the stored identifier. Among them, since both the second identifier and the stored identifier are ciphertexts encrypted by the server and the client cannot decrypt the second identifier and the stored identifier, the process of determining whether the second identifier is the same as the stored identifier is specifically: determining whether the encrypted ciphertext of the second identifier is the same as the ciphertext of the stored identifier. If the encrypted ciphertext of the second identifier is the same as the ciphertext of the stored identifier, it means that the second identifier is the same as the stored identifier.

[0072] In a feasible implementation, Figure 2 shows a flowchart of another extension method provided by the first embodiment of this application. As Figure 2 shown, before determining whether the first identifier is within the valid period according to the first time included in the first identifier in the above step S101, this extension method can also be implemented through the following steps:

[0073] Step S201: Decrypt the above first identifier using the stored key.

[0074] Step S202: Determine whether the decryption is successful.

[0075] Step S203: If the decryption is successful, obtain the first time included in the above first identifier.

[0076] Specifically, since the first identifier sent by the client is an encrypted ciphertext, if you want to obtain the first time included in the first identifier, you need to decrypt the first identifier first; the server uses the stored key to decrypt the first identifier and determines whether the decryption is successful. If the decryption is successful, it means that the first identifier is a valid first identifier (i.e., the identifier signature is correct), and the first time included in the first identifier can be obtained after decryption; if the decryption fails, it means that the first identifier sent by the client is invalid, and a prompt message indicating that the first identifier is invalid is sent to the client.

[0077] In a feasible implementation, the above-mentioned first time includes the generation time of the above-mentioned first identifier and / or the expiration time of the above-mentioned first identifier, and the above-mentioned step S101 includes the following two cases:

[0078] Case 1: When the above-mentioned first time includes the generation time, it is judged whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the above-mentioned first preset threshold, the above-mentioned first identifier is within the above-mentioned validity period.

[0079] Case 2: When the above-mentioned first time includes the expiration time, it is judged whether the current time is earlier than or equal to the above-mentioned expiration time. If it is earlier than or equal to the above-mentioned expiration time, the above-mentioned first identifier is within the above-mentioned validity period.

[0080] Specifically, the above-mentioned first time can be the generation time of the first identifier, for example: 00:00 on March 21, 2021, the above-mentioned first time can also be the expiration time of the first identifier, for example: 12:00 on March 22, 2021, and the above-mentioned first time can also be a valid time period including the above-mentioned generation time and the above-mentioned expiration time, for example: 00:00 on March 21, 2021 - 12:00 on March 22, 2021; it is set according to the actual situation and is not specifically limited here. Among them, the generation time refers to the starting time when the first identifier is valid, and the expiration time refers to the ending time when the first identifier is valid.

[0081] During specific implementation, when the first time includes the generation time, if you want to know whether the above-mentioned first identifier is within the validity period, you can judge whether the time difference between the current time and the generation time exceeds the effective duration set for the first identifier, that is: judge whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the first preset threshold, it means that the time difference does not exceed the effective duration, and the first identifier is within the validity period.

[0082] For example, the first time includes the generation time of 00:00 on March 21, 2021. The current time is 08:00 on March 21, 2021. The first preset threshold is 10 hours. The time difference between the current time and the generation time is 8 hours, which is less than the first preset threshold. Therefore, the first identifier is within the validity period.

[0083] When implemented specifically, when the first time includes the expiration time, if you want to know whether the above-mentioned first identifier is within the validity period, you only need to determine whether the current time is earlier than or equal to the expiration time. If it is earlier than or equal to the expiration time, it means that the first identifier is within the validity period.

[0084] For example, the first time includes the expiration time of 12:00 on March 22, 2021. If the current time is 11:00 on March 22, 2021, the current time is earlier than the expiration time, so the first identifier is within the validity period; if the current time is 12:00 on March 22, 2021, the current time is equal to the expiration time, so the first identifier is within the validity period; if the current time is 13:00 on March 22, 2021, the current time is later than the expiration time, so the first identifier is not within the validity period.

[0085] In a feasible implementation scheme, when the first identifier is within the validity period, based on the above-mentioned first time including the generation time of the above-mentioned first identifier and / or the expiration time of the above-mentioned first identifier, the above-mentioned step S102 includes the following two cases:

[0086] Case 1: When the above-mentioned first time includes the above-mentioned generation time, determine whether the first target time difference is greater than or equal to the second preset threshold. If it is greater than or equal to the above-mentioned second preset threshold, the above-mentioned first target time difference meets the above-mentioned extension condition. Among them, the above-mentioned first target time difference is the absolute value of the time difference between the current time and the above-mentioned generation time.

[0087] Case 2: When the above-mentioned first time includes the above-mentioned expiration time, determine whether the second target time difference is less than or equal to the third preset threshold. If it is less than or equal to the above-mentioned third preset threshold, the above-mentioned second target time difference meets the above-mentioned extension condition. Among them, the above-mentioned second target time difference is the absolute value of the time difference between the current time and the above-mentioned expiration time.

[0088] It should be noted that both the above-mentioned second preset threshold and the above-mentioned third preset threshold are less than or equal to the first preset threshold.

[0089] In specific implementation, when the above first time includes the generation time, the target time difference is the first target time difference, and the first target time difference is the absolute value of the time difference between the current time and the generation time; it is determined whether the first target time difference is greater than or equal to the second preset threshold. If it is greater than or equal to the second preset threshold, it means that the first identifier is within the validity period but is about to expire and become invalid. Therefore, the first target time difference meets the extension condition, that is: the target time difference meets the extension condition, and it is necessary to extend the above generation time.

[0090] For example, the first time includes the generation time 00:00 on March 21, 2021. The current time is 08:00 on March 21, 2021. The first preset threshold is 10 hours, and the second preset threshold is 8 hours. The absolute value of the time difference between the current time and the generation time is 8 hours, which is less than the first preset threshold and equal to the second preset threshold. Therefore, this time difference meets the extension condition, and it is necessary to postpone the generation time.

[0091] In specific implementation, when the above first time includes the expiration time, the target time difference is the second target time difference, and the second target time difference is the absolute value of the time difference between the current time and the expiration time. It is determined whether the second target time difference is less than or equal to the third preset threshold. If it is less than or equal to the third preset threshold, it means that the current time is about to reach the expiration time, that is: the first identifier is about to expire and become invalid. Therefore, the second target time difference meets the extension condition, that is: the target time difference meets the extension condition, and it is necessary to extend the above expiration time.

[0092] For example, the first time includes the expiration time 14:00 on March 22, 2021. The current time is 09:00 on March 22, 2021. The third preset threshold is 7 hours. The absolute value of the time difference between the current time and the expiration time is 5 hours, which is less than the third preset threshold. Therefore, this time difference meets the extension condition, and it is necessary to postpone the expiration time.

[0093] In a feasible implementation scheme, if the above first identifier is not within the above validity period, the above extension method further includes: sending a prompt message to the client indicating that the above first identifier is invalid.

[0094] Specifically, if the above first identifier is not within the validity period, it means that the first identifier has expired and become invalid. Therefore, it is necessary to send a prompt message to the client to remind the client that the first identifier has expired and become invalid and needs to log in again.

[0095] Embodiment 2

[0096] Figure 3 The structure diagram of an extension device provided in Embodiment 2 of the present application is shown. As Figure 3 shown, this extension device is applied to the server, and this extension device includes:

[0097] The first determination module 301 is configured to, after receiving a request carrying a first identifier sent by a client, determine whether the first identifier is within a validity period according to a first time included in the first identifier, where the first identifier is an identifier set by a server for representing the identity information of a user who has successfully logged in to the client;

[0098] The second determination module 302 is configured to, if the first identifier is within the validity period, determine whether a target time difference meets a preset extension condition, where the target time difference is the absolute value of the time difference between the current time and the first time;

[0099] The extension module 303 is configured to, if the target time difference meets the extension condition, extend the first time included in the first identifier to a second time to obtain a second identifier including the second time;

[0100] The sending module 304 is configured to send a request result carrying the second identifier to the client, so that the client updates the stored identifier with the second identifier, where the updated stored identifier includes the second time.

[0101] In a feasible implementation, before the first determination module 301 is configured to determine whether the first identifier is within the validity period according to the first time included in the first identifier, it is further configured to:

[0102] Decrypt the first identifier using a stored key;

[0103] Determine whether the decryption is successful;

[0104] If the decryption is successful, obtain the first time included in the first identifier.

[0105] In a feasible implementation, the first time includes a generation time and / or an expiration time of the first identifier. When the first determination module 301 is configured to determine whether the first identifier is within the validity period, it is specifically configured to:

[0106] When the first time includes the generation time, determine whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the first preset threshold, the first identifier is within the validity period;

[0107] When the first time includes the expiration time, determine whether the current time is earlier than or equal to the expiration time. If it is earlier than or equal to the expiration time, the first identifier is within the validity period.

[0108] In a feasible implementation, when the second determination module 302 is used to determine whether a target time difference meets a preset extension condition, it is specifically configured to:

[0109] When the first time includes the generation time, determine whether a first target time difference is greater than or equal to a second preset threshold. If it is greater than or equal to the second preset threshold, the first target time difference meets the extension condition, where the first target time difference is the absolute value of the time difference between the current time and the generation time;

[0110] When the first time includes the deadline time, determine whether a second target time difference is less than or equal to a third preset threshold. If it is less than or equal to the third preset threshold, the second target time difference meets the extension condition, where the second target time difference is the absolute value of the time difference between the current time and the deadline time.

[0111] In a feasible implementation, if the first identifier is not within the validity period, the extension device further includes:

[0112] A prompt module, configured to send a prompt message indicating that the first identifier is invalid to the client.

[0113] The device provided by the embodiments of the present application may be specific hardware on a device or software or firmware installed on the device. The implementation principle and the technical effects generated by the device provided by the embodiments of the present application are the same as those of the foregoing method embodiments. For the sake of brief description, for the parts not mentioned in the device embodiments, reference may be made to the corresponding content in the foregoing method embodiments. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the foregoing-described systems, devices, and units can all refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0114] Embodiment III

[0115] The embodiments of the present application further provide a computer device 400, Figure 4 showing a schematic structural diagram of a computer device provided by Embodiment III of the present application. As Figure 4 shown, the device includes a memory 401, a processor 402, and a computer program stored on the memory 401 and executable on the processor 402. Among them, the memory 401 and the processor 402 are communicatively connected through a bus, and when the processor 402 executes the computer program, the foregoing extension method is implemented.

[0116] Specifically, the above-mentioned memory 401 and processor 402 can be general-purpose memory and processor, which are not specifically limited here. When the processor 402 runs the computer program stored in the memory 401, it can execute the above-mentioned extension method, solving the problems of short identification validity period, frequent client logins, and waste of software resources in the prior art.

[0117] Embodiment 4

[0118] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the above-mentioned extension method.

[0119] Specifically, the storage medium can be a general-purpose storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, it can execute the above-mentioned extension method, solving the problems of short identification validity period, frequent client logins, and waste of software resources in the prior art.

[0120] In the embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some communication interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0121] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0122] In addition, the functional units in the embodiments provided by the present application can be integrated into one processing unit, or each unit exists physically alone, or two or more units are integrated into one unit.

[0123] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0124] It should be noted that: similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. In addition, the terms "first", "second", "third", etc. are only used for descriptive distinction and cannot be understood as indicating or implying relative importance.

[0125] Finally, it should be noted that: the above-mentioned embodiments are only specific implementation manners of this application, used to illustrate the technical solution of this application, rather than limiting it. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art within the technical scope disclosed by this application can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims

1. A delay method, characterized in that, Applied to the server side, the extension method includes: After receiving a request carrying a first identifier sent by the client, determine whether the first identifier is within the validity period according to the first time included in the first identifier, where the first identifier is an identifier set by the server for the client to represent the identity information of the user who has successfully logged in to the client; If the first identifier is within the validity period, determine whether the target time difference meets a preset extension condition, where the target time difference is the absolute value of the time difference between the current time and the first time; If the target time difference meets the extension condition, extend the first time included in the first identifier to a second time to obtain a second identifier including the second time; Send a request result carrying the second identifier to the client so that the client uses the second identifier to update the stored identifier, where the updated stored identifier includes the second time.

2. The method according to claim 1, wherein Before determining whether the first identifier is within the validity period according to the first time included in the first identifier, the extension method further includes: Decrypt the first identifier using the stored key; Determine whether the decryption is successful; If the decryption is successful, obtain the first time included in the first identifier.

3. The method according to claim 1, wherein The first time includes the generation time of the first identifier and / or the expiration time of the first identifier. Determining whether the first identifier is within the validity period includes: When the first time includes the generation time, determine whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the first preset threshold, the first identifier is within the validity period; When the first time includes the expiration time, determine whether the current time is earlier than or equal to the expiration time. If it is earlier than or equal to the expiration time, the first identifier is within the validity period.

4. The method according to claim 3, characterized in that, Determining whether the target time difference meets a preset extension condition includes: When the first time includes the generation time, determine whether the first target time difference is greater than or equal to a second preset threshold. If it is greater than or equal to the second preset threshold, the first target time difference meets the extension condition, where the first target time difference is the absolute value of the time difference between the current time and the generation time; When the first time includes the expiration time, determine whether the second target time difference is less than or equal to a third preset threshold. If it is less than or equal to the third preset threshold, the second target time difference meets the extension condition, where the second target time difference is the absolute value of the time difference between the current time and the expiration time.

5. The method according to claim 1, wherein If the first identifier is not within the validity period, the extension method further includes: Send a prompt message indicating that the first identifier is invalid to the client.

6. A delay device, characterized in that, Applied to the server side, the extension device includes: A first judgment module, configured to, after receiving a request carrying a first identifier sent by a client, determine whether the first identifier is within the validity period according to a first time included in the first identifier, where the first identifier is an identifier set by a server for the client to represent the identity information of a user who has successfully logged in to the client; A second judgment module, configured to, if the first identifier is within the validity period, determine whether a target time difference meets a preset extension condition, where the target time difference is the absolute value of the time difference between the current time and the first time; An extension module, configured to, if the target time difference meets the extension condition, extend the first time included in the first identifier to a second time to obtain a second identifier including the second time; A sending module, configured to send a request result carrying the second identifier to the client, so that the client updates the stored identifier with the second identifier, where the updated stored identifier includes the second time.

7. The device according to claim 6, characterized in that, Before the first judgment module is configured to determine whether the first identifier is within the validity period according to the first time included in the first identifier, it is further configured to: Decrypt the first identifier using a stored key; Determine whether the decryption is successful; If the decryption is successful, obtain the first time included in the first identifier.

8. The device according to claim 6, characterized in that, The first time includes the generation time of the first identifier and / or the expiration time of the first identifier. When the first judgment module is configured to determine whether the first identifier is within the validity period, it is specifically configured to: When the first time includes the generation time, determine whether the time difference between the current time and the generation time is less than or equal to a first preset threshold. If it is less than or equal to the first preset threshold, the first identifier is within the validity period; When the first time includes the expiration time, determine whether the current time is earlier than or equal to the expiration time. If it is earlier than or equal to the expiration time, the first identifier is within the validity period.

9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1-5 above.

10. A computer-readable storage medium, on which a computer program is stored, characterized in that, When the computer program is run by the processor, it executes the steps of the method described in any one of claims 1-5 above.

Citation Information

Patent Citations

  • Resource access control method and terminal equipment

    CN107819743A

  • Token updating method and device

    CN112836204A