Token validity verification method, device, equipment and storage medium
By associating the token with the batch identification and configuration information, the system server can effectively verify the validity of the token, solve the security risks caused by token leakage, and improve the security of the system platform.
Patent Information
- Application Number
- CN202111332007.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2041-11-11
AI Technical Summary
When the system platform conducts pressure testing, the risk of token leakage is high, resulting in unauthorized devices being able to access the system platform, causing security risks.
By associating the token with the batch identity and associating the batch identity with configuration information, the system server can query its valid access rights configuration based on the batch identity of the token to verify the validity of the token.
Even if the token is leaked, the system platform is improved by adjusting the valid access permission configuration of the token, which invalidates the leaked token, prevents unauthorized devices from using the leaked token to access the system platform, thereby improving the security of the system platform.
Smart Images

Figure CN114168450B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to a token validity verification method, device, equipment and storage medium. Background Art
[0002] In the related art, before the system platform software is launched, or before an online event (such as an online shopping festival) is held through the system platform software, it is usually necessary to perform stress testing on the system platform to test the carrying capacity of the system platform. For example, the maximum number of user visits that the system platform can carry, the number of user order operations that the system platform can carry, etc.
[0003] When stress testing the system platform, the server of the system platform generates a large number of user tokens (also called tokens) and sends these tokens to the stress testing platform. The stress testing platform simulates a large number of users accessing the system platform based on these tokens to test the load capacity of the system. However, the confidentiality of the stress testing process is not strong, and the risk of token leakage is high. Once the token is leaked, unauthorized devices can also access the server of the system platform through these tokens, which poses a great security risk to the system server. Summary of the invention
[0004] The present disclosure provides a token validity verification method, device, equipment and storage medium to at least solve the security problem caused by token leakage in the related technology. The technical solution of the present disclosure is as follows:
[0005] According to the first aspect of the present disclosure, a token validity verification method is provided, including: obtaining a token to be processed; determining a batch identifier of the token to be processed; querying configuration information associated with the batch identifier; the configuration information is used to characterize the effective access rights of the token to be processed; and determining whether the token to be processed is valid based on the configuration information associated with the batch identifier.
[0006] Optionally, before obtaining the token to be processed, the method also includes: generating the token to be processed and the batch identifier corresponding to the token to be processed; determining the configuration information corresponding to the token to be processed; and associating the batch identifier with the configuration information corresponding to the token to be processed.
[0007] Optionally, the configuration information associated with the batch identifier includes: a validity identifier; the validity identifier is used to indicate whether the token to be processed is valid.
[0008] Optionally, the configuration information associated with the batch identification also includes at least one of the following: interface access path information, validity time information; wherein the interface access path information is used to indicate the interface access rights of the token; and the validity time information is used to indicate the validity period of the token.
[0009] Optionally, the batch identifier corresponding to the token to be processed is a field written into the token to be processed.
[0010] Optionally, the batch identifier corresponding to the token to be processed corresponds to the token to be processed via a first association relationship table, and the first association relationship table is stored in a database.
[0011] Optionally, the batch identifier and the configuration information associated with the batch identifier correspond to each other through a second association relationship table, and the second association relationship table is stored in the database.
[0012] According to a second aspect of the present disclosure, a token validity verification device is provided, comprising: a communication module and a processing module; the communication module is used to obtain a token to be processed; the processing module is used to determine a batch identification of the token to be processed; the processing module is also used to query configuration information associated with the batch identification; the configuration information is used to characterize the effective access rights of the token to be processed; the processing module is also used to determine whether the token to be processed is valid based on the configuration information associated with the batch identification.
[0013] Optionally, the processing module is further used to: generate the token to be processed and the batch identifier corresponding to the token to be processed; determine the configuration information corresponding to the token to be processed; and associate the batch identifier with the configuration information corresponding to the token to be processed.
[0014] Optionally, the configuration information associated with the batch identifier includes: a validity identifier; the validity identifier is used to indicate whether the token to be processed is valid.
[0015] Optionally, the configuration information associated with the batch identification also includes at least one of the following: interface access path information, validity time information; wherein the interface access path information is used to indicate the interface access rights of the token; and the validity time information is used to indicate the validity period of the token.
[0016] Optionally, the batch identifier corresponding to the token to be processed is a field written into the token to be processed.
[0017] Optionally, the batch identifier corresponding to the token to be processed corresponds to the token to be processed via a first association relationship table, and the first association relationship table is stored in a database.
[0018] Optionally, the batch identifier and the configuration information associated with the batch identifier correspond to each other through a second association relationship table, and the second association relationship table is stored in the database.
[0019] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the above-mentioned first aspect and any optional token validity verification method in the first aspect.
[0020] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the token validity verification method as described in the first aspect and any one of the optional token validity verification methods in the first aspect.
[0021] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute the above-mentioned first aspect and any one of the optional token validity verification methods in the first aspect.
[0022] The technical solution provided by the present disclosure brings at least the following beneficial effects: the electronic device associates the token with the batch identifier, and the batch identifier is associated with the configuration information. After receiving the token, the electronic device can query the effective access permission configuration of the token according to the batch identifier corresponding to the token, and verify the effective access permission of the token according to the effective access permission configuration of the token. Based on the technical solution provided by the present disclosure, the electronic device verifies the validity of the token through the effective access permission configuration information of the token. By reasonably setting the effective access permission configuration information of the token, even if the token is leaked, other devices cannot use the leaked token to apply for access to the electronic device, thereby improving the security of the electronic device.
[0023] In addition, in the present disclosure, a token corresponds to a batch identifier, and the electronic device queries the configuration information corresponding to the token through the batch identifier. In this way, in a scenario where there are a large number of tokens, multiple tokens can correspond to one batch identifier, and the electronic device can query the configuration information corresponding to multiple tokens through one batch identifier. Compared with one configuration information corresponding to each token, the method provided by the present disclosure can greatly reduce the memory occupied by storing configuration information.
[0024] For example, when performing stress testing, a large number of tokens in the stress test may correspond to a batch identifier. For these large number of batch identifiers, the electronic device may store only one validity configuration, rather than storing a validity configuration for each token, thereby greatly reducing the storage space occupied by the validity configuration.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0027] Figure 1 It is a structural diagram of a token validity verification system according to an exemplary embodiment.
[0028] Figure 2 The figure is a flow chart of a token validity verification method according to an exemplary embodiment.
[0029] Figure 3 The figure is a flow chart of another token validity verification method according to an exemplary embodiment.
[0030] Figure 4 The figure is a flow chart of another token validity verification method according to an exemplary embodiment.
[0031] Figure 5 The figure is a block diagram of a token validity verification device according to an exemplary embodiment.
[0032] Figure 6 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0033] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0035] Before introducing the token validity verification method of the embodiment of the present disclosure in detail, the terms involved in the embodiment of the present disclosure are first explained.
[0036] First, the terms involved in the embodiments of the present disclosure are explained.
[0037] 1. Token
[0038] A token is a credential field used by a client to access a server's request for data. A client carrying a valid token field can obtain the requested data from the server.
[0039] In the related art, if the client does not use a token to request access to the server, the client needs to carry the client's username and password each time it accesses the server to request data, and the server queries the database to see if the username and password corresponding to the client are correct. If correct, the client is allowed to request data; if incorrect, the client's request for data is rejected. In this technology, each time the client requests data, the server needs to query the database for the username and password corresponding to the client. The server query process is complex, and the efficiency of processing client requests is low. When the client frequently requests data, the server is under great pressure to process.
[0040] The emergence of tokens solves the problem that every time a client requests data, the server needs to query the database for the username and password corresponding to the client. When a client requests data, the client only needs to carry the client's username and password when it first accesses the server. After the client successfully logs in to the server with the username and password, the server will generate a token for the client and return the token to the client. The next time the client requests to access the server, the client only needs to use the token to access the server. The server determines whether the client's access request is valid based on the token, without the server having to query the database for the client's username and password every time. This greatly improves the efficiency of the server in processing client requests.
[0041] According to the above description, the client uses a token to access the server, which can reduce the number of times the server frequently queries the database, reduce the pressure on the server, and improve the processing efficiency of the server.
[0042] 2. Stress testing
[0043] Stress testing, also known as stress testing, is a method of testing the carrying capacity of a system platform. In related technologies, stress testing is usually performed on a system platform before it goes online or before using the system platform to host online activities to determine whether the system platform can meet the requirements for going online; or whether the system platform can bear the load generated by a large number of user access operations during online activities.
[0044] When stress testing the system platform, the system server will allocate multiple tokens to the stress testing platform. The stress testing platform simulates users accessing the system server based on the multiple tokens. The performance parameters of the system server when multiple users access it are tested to see whether they can meet the requirements of launching the system or hosting online activities.
[0045] The terms involved in the present disclosure are explained above.
[0046] When stress testing the system platform, many people have access to the tokens used in stress testing, which greatly increases the risk of token leakage. If these tokens are leaked, devices that are not authorized by the system server can access the system server through these tokens, which poses a great security risk to the system server.
[0047] In the related art, the methods described in the following method 1 and method 2 are usually used to solve the security problems caused by the leakage of stress testing tokens.
[0048] Method 1: The electronic device sets a shorter validity period for the stress test tokens to ensure that these tokens are only valid during stress testing. These stress test tokens cannot be used outside the validity period.
[0049] Although method 1 can reduce the impact of token leakage, token leakage within the token validity period will still bring security risks to the system server.
[0050] Method 2: Set up an IP address whitelist and bind the IP address to the token. If the IP address of the stress test device is in the whitelist, the stress test device uses these tokens to access the system server, and this access is valid. If the IP address of the stress test device is not in the whitelist, then even if the stress test device uses these tokens, it cannot successfully access the server.
[0051] The process in method 2 is specifically as follows: the system server generates stress testing tokens and marks these stress testing tokens. The system server obtains the IP address of the stress testing device, binds the stress testing token to the IP address, and establishes an IP address whitelist. The system server sends the stress testing token to the stress testing device. When the stress testing device performs stress testing, it writes the token into the access request and sends the access request to the system server. After receiving the access request, the system server obtains the token in the access request and determines that the token is a token with a stress testing mark. The electronic device determines whether the IP address carried in the access request is an IP address in the whitelist. If so, a subsequent token verification is performed. If not, the access request is rejected.
[0052] The problem with method 2 is that when performing stress testing, multiple devices are usually required to perform stress testing on the system platform at the same time. The IP addresses of these stress testing devices change dynamically, so the IP whitelist in this disclosure also needs to be updated in a timely manner according to the changes in the IP addresses of the stress testing devices. The IP whitelist is updated frequently and the update process is cumbersome. If the IP whitelist is not updated in a timely manner, the IP address of the correct stress testing device may be inconsistent with the IP address in the whitelist, which may cause the correct stress testing device to fail to perform stress testing on the system platform normally.
[0053] It can be seen that although the relevant technologies disclose methods for reducing the security risks caused by token leakage, the above solutions all have corresponding problems.
[0054] In order to reduce the potential security risks brought to the system server by the leakage of stress testing tokens, an embodiment of the present disclosure provides a method for verifying the validity of tokens, where the system server associates the token with a batch identifier, and the batch identifier is associated with configuration information. After receiving the token, the system server can query the effective access permission configuration of the token according to the batch identifier corresponding to the token, and verify the effective access permission of the token according to the effective access permission configuration of the token. Based on the technical solution provided by the present disclosure, after the token is leaked, the leaked token can be set as an invalid token by adjusting the effective access permission configuration of the token. In this way, even if the token is leaked, after these leaked tokens are adjusted to invalid tokens, the business can prevent other devices from using these tokens to apply for access to the system server, thereby improving the security of the system server.
[0055] like Figure 1 As shown, a token validity verification method provided by the present disclosure is applied to Figure 1 In the token validity verification system 100 shown in FIG. Figure 1 As shown, the token validity verification system 100 includes: a client device 10 and an electronic device 20.
[0056] The client device 10 is used to access the electronic device 20 through an access request carrying a token, and to request data from the electronic device 20 through the access request.
[0057] The electronic device 20 is used to receive the access request of the client device 10 and verify whether the client device 10 is a client with access rights through the token. When the client device 10 is a client with access rights, the electronic device 20 determines that the client device 10 is authenticated and provides the client device 10 with the requested data.
[0058] In some embodiments, the electronic device may be a system server in a system platform, a module or chip in a system server, etc. The electronic device may also be a terminal with data processing capabilities, or other electronic device used to verify the validity of a token, which is not limited in the present disclosure.
[0059] The terminal may be a mobile phone, tablet computer, desktop, laptop, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR) and virtual reality (VR) devices, etc., which can install and use content community applications (such as Kuaishou). The present disclosure does not impose any special restrictions on the specific form of the electronic device. It can interact with the user through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device.
[0060] The present disclosure provides a token validity verification method, which can be applied to Figure 1 In the token validity verification system shown, Figure 2 As shown, the token validity verification method provided by the embodiment of the present disclosure can be implemented through the following S200-S203.
[0061] S200: The electronic device obtains a token to be processed.
[0062] The token to be processed is a token carried in an access request sent by the electronic device from other devices.
[0063] For example, the token to be processed is a token carried in an access request sent by a client device to an electronic device; or, the token to be processed is a token carried in an access request sent by a stress testing device to an electronic device. This disclosure does not limit this.
[0064] In the present disclosure, the token to be processed is mainly described by taking an example in which the token is carried in an access request sent by a stress testing device to an electronic device.
[0065] The following is an exemplary description of the process in which an electronic device obtains a token to be processed during a stress test: During the process in which a stress test device performs stress testing on an electronic device, the stress test device sends a first operation request to the electronic device. Correspondingly, the electronic device receives the first operation request from the stress test device. The first operation request includes the above-mentioned token to be processed. The electronic device parses the first operation request and obtains the token to be processed in the first operation request, so that the electronic device can verify the token to be processed and determine whether the first operation sent by the stress test device is valid.
[0066] Optionally, the first operation request is an operation request of a client device simulated by the stress testing device. In one example, when stress testing the load of access that can be carried by the electronic device, the first operation request is an operation request of a client device simulated by the stress testing device to apply for access to the electronic device. In another example, when stress testing the load of orders that can be carried by the electronic device, the first operation request is an operation request of a client device simulated by the stress testing device to apply for creating an order in the electronic device.
[0067] S201. The electronic device determines a batch identifier corresponding to a token to be processed.
[0068] Among them, the batch identifier (batchId) is used to mark the token to be processed, so that the subsequent electronic device can determine the effective access permission configuration corresponding to the token to be processed according to the batch identifier.
[0069] Optionally, the batch identifier may be a field added to the token to be processed. In this case, the electronic device may determine the batch identifier corresponding to the token to be processed by parsing the corresponding field in the token to be processed. In this case, the electronic device does not need to additionally store the batch identifier and the association between the batch identifier and the token to be processed, thus saving storage space of the electronic device.
[0070] Optionally, the batch identifier may also be a field associated with the token to be processed through an association table. In this case, the batch identifier and the association table between the batch identifier and the token to be processed may be stored in a database of the electronic device. In this case, after the electronic device obtains the token to be processed, it reads the association table between the batch identifier and the token to be processed to determine the batch identifier corresponding to the token to be processed. At this point, the electronic device does not need to modify the token field, which reduces the complexity of generating the token field.
[0071] In one example, the association table between batch identifiers and tokens to be processed is shown in Table 1 below:
[0072] Table 1
[0073]
[0074]
[0075] It should be noted that during the stress test, the electronic device may generate multiple tokens for each stress test. The multiple tokens may correspond to a batch identifier (that is, the batch identifier of the electronic device generating the token). Alternatively, the multiple tokens may correspond to different batch identifiers. This disclosure does not limit this.
[0076] S202: The electronic device queries configuration information associated with the batch identification.
[0077] The above configuration information is used to represent the effective access rights of the token to be processed.
[0078] Optionally, the configuration information associated with the batch identifier includes: a validity identifier; the validity identifier is used to indicate whether the token to be processed is valid.
[0079] Optionally, the configuration information associated with the batch identification also includes at least one of the following: interface access path information, validity time information; wherein the interface access path information is used to indicate the interface access rights of the token; and the validity time information is used to indicate the validity period of the token.
[0080] In one example, the configuration information generated by the electronic device is shown in Table 2 below.
[0081] Table 2
[0082] Field Name Meaning Example path Accessible interface path / user / get expireTime Expiration time 1625315853 enable Is it effective? True or false
[0083] Among them, the path field corresponds to the above-mentioned interface access path information, the expireTime field corresponds to the above-mentioned valid time information, and enable corresponds to the above-mentioned validity flag.
[0084] S203: The electronic device determines whether the token to be processed is valid based on the configuration information associated with the batch identification.
[0085] Specifically, the configuration information associated with the batch identification is the validity configuration information of the token to be processed. The electronic device can determine whether the token to be processed is valid by comparing the parameters of the token to be processed with the relevant parameters in the configuration information.
[0086] Optionally, in combination with the above Table 2, the electronic device determines the interface path accessible to the token to be processed based on the above "path" field. If the interface path of the interface that the stress test device applies to access using the above token to be processed is consistent with the interface path corresponding to the "path" field, the electronic device determines that the token is a valid token. The electronic device can access this interface based on the token. If they are inconsistent, the electronic device determines that the token is an invalid token, and the electronic device refuses the stress test device to use the token to access the interface.
[0087] The electronic device determines the expiration time of the token to be processed based on the above-mentioned "expireTime" field. If the electronic device determines that the current time for verifying the validity of the token to be processed is earlier than the expiration time of the token to be processed, the electronic device determines that the token to be processed is a valid token to be processed. If the electronic device determines that the current time for verifying the validity of the token to be processed is later than the expiration time of the token to be processed, the electronic device determines that the token to be processed is an invalid token to be processed.
[0088] The electronic device determines whether the validity identification of the token to be processed is valid based on the above-mentioned "enable" field. If the electronic device determines that the validity identification of the token to be processed is valid (the corresponding value is true). The electronic device determines that the token to be processed is valid. If the electronic device determines that the validity identification of the token to be processed is invalid (the corresponding value is false). The electronic device determines that the token to be processed is invalid.
[0089] The technical solution provided by the above-mentioned embodiment brings at least the following beneficial effects: the electronic device associates the token with the batch identifier, and the batch identifier is associated with the configuration information. After receiving the token, the electronic device can query the effective access permission configuration of the token according to the batch identifier corresponding to the token, and verify the effective access permission of the token according to the effective access permission configuration of the token. Based on the technical solution provided by the present disclosure, the electronic device verifies the effective access permission of the token through the effective access permission configuration information of the token. By reasonably setting the effective access permission configuration information of the token, even if the token is leaked, other devices cannot use the leaked token to apply for access to the electronic device, thereby improving the security of the electronic device.
[0090] In addition, in the present disclosure, a token corresponds to a batch identifier, and the electronic device queries the configuration information corresponding to the token through the batch identifier. In this way, in a scenario where there are a large number of tokens, multiple tokens can correspond to one batch identifier, and the electronic device can query the configuration information corresponding to multiple tokens through one batch identifier. Compared with one configuration information corresponding to each token, the method provided by the present disclosure can greatly reduce the memory occupied by storing configuration information.
[0091] For example, when performing stress testing, a large number of tokens in the stress test may correspond to a batch identifier. For these large batch identifiers, the electronic device may store only one valid access permission configuration, instead of storing a valid access permission configuration for each token, thereby greatly reducing the storage space occupied by the valid access permission configuration.
[0092] The above provides a method for an electronic device to verify the validity of a token to be processed based on a batch identifier and configuration information. It is understandable that before the electronic device verifies the validity of the token to be processed based on the batch identifier and configuration information, the electronic device may also pre-establish an association relationship between the token to be processed and the batch identifier, and an association relationship between the batch identifier and the configuration information. In this way, after the electronic device receives the token to be processed, it may directly determine the configuration information that can characterize the validity of the token to be processed based on the determined association relationship.
[0093] Combination Figure 2 ,like Figure 3As shown, the process of the electronic device pre-establishing the association between the token to be processed and the batch identifier, and the association between the batch identifier and the configuration information can be implemented through the following S300-S303.
[0094] S300: The electronic device generates a token to be processed.
[0095] The token to be processed is a string of characters generated by the electronic device, and other devices can use the string to access the electronic device.
[0096] The following examples illustrate the process of generating tokens to be processed by electronic devices in different scenarios:
[0097] Example 1: When the token to be processed is a token used for stress testing, the electronic device can generate a request based on the received stress testing token, generate a string of characters, and send the string as the stress testing token to the stress testing device.
[0098] Example 2: When the token to be processed is a token that the electronic device needs to generate for the client device after the client device accesses the electronic device for the first time. The electronic device verifies whether the username and password in the request message sent by the client device are correct. If correct, the electronic device generates a string and sends the string to the client device as the token of the client device.
[0099] S301. The electronic device generates a batch identification corresponding to the token to be processed.
[0100] The batch identifier is a string of characters generated by the electronic device, and the length of the batch identifier is generally smaller than the length of the character string of the token to be processed. In this way, the memory occupied by the electronic device to store the batch identifier will be smaller, and the speed at which the electronic device queries the associated configuration information according to the batch identifier will be faster, consuming less computing resources. The electronic device can also further reduce the storage space occupied by the configuration information corresponding to the token to be processed by making multiple tokens to be processed correspond to one batch identifier.
[0101] In combination with the above example 1, the electronic device can generate a batch identifier (also called batch identifier batchId) for the same batch of stress testing tokens (ie, stress testing tokens used in the same stress testing process). The electronic device establishes an association relationship between the batch of stress testing tokens and the batch identifier.
[0102] In combination with the above example 2, the electronic device generates a batch identifier for the token of each client device, and establishes an association relationship between the token of the client device and the batch identifier.
[0103] S302: The electronic device generates configuration information corresponding to the token to be processed.
[0104] Optionally, the electronic device generates configuration information corresponding to the token to be processed according to the validity requirements of the token to be processed.
[0105] Specifically, in combination with the above example 1, the validity requirements of the token to be processed are generated according to the stress test requirements during the current stress test. For example, the electronic device determines the interface corresponding to the business type according to the business type that needs to be tested during this stress test, and then determines the interface access path information in the configuration information; the electronic device determines the valid time information in the configuration information according to the time of this stress test; the electronic device can dynamically set the validity flag in the configuration information.
[0106] It should be pointed out that in Example 1, the electronic device usually first obtains the stress test requirement of this stress test, and the stress test requirement includes at least one of the following: the business type of this test, and the time period of this test. After the electronic device receives the stress test requirement, it generates the configuration information of the stress test token according to the stress test requirement. Then, the electronic device generates the stress test token used in this stress test. That is to say, during the stress test process, the electronic device can first execute S302 to generate the configuration information corresponding to the token to be processed; and then execute S300 to generate the token to be processed. Regarding the order of S302 and S300, the present disclosure does not limit this.
[0107] In combination with the above example 2, the electronic device can generate interface access path information based on the access rights of the client device; the electronic device determines the valid time information of the token based on the registration time and registration information of the client device; the electronic device can dynamically set the validity identifier in the configuration information.
[0108] S303: The electronic device associates the batch identification with the configuration information corresponding to the token to be processed.
[0109] Specifically, the electronic device determines the batch identifier corresponding to the token to be processed and the configuration information corresponding to the token to be processed, and establishes an association relationship between the batch identifier corresponding to the token to be processed and the configuration information corresponding to the token to be processed.
[0110] Optionally, the electronic device writes the batch identification and the configuration information with the association relationship into the same table to establish the association relationship between the batch identification and the configuration information. After that, the electronic device can query the configuration information associated with the batch identification by looking up the table.
[0111] Optionally, the batch identifier and the configuration information associated with the batch identifier are corresponded via a second association relationship table, and the second association relationship table is stored in a database.
[0112] As an example, in combination with the above Table 2, as shown in Table 3 below, the second association relationship table between batch identification and configuration information is shown in Table 3 below.
[0113] Table 3
[0114] Field Name Meaning Example batchId The batch ID for generating tokens 83296441233 path Accessible interface path / user / get expireTime Expiration time 1625315853 enable Is it effective? True or false
[0115] The technical solution provided by the above embodiment brings at least the following beneficial effects: in the process of generating a token, the electronic device also generates a batch identifier corresponding to the token, and configuration information corresponding to the token. The electronic device establishes an association relationship between the token and the batch identifier, and an association relationship between the batch identifier and the configuration information. In this way, after the electronic device obtains the token to be processed, the batch identifier corresponding to the token to be processed can be determined based on the association relationship between the token and the batch identifier. The electronic device further determines the configuration information corresponding to the token to be processed based on the association relationship between the batch identifier and the configuration information. Thereby, the electronic device can verify the validity of the token to be processed according to the configuration information corresponding to the token to be processed.
[0116] It should be noted that after the electronic device generates the configuration information, it can store the configuration information in a database. In the process of verifying the validity of the token, the electronic device can query the corresponding configuration information from the database to verify the validity of the token. In addition, the electronic device can also dynamically adjust the relevant configuration parameters in the configuration information to better reduce the security issues caused by token leakage.
[0117] In the following, in conjunction with Table 2, the parameters in the configuration information corresponding to the token are exemplarily described.
[0118] a. Validity identification configuration: The validity identification configuration is used to characterize whether a token is valid. The electronic device can directly identify whether the token is a valid token or an invalid token through the validity identification configuration. Based on this, when a token is leaked and it is not possible to promptly determine that the leaked token is an invalid token through other circumstances, the electronic device can mark the token as invalid by setting the validity identification to "false". At this point, regardless of whether the token can pass other validity verifications, the electronic device directly considers the token to be valid.
[0119] For example, the electronic device finds that another device is using a pending token to access the electronic device, and the access interface permissions and validity period of the token meet the validity requirements. However, the electronic device determines that the other device is abnormal. At this time, the electronic device directly changes the validity identification configuration of the token to "false" and marks the token as an invalid token. No subsequent device will be able to continue to use the token to access the electronic device.
[0120] b. Interface access path information: Interface access path information is used to characterize the interface access rights of the token. The electronic device can determine the interface access rights of the device that sends the operation request carrying the token based on the interface access path information. Generally speaking, different types of services in electronic devices correspond to different access interfaces. The present disclosure limits the interface configuration accessible to the token to ensure that other devices can only perform corresponding services using the token, thereby further reducing the risk of token leakage.
[0121] For example, during the stress test, the stress test equipment only needs to test the user access capacity of the electronic device. At this time, the token generated by the electronic device for the stress test equipment only configures the permission to access the interface for accessing the electronic device, but does not configure the permission to access the interface for modifying orders or the interface for paying orders. In this way, even if these tokens are leaked, other devices can only use these devices to access the electronic device, but cannot make any changes to the orders in the electronic device.
[0122] c. Validity time information: Validity time information is used to characterize the validity time of the token. The electronic device sets a validity period for the token. When other devices use a token outside the validity period to send an operation request, the electronic device can directly determine that the token used by the other device is an invalid token, and then reject the operation request of the other device. At this time, regardless of whether the token has access rights or whether it has access rights to the corresponding interface, the electronic device considers the token invalid. Only when the token is within the validity period and the token meets other validity verification conditions, the electronic device confirms that the token is valid. Based on this, the electronic device can further reduce the risk of token leakage by reasonably setting the validity period of the token.
[0123] For example, the system platform will hold an online National Day promotion during the National Day in 2021. Therefore, the system platform needs to be stress-tested between September 20, 2021 and September 25, 2021 before the National Day to determine whether the system platform can handle large-scale user access during the National Day. At this time, the electronic device generates multiple stress-testing tokens for this stress test, and sets the validity period of the multiple stress-testing tokens to: 0:00 on September 20, 2021 - 24:00 on September 25, 2021. If any device uses the token to apply for access to the electronic device at any time point other than 0:00 on September 20, 2021 - 24:00 on September 25, 2021, the electronic device determines that the token is an invalid token and rejects the device's access.
[0124] It is understandable that the above only takes the configuration information including at least one of the interface access path information, validity time information, and validity identification configuration as an example for explanation. In actual use, the configuration information may also include other parameters for judging the validity of the token, such as: device type configuration, which only allows devices of a specific type to use the token to access the electronic device. In this way, during stress testing, only the stress testing device can use the token, which can effectively prevent other devices from using the token to access the server after the token is leaked.
[0125] Those skilled in the art can flexibly set the configuration parameters in the configuration information according to the requirements to reduce the security risks caused by the token leakage. The present disclosure does not limit the specific configuration parameters in the configuration information.
[0126] The above is a process of pre-establishing an association relationship between the token to be processed and the batch identifier, an association relationship between the batch identifier and the configuration information for the electronic device, and a process of verifying the validity of the token to be processed according to the batch identifier and the configuration information.
[0127] The following, combined Figure 4 Taking the token to be tested as a stress test token as an example, the present disclosure is fully described from the stress test start stage to the token verification stage: Figure 4 As shown, the method includes the following S400-S411.
[0128] S400: The stress testing device sends stress testing requirement parameters to the electronic device. Correspondingly, the electronic device receives the stress testing requirement parameters from the stress testing device.
[0129] Optionally, the stress testing requirement parameters include at least one of the following: stress testing time, test type, and required number of stress testing tokens.
[0130] The stress test time includes the stress test start time and the stress test end time, and the stress test device performs stress testing on the electronic device within this time period.
[0131] The stress test type is used to indicate which function of the electronic device is tested this time. For example, the load of the electronic device can be tested. For another example, the number of orders that can be generated by the electronic device within a preset time period can be tested. This is not limited here.
[0132] The required number of tokens is used to represent the number of stress test tokens that the electronic device needs to provide for this stress test.
[0133] S401. The electronic device generates a token to be processed, a batch identifier corresponding to the token to be processed, and configuration information corresponding to the token to be processed according to stress testing requirement parameters.
[0134] The specific implementation of S401 may refer to the contents recorded in the above S300-S302, and will not be repeated here.
[0135] S402: The electronic device sends a token to be processed to the stress testing device.
[0136] Optionally, the electronic device may send the token to be processed to the stress testing device by wired transmission or wireless transmission. Alternatively, the token to be processed may be copied from the electronic device to the stress testing device. The present disclosure does not limit the manner in which the electronic device sends the token to be processed to the stress testing device.
[0137] It should be pointed out that the present disclosure mainly uses the example of an electronic device interacting with a stress testing device to generate a token to be processed, a batch identifier corresponding to the token to be processed, and configuration information corresponding to the token to be processed as an example. In the actual process, the above process can also be performed by another device. For example, an independent server for generating tokens generates a token to be processed, a batch identifier corresponding to the token to be processed, and configuration information corresponding to the token to be processed, and sends the token to be processed to the stress testing device, and sends the batch identifier corresponding to the token to be processed to the electronic device, as well as configuration information corresponding to the token to be processed. The present disclosure does not limit this.
[0138] S403. The electronic device stores the association relationship between the token to be processed and the batch identifier corresponding to the token to be processed, and the association relationship between the batch identifier and the token to be processed.
[0139] The manner in which the electronic device stores the association relationship between the token to be processed and the batch identifier corresponding to the token to be processed can refer to the above S201. The process of the electronic device storing the association relationship between the batch identifier and the token to be processed can refer to the above S202. This disclosure will not elaborate on this.
[0140] S404: The stress testing platform generates a first operation request according to the token to be processed.
[0141] Among them, the understanding of the first operation request can refer to the relevant explanation of the first operation request in the above S200, which will not be repeated here.
[0142] S405: The stress testing platform sends a first operation request to the electronic device. Correspondingly, the electronic device receives the first operation request from the stress testing platform.
[0143] S406: The electronic device parses the first operation request and determines a token to be processed.
[0144] The specific implementation of S406 may refer to the above S200 and will not be described in detail here.
[0145] S407. The electronic device verifies whether the token to be processed has access rights.
[0146] Optionally, the electronic device can verify whether the token to be processed has access rights by verifying whether the field length of the token is consistent with the field length of the token generated by the electronic device; whether the token carries a token identifier specific to the electronic device; whether the token is a token generated by the electronic device, etc.
[0147] S408. The electronic device determines the batch identifier corresponding to the token to be processed.
[0148] The specific implementation method of S408 may refer to the above S201 and will not be described in detail here.
[0149] S409: The electronic device queries the configuration information associated with the batch identification.
[0150] The specific implementation method of S409 may refer to the above S202 and will not be repeated here.
[0151] S410. The electronic device determines whether the token to be processed is valid based on the configuration information associated with the batch identification.
[0152] The specific implementation of S410 may refer to the above S203 and will not be described in detail here.
[0153] S411: If the token to be processed is valid, the electronic device sends target data to the stress testing device.
[0154] The target data is the data requested by the stress testing device according to the first operation request.
[0155] The technical solution provided by the above-mentioned embodiment brings at least the following beneficial effects: when generating a stress testing token, the electronic device generates a batch identifier corresponding to the stress testing token and the configuration information corresponding to the stress testing token. The electronic device associates the stress testing token with the batch identifier, and the batch identifier with the configuration information. When the electronic device verifies the validity of the stress testing token, the electronic device queries the batch identifier corresponding to the token, and queries the configuration information corresponding to the batch identifier. The electronic device verifies the validity of the token through the configuration information. By reasonably setting the validity configuration information of the token, the electronic device can ensure that even if the token is leaked, other devices cannot use the leaked token to apply for access to the electronic device, thereby improving the security of the electronic device.
[0156] It can be understood that in actual implementation, the electronic device of the embodiment of the present disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding token validity verification method, and these execution hardware structures and / or software modules may constitute an electronic device. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiment disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.
[0157] Based on such understanding, the embodiments of the present disclosure also provide a token validity verification device, which can be applied to electronic devices. Figure 5 FIG. 1 shows a schematic diagram of the structure of a token validity verification device provided by an embodiment of the present disclosure. Figure 5 As shown, the token validity verification device may include: a communication module 501 and a processing module 502 .
[0158] The communication module 501 is used to obtain a token to be processed;
[0159] The processing module 502 is used to determine the batch identification of the token to be processed;
[0160] The processing module 502 is further used to query the configuration information associated with the batch identifier; the configuration information is used to characterize the effective access rights of the token to be processed;
[0161] The processing module 502 is further configured to determine whether the token to be processed is valid according to the configuration information associated with the batch identifier.
[0162] Optionally, the processing module 502 is further configured to:
[0163] Generate the token to be processed and the batch identifier corresponding to the token to be processed;
[0164] Determine the configuration information corresponding to the token to be processed;
[0165] The batch identifier is associated with the configuration information corresponding to the token to be processed.
[0166] Optionally, the configuration information associated with the batch identifier includes: a validity identifier; the validity identifier is used to indicate whether the token to be processed is valid.
[0167] Optionally, the configuration information associated with the batch identification also includes at least one of the following: interface access path information, validity time information; wherein the interface access path information is used to indicate the interface access rights of the token; and the validity time information is used to indicate the validity period of the token.
[0168] Optionally, the batch identifier corresponding to the token to be processed is a field written into the token to be processed.
[0169] Optionally, the batch identifier corresponding to the token to be processed corresponds to the token to be processed via a first association relationship table, and the first association relationship table is stored in a database.
[0170] Optionally, the batch identifier and the configuration information associated with the batch identifier correspond to each other through a second association relationship table, and the second association relationship table is stored in the database.
[0171] The disclosed embodiment also provides an electronic device, and the terminal may be a user terminal such as a mobile phone, a computer, etc. Figure 6 The electronic device provided by the embodiment of the present disclosure is shown in the structural diagram. The electronic device may be a token validity verification device, which may include at least one processor 61, a communication bus 62, a memory 63 and at least one communication interface 64.
[0172] The processor 61 may be a processor (central processing unit, CPU), a microprocessor unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution. Figure 5 , the functions implemented by the processing module in the electronic device are similar to Figure 6 The functions implemented by the processor 61 in are the same.
[0173] The communication bus 62 may include a pathway for transmitting information between the above-mentioned components.
[0174] The communication interface 64 uses any transceiver or other device for communicating with other devices or communication networks, such as servers, Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc. As an example, in combination with Figure 5 , the communication module 501 in the electronic device and the functions implemented are the same as Figure 6 The communication interface 64 in FIG.
[0175] The memory 63 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit.
[0176] The memory 63 is used to store application code for executing the solution of the present disclosure, and the execution is controlled by the processor 61. The processor 61 is used to execute the application code stored in the memory 63, so as to realize the functions in the method of the present disclosure.
[0177] In a specific implementation, as an embodiment, the processor 61 may include one or more CPUs, such as Figure 6 CPU0 and CPU1 in.
[0178] In a specific implementation, as an embodiment, the electronic device may include multiple processors, such as Figure 6 61 and 65 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0179] In a specific implementation, as an embodiment, the electronic device may further include an input device 66 and an output device 67. The input device 66 communicates with the output device 67 and may receive user input in a variety of ways. For example, the input device 66 may be a mouse, a keyboard, a touch screen device, or a sensor device. The output device 67 communicates with the processor 61 and may display information in a variety of ways. For example, the output device 67 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, or the like.
[0180] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.
[0181] The present disclosure also provides a computer-readable storage medium including instructions, and the computer-readable storage medium stores instructions. When the instructions in the computer-readable storage medium are executed by the processor of a computer device, the computer can execute the token validity verification method provided by the above-mentioned embodiment. For example, the computer-readable storage medium can be a memory 63 including instructions, and the above instructions can be executed by the processor 61 of the electronic device to complete the above method. For another example, the computer-readable storage medium can be a memory including instructions, and the above instructions can be executed by the processor of the server to complete the above method. Optionally, the computer-readable storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0182] The present disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above Figure 1-Figure 4 A token validity verification method as shown in any of the accompanying drawings.
[0183] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0184] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A token validity verification method, applied to electronic equipment, characterized in that: include: Get the pending token; The token to be processed is a token carried in an access request sent by the electronic device from other devices; Determine a batch identifier of the token to be processed, where the batch identifier corresponding to the token to be processed is a field written into the token to be processed; Querying configuration information associated with the batch identifier; The configuration information is used to characterize the effective access rights of the token to be processed; The configuration information includes interface access path information; The interface access path information is used to indicate the interface access rights of the token; The interface access path information is configured based on the service type corresponding to the token to be processed; Determine whether the token to be processed is valid according to the configuration information associated with the batch identifier.
2. The method according to claim 1, characterized in that Before obtaining the token to be processed, the method further includes: Generate the token to be processed and the batch identifier corresponding to the token to be processed; Determine the configuration information corresponding to the token to be processed; The batch identifier is associated with the configuration information corresponding to the token to be processed.
3. The method according to claim 1 or 2, characterized in that: The configuration information associated with the batch identifier includes: a validity identifier; the validity identifier is used to indicate whether the token to be processed is valid.
4. The method according to claim 3, characterized in that The configuration information associated with the batch identification also includes validity period information; the validity period information is used to indicate the validity period of the token.
5. The method according to claim 1, characterized in that The batch identifier corresponding to the token to be processed corresponds to the token to be processed via a first association relationship table, and the first association relationship table is stored in a database.
6. The method according to claim 5, characterized in that The batch identifier and the configuration information associated with the batch identifier correspond to each other through a second association relationship table, and the second association relationship table is stored in the database.
7. A token validity verification device, applied to electronic equipment, characterized in that: include: Communication module and processing module; The communication module is used to obtain a token to be processed; The token to be processed is a token carried in an access request sent by the electronic device from other devices; The processing module is used to determine the batch identifier of the token to be processed, and the batch identifier corresponding to the token to be processed is a field written into the token to be processed; The processing module is further used to query the configuration information associated with the batch identification; The configuration information is used to characterize the effective access rights of the token to be processed; the configuration information includes interface access path information; the interface access path information is used to indicate the interface access rights of the token; The interface access path information is configured based on the service type corresponding to the token to be processed; The processing module is further used to determine whether the token to be processed is valid according to the configuration information associated with the batch identifier.
8. The device according to claim 7, characterized in that The processing module is further used for: Generate the token to be processed and the batch identifier corresponding to the token to be processed; Determine the configuration information corresponding to the token to be processed; The batch identifier is associated with the configuration information corresponding to the token to be processed.
9. The device according to claim 7 or 8, characterized in that The configuration information associated with the batch identifier includes: a validity identifier; the validity identifier is used to indicate whether the token to be processed is valid.
10. The device according to claim 9, characterized in that The configuration information associated with the batch identification also includes validity time information; the validity time information is used to indicate the validity period of the token.
11. The device according to claim 7, characterized in that The batch identifier corresponding to the token to be processed corresponds to the token to be processed via a first association relationship table, and the first association relationship table is stored in a database.
12. The device according to claim 11, characterized in that The batch identifier and the configuration information associated with the batch identifier correspond to each other through a second association relationship table, and the second association relationship table is stored in the database.
13. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the token validity verification method as described in any one of claims 1-6.
14. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the token validity verification method as described in any one of claims 1 to 6.
15. A computer program product, characterized in that The computer program product includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the token validity verification method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Token-based scheme for granting permissions
CN105447381A
Network token generation method and device, terminal equipment and storage medium
CN108462581A
Service authentication method, server, electronic device and storage medium
CN112422477A
Token authentication method and device
CN112953719A