CN110266703A - Token method for refreshing, device, storage medium and controlling terminal - Google Patents

Token method for refreshing, device, storage medium and controlling terminal Download PDF

Info

Publication number
CN110266703A
CN110266703A CN201910555368.7A CN201910555368A CN110266703A CN 110266703 A CN110266703 A CN 110266703A CN 201910555368 A CN201910555368 A CN 201910555368A CN 110266703 A CN110266703 A CN 110266703A
Authority
CN
China
Prior art keywords
network request
token
refresh operation
array
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910555368.7A
Other languages
Chinese (zh)
Inventor
孙晓波
付振华
梁铉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN201910555368.7A priority Critical patent/CN110266703A/en
Publication of CN110266703A publication Critical patent/CN110266703A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0807Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0891Revocation or update of secret information, e.g. encryption key update or rekeying
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/321Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
    • H04L9/3213Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

This application involves field of Internet communication, and in particular to a kind of token method for refreshing, device, storage medium and controlling terminal, which comprises the network request that the expired network request of token is added to pre-configuration is cached array;A network request is chosen from network request caching array, refresh operation is carried out to the token of the network request within a preset time;Synchrolock is added to the refresh operation;When refresh operation success, the network request for having refreshed token is sent, to access corresponding server end interface.The application can continue, complete refresh operation to network request token in an orderly manner, guarantee that client and server carries out effective, lasting network communication.

Description

Token method for refreshing, device, storage medium and controlling terminal
Technical field
This application involves field of Internet communication, and in particular to a kind of token method for refreshing, device, storage medium and control Terminal processed.
Background technique
The most of network for using OAuth2.0 of communication of the client with server in Internet communication at present Standard, client if necessary to access user server data or resource, need to obtain a server generation token (with It is known as token down), when client access server interface, which takes token parameter, can obtain data or resource, and modification Data, and currently, client for the lasting ability for obtaining access servers' data, modifying data, needs and server end Then agreement time interval obtains new token to server end request again after that time interval, then retransmits and take Network request with new token at present can not be effectively to simultaneously when a large amount of network request needs to obtain new token Hair ground refreshes expired token and is effectively handled, and becomes current client and server carries out the bottle of smooth network communication Neck.
Summary of the invention
To overcome the above technical problem, the especially prior art that can not efficiently complete visitor after refreshing expired token The problem of family end and server end communicate, spy proposes following technical scheme:
In a first aspect, this application provides a kind of token method for refreshing, comprising:
The network request that the expired network request of token is added to pre-configuration is cached into array;
A network request is chosen from network request caching array, within a preset time to the network request Token carries out refresh operation;Synchrolock is added to the refresh operation;
When refresh operation success, the network request for having refreshed token is sent, to access corresponding server end interface.
Further, described to send the network request for having refreshed token when refresh operation success, to access corresponding clothes It is engaged in after device end interface, further includes:
Judge whether the token of the successful network request of refresh operation is expired, if so, the network request is added to again The network request of pre-configuration caches array;Continue one network request of selection from network request caching array, The step of refresh operation is carried out to the token of the network request in preset time.
Further, it is described refresh operation carried out to the token of the network request within a preset time after, further includes:
When the number of the refresh operation of the token of the network request is greater than preset times, network request failure is fed back Prompt information;
The network request is deleted from the network request of pre-configuration caching array.
It is further, described to choose a network request from network request caching array, comprising:
The severity level for obtaining network request, according to the severity level to the network request in network request caching array It is ranked up;
A network request is chosen from the network request caching array after sequence.
Further, the severity level for obtaining network request, comprising:
Obtain the associated driving function of the network request;
The severity level of the network request is determined according to the rank for driving function.
It is further, described to choose a network request from network request caching array, comprising:
The timestamp for obtaining network request carries out the network request in network request caching array according to the timestamp Sequence;
A network request is chosen from the network request caching array after sequence according to the principle of first in first out.
Further, the network request that token is expired is added to the network request caching array of pre-configuration, packet It includes:
Obtain the expired network request of the token of the same server end interface of access;
The network request that the expired network request of the token is added to pre-configuration is cached into array.
Second aspect, the application provide a kind of token refreshing apparatus, comprising:
Cache module: the network request for the expired network request of token to be added to pre-configuration caches array;
Refresh module: right within a preset time for choosing a network request from network request caching array The token of the network request carries out refresh operation;Synchrolock is added to the refresh operation;
Sending module: for sending the network request for having refreshed token when refresh operation success, to access corresponding clothes Business device end interface.
The third aspect, present invention also provides a kind of computer readable storage medium, the computer readable storage medium On be stored with computer program, which realizes above-mentioned token method for refreshing when being executed by processor.
Fourth aspect, present invention also provides a kind of controlling terminal, the controlling terminal include one or more processors, Memory, one or more computer programs, wherein one or more of computer programs are stored in the memory And be configured as being executed by one or more of processors, one or more of programs are configured to carry out above-mentioned Token method for refreshing.
The application compared with prior art, has the advantages that
This application provides the methods that the expired token of a kind of pair of network request is refreshed, in user end to server When end sends the network request for carrying token to access server end interface, if the expired error code of token is received, by token Expired network request is added in the network request caching array of pre-configuration, those token are required to complete refresh operation, visitor A network request is chosen from network request caching array in family end, carries out within a preset time to the token of the network request Refresh operation so that processing concurrently refreshes token operation, and adds the refresh operation when carrying out refresh operation and synchronizes Lock guarantees that only one thread within a preset time refresh the operation of token, avoids causing because of concurrent operations repeating to brush The problem of new token, should by what is chosen from network request caching array after the token refresh operation success of network request Network request carries the token refreshed, retransmits the network request, to allow client to can continue to access server end Corresponding interface guarantees that client and server carries out effective, lasting network communication.
The additional aspect of the application and advantage will be set forth in part in the description, these will become from the following description It obtains obviously, or recognized by the practice of the application.
Detailed description of the invention
The application is above-mentioned and/or additional aspect and advantage will become from the following description of the accompanying drawings of embodiments Obviously and it is readily appreciated that, in which:
Fig. 1 is an embodiment flow diagram of the application token method for refreshing;
Fig. 2 is another embodiment flow diagram of the application token method for refreshing;
Fig. 3 is an embodiment schematic diagram of the application token refreshing apparatus;
Fig. 4 is an example structure schematic diagram of the application controlling terminal.
Specific embodiment
Embodiments herein is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached The embodiment of figure description is exemplary, and is only used for explaining the application, and cannot be construed to the limitation to the application.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singular " one " used herein, " one It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in the description of the present application Diction " comprising " refers to that there are the feature, integer, step, operations, but it is not excluded that in the presence of or addition it is one or more other Feature, integer, step, operation.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art Language and scientific term), there is meaning identical with the general understanding of those of ordinary skill in the application fields.Should also Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art The consistent meaning of meaning, and unless idealization or meaning too formal otherwise will not be used by specific definitions as here To explain.
The embodiment of the present application provides a kind of token method for refreshing, as shown in Figure 1, the described method comprises the following steps:
S10: the network request that the expired network request of token is added to pre-configuration is cached into array.
The present embodiment can be applied in the communication of client and server, when client needs to access server data Or resource, client need to obtain the token of server end generation, which is known as token, client by the present embodiment After obtaining token, when accessing the interface of server, the network request that transmission takes token can obtain the number of server According to or resource, such as obtain user server data or modify user server data, including user's name, head portrait etc.. And the token is there are certain validity period, when the token of network request is expired, just can not normal access server interface, this In embodiment, token flush mechanism RefreshTokenHelper is established in client, RefreshTokenHelper is pre-configured And safeguard that a network request caches array, when token is expired, RefreshTokenHelper receives the expired mistake of token After error code, the network request that the expired network request of token is added to pre-configuration is cached into array, those network requests Token wait it is to be refreshed.
S20: a network request is chosen from network request caching array, within a preset time to the network request Token carry out refresh operation;Synchrolock is added to the refresh operation.
Number is cached in the network request that the expired network request of token is added to RefreshTokenHelper pre-configuration After group, need to refresh the token of those network requests, in the present embodiment, the token of network request wait it is to be brushed Newly, that is, the concurrent refresh operation of token is triggered, in the present embodiment, there is RefreshTokenHelper processing concurrently to refresh token The function of operation, specifically, choosing a network request from network request caching array, then initial the latter is default Time such as 3s carries out refresh operation to the token of the network request in the preset time, when carrying out refresh operation to institute Refresh operation is stated plus synchrolock synchronize, guarantees that only one thread within a preset time refresh the behaviour of token Make, avoids the problem that causing to repeat because of concurrent operations to refresh token.
S30: when refresh operation success, sending the network request for having refreshed token, to access corresponding server termination Mouthful.
After the token refresh operation success of network request, the network chosen from network request caching array is asked The token refreshed on carrying is sought, the network request is retransmitted, it is corresponding to allow client to can continue to access server end Interface obtains corresponding data or resource, while RefreshTokenHelper empties the network request in the network of pre-configuration Request caching array caching, to reduce the occupancy of resource.
The method that the expired token of a kind of pair of network request is refreshed is present embodiments provided, in client to service It, will if receiving the expired error code of token when device end sends the network request for carrying token to access server end interface Token expired network request is added in the network request caching array of pre-configuration, those token are required to complete to refresh behaviour Make, client chooses a network request from network request caching array, within a preset time to the token of the network request Progress refresh operation so that processing concurrently refreshes token operation, and adds together the refresh operation when carrying out refresh operation Step lock, guarantee within a preset time only one thread carry out refresh token operation, avoid causing to repeat because of concurrent operations The problem of refreshing token, after the token refresh operation success of network request, by what is chosen from network request caching array The network request carries the token refreshed, retransmits the network request, to allow client to can continue to access server Corresponding interface is held, guarantees that client and server carries out effective, lasting network communication.
A kind of embodiment of the application, as shown in Fig. 2, it is described when refresh operation success, send the network for having refreshed token Request, after accessing corresponding server end interface, further includes:
S40: judge whether the token of the successful network request of refresh operation is expired, if so, the network request is added again Add to the network request caching array of pre-configuration;Continue one network of selection from network request caching array to ask The step of asking, refresh operation carried out to the token of the network request within a preset time.
In the present embodiment, after refreshing the token of a network request and retransmitting the network request, the brush is judged Whether the token for newly operating successful network request still falls within expired state, if so, the network request is added to again pre- The network request of configuration caches array, then repeats the step of executing above-described embodiment, persistently refreshes the network request Token guarantees that the network request can normally access corresponding clothes until the token of the network request is not belonging to expired state Business device end interface.
A kind of embodiment of the application, it is described within a preset time to the token of the network request carry out refresh operation it Afterwards, further includes:
When the number of the refresh operation of the token of the network request is greater than preset times, network request failure is fed back Prompt information;
The network request is deleted from the network request of pre-configuration caching array.
In the present embodiment, before the token to network request refreshes, judge that the token of the network request refreshes Whether the number of operation is greater than preset times, if so, can the network request token refresh operation it is invalid, be unable to get just True token, the token for further relating to the network request have certain problems, if carrying out again to the network request lasting Token refresh operation can only expend more resources, at this point, feeding back the prompt information of network request failure, remind client User can not normally complete the transmission of the network request, can not normally access the interface of server end response, further, will The network request of server end the corresponding interface still can not be normally accessed after the multiple token refresh operation of the carry out from the net of pre-configuration It is deleted in network request caching array, reduces the occupancy of resource.
A kind of embodiment of the application, it is described to choose a network request from network request caching array, comprising:
The severity level for obtaining network request, according to the severity level to the network request in network request caching array It is ranked up;
A network request is chosen from the network request caching array after sequence.
In the present embodiment, when choosing a network request from network request caching array, the weight of network request is obtained Rank is wanted, the network request in network request caching array is ranked up according to the severity level, network request caches number The concurrent network request of multiple transmissions that fail may be stored in group, when handling those network requests, according to The severity level of network request is ranked up network request, and the high network request of severity level is sorted in preceding, severity level Then low network request sequence chooses a high network of severity level from the network request caching array after sequence rear Request, the high network request of severity level, which has corresponded to, applies the severity level for the data or resource to be obtained also higher, subsequent Just refresh operation, the high network of priority processing severity level can be carried out to the token of the higher network request of those severity levels Request, it is ensured that the high network request of those severity levels can obtain priority processing, improve application and obtain the high number of severity level According to or resource efficiency.
A kind of embodiment of the application, the severity level for obtaining network request, comprising:
Obtain the associated driving function of the network request;
The severity level of the network request is determined according to the rank for driving function.
The present embodiment applies the vehicle-mounted assistant's client installed on car steering field, automobile, vehicle-mounted assistant's client For receiving the instruction and data of each function of car steering, it is also used to the communication with server end, in the present embodiment, vehicle-mounted assistant After the network request of several token is added to the network request caching array of pre-configuration by client, obtains those networks and ask Associated driving function is sought, the severity level of the network request is then determined according to each different stage for driving function, such as The associated driving function of network request A1 be T1, associated the drivings function of network request A2 be T2, driving function T1 rank compared with T2 high, thus the severity level of network request A1 is compared with A2 high, thus at the network request to network request caching array When reason, network request is ranked up according to the severity level of network request, it is subsequent just can be to the higher net of those severity levels The token of network request carries out refresh operation, it is ensured that the high network request of those severity levels can obtain priority processing, thus really The not higher driving function of safeguarding grades accesses priority processing, improves the safety of car steering.
A kind of embodiment of the application, it is described to choose a network request from network request caching array, comprising:
The timestamp for obtaining network request carries out the network request in network request caching array according to the timestamp Sequence;
A network request is chosen from the network request caching array after sequence according to the principle of first in first out.
In the present embodiment, from network request caching array in choose a network request when, obtain network request when Between stab, according to the timestamp to network request caching array in network request be ranked up, network request cache array in The concurrent network request of multiple transmissions that fail may be stored with, when handling those network requests, according to according to The principle of first in first out is ranked up network request, and by the network request first generated sequence preceding, the network generated afterwards is asked It asks sequence rear, then chooses a network request from the network request caching array after sequence, guarantee that network request can Sequence is handled, and each network request has the processing rank of equality, it is ensured that each network request can be handled in time, and raising is answered The fairness of data or resource is obtained with each function.
A kind of embodiment of the application, the network request that the network request that token is expired is added to pre-configuration delay Deposit array, comprising:
Obtain the expired network request of the token of the same server end interface of access;
The network request that the expired network request of the token is added to pre-configuration is cached into array.
There are the identical server end interfaces of multiple network request access for client, and due to the change of server end, it should The token of a little network requests belongs to expired state, prewired the expired network request of token to be added in the present embodiment When the network request caching array set, the network request for accessing same server end interface is managed collectively, that is, is obtained and visited It asks the expired network request of the token of same server end interface, is then added to the expired network request of the token pre- The network request of configuration caches array, such as network request A1, A2, A3, A4 access same server end interface P1, and network is asked It asks A5, A6, A7 to access same server end interface P2, network request A1, A2, A3, A4 is added to the network of pre-configuration at this time In request caching array Q1, network request A5, A6, A7 are added in the network request caching array Q2 of pre-configuration, subsequent point It is other to request the network request of caching array to handle heterogeneous networks, array, which is cached, by multiple network requests of pre-configuration deposits Storage accesses the network request of same server end interface, and network request caches array and server end interface is exclusive dedicated, thus Improve the treatment effeciency of the network request expired to token.
As shown in figure 3, in another embodiment, this application provides a kind of token refreshing apparatus, comprising:
Cache module 10: the network request for the expired network request of token to be added to pre-configuration caches array;
Refresh module 20: for choosing a network request from network request caching array, within a preset time Refresh operation is carried out to the token of the network request;Synchrolock is added to the refresh operation;
Sending module 30: corresponding to access for sending the network request for having refreshed token when refresh operation success Server end interface.
A kind of embodiment of the application, the cache module 10 further include executing;
Judge whether the token of the successful network request of refresh operation is expired, if so, the network request is added to again The network request of pre-configuration caches array;Continue one network request of selection from network request caching array, The step of refresh operation is carried out to the token of the network request in preset time.
A kind of embodiment of the application, described device further include:
Feedback module: for when the number of the refresh operation of the token of the network request is greater than preset times, feedback should The prompt information of network request failure;
The network request is deleted from the network request of pre-configuration caching array.
A kind of embodiment of the application, the refresh module 20 further include executing:
The severity level for obtaining network request, according to the severity level to the network request in network request caching array It is ranked up;
A network request is chosen from the network request caching array after sequence.
A kind of embodiment of the application, the refresh module 20 further include executing:
Obtain the associated driving function of the network request;
The severity level of the network request is determined according to the rank for driving function.
A kind of embodiment of the application, the refresh module 20 further include executing:
The timestamp for obtaining network request carries out the network request in network request caching array according to the timestamp Sequence;
A network request is chosen from the network request caching array after sequence according to the principle of first in first out.
A kind of embodiment of the application, the cache module 10 further include executing:
Obtain the expired network request of the token of the same server end interface of access;
The network request that the expired network request of the token is added to pre-configuration is cached into array.
In another embodiment, this application provides a kind of computer readable storage medium, computer-readable storage mediums Computer program is stored in matter, which realizes speech recognition side described in above-described embodiment when being executed by processor Method.Wherein, the computer readable storage medium includes but is not limited to any kind of disk (including floppy disk, hard disk, CD, CD- ROM and magneto-optic disk), ROM (Read-Only Memory, read-only memory), RAM (Random AcceSS Memory, immediately Memory), EPROM (EraSable Programmable Read-Only Memory, Erarable Programmable Read only Memory), (Electrically EraSable Programmable Read-Only Memory, electric erazable programmable is read-only to be deposited EEPROM Reservoir), flash memory, magnetic card or light card.It is, storage equipment includes by equipment with the form storage that can be read or biography Any medium of defeated information can be read-only memory, disk or CD etc..
A kind of computer readable storage medium provided by the embodiments of the present application is, it can be achieved that network request that token is expired It is added to the network request caching array of pre-configuration;A network request is chosen from network request caching array, pre- If carrying out refresh operation to the token of the network request in the time;Synchrolock is added to the refresh operation;When refresh operation at Function sends the network request for having refreshed token, to access corresponding server end interface.By providing a kind of pair of network request The method that is refreshed of expired token, the network request for carrying token is sent in client to access service When device end interface, if receiving the expired error code of token, the network that the expired network request of token is added to pre-configuration is asked It asks in caching array, those token are required to complete refresh operation, and client chooses a net from network request caching array Network request, carries out refresh operation to the token of the network request within a preset time, so that processing concurrently refreshes token operation, And synchrolock is added to the refresh operation when carrying out refresh operation, guarantee that only one thread is brushed within a preset time The operation of new token avoids the problem that causing to repeat because of concurrent operations to refresh token, when the token of network request refreshes behaviour After making successfully, the network request chosen from network request caching array is carried into the token refreshed, retransmitting should Network request guarantees that client and server is had to allow client to can continue to the access corresponding interface of server end Effect, lasting network communication.
The implementation of above-mentioned token method for refreshing may be implemented in computer readable storage medium provided by the embodiments of the present application Example, concrete function realize the explanation referred in embodiment of the method, and details are not described herein.
In addition, the application also provides a kind of controlling terminal in another embodiment, as shown in figure 4, the controlling terminal Including devices such as processor 403, memory 405, input unit 407 and display units 409.Those skilled in the art can manage Solution, the structure devices shown in Fig. 4 do not constitute the restriction to all controlling terminals, may include than illustrating more or fewer portions Part, or the certain components of combination.The memory 405 can be used for storing computer program 401 and each functional module, the place Reason device 403 runs the computer program 401 for being stored in memory 405, thereby executing the various function application and data of equipment Processing.The memory 405 can be built-in storage or external memory, or including both built-in storage and external memory.It is interior Memory may include that read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically-erasable can be compiled Journey ROM (EEPROM), flash memory or random access memory.
Input unit 407 is used to receive the input of signal and receives the input of user, and input unit 407 may include touch surface Plate and other input equipments, touch panel collect the touch operation of user on it or nearby, and according to preset The corresponding attachment device of driven by program.Display unit 409 can be used for showing the information of user's input or be supplied to the information of user And the various menus of computer equipment.The forms such as liquid crystal display, Organic Light Emitting Diode can be used in display unit 409.Place Reason device 403 is that the control centre of computer equipment passes through fortune using the various pieces of various interfaces and the entire computer of connection Row executes the software program and/or module being stored in memory 403, and calls the data being stored in memory, holds The various functions of row and processing data.
In one embodiment, the controlling terminal includes that one or more processors 403 and one or more are deposited Reservoir 405, one or more computer programs 401, wherein one or more of computer programs 401 are stored in memory It in 405 and is configured as being executed by one or more of processors 403, one or more of computer programs 401 configure For executing audio recognition method described in above embodiments.One or more processors 403 shown in Fig. 4 are able to carry out, Realize cache module 10, refresh module 20, the function of sending module 30 shown in Fig. 3.
A kind of controlling terminal provided by the embodiments of the present application is, it can be achieved that the expired network request of token is added to prewired The network request caching array set;A network request is chosen from network request caching array, it is right within a preset time The token of the network request carries out refresh operation;Synchrolock is added to the refresh operation;When refresh operation success, send Refresh the network request of token, to access corresponding server end interface.By providing the expired of a kind of pair of network request The method that token is refreshed sends the network request for carrying token in client to access server termination When mouth, if receiving the expired error code of token, the network request that the expired network request of token is added to pre-configuration is cached In array, those token are required to complete refresh operation, and client is chosen a network from network request caching array and asked It asks, refresh operation is carried out to the token of the network request within a preset time, operated so that processing concurrently refreshes token, and Synchrolock is added to the refresh operation when carrying out refresh operation, guarantees that only one thread is refreshed within a preset time The operation of token avoids the problem that causing to repeat because of concurrent operations to refresh token, when the token refresh operation of network request After success, the network request chosen from network request caching array is carried into the token refreshed, retransmits the net It is effective to guarantee that client and server carries out to allow client to can continue to the access corresponding interface of server end for network request , lasting network communication.
The embodiment of the token method for refreshing of above-mentioned offer may be implemented in controlling terminal provided by the embodiments of the present application, tool Body function realizes the explanation referred in embodiment of the method, and details are not described herein.
The above is only some embodiments of the application, it is noted that for the ordinary skill people of the art For member, under the premise of not departing from the application principle, several improvements and modifications can also be made, these improvements and modifications are also answered It is considered as the protection scope of the application.

Claims (10)

1. a kind of token method for refreshing, which comprises the following steps:
The network request that the expired network request of token is added to pre-configuration is cached into array;
A network request is chosen from network request caching array, within a preset time to the token of the network request Carry out refresh operation;Synchrolock is added to the refresh operation;
When refresh operation success, the network request for having refreshed token is sent, to access corresponding server end interface.
2. transmission has refreshed token's the method according to claim 1, wherein described when refresh operation success Network request, after accessing corresponding server end interface, further includes:
Judge whether the token of the successful network request of refresh operation is expired, if so, the network request is added to again prewired The network request caching array set;Continue one network request of selection from network request caching array, default The step of refresh operation is carried out to the token of the network request in time.
3. the method according to claim 1, wherein described within a preset time to the token of the network request After progress refresh operation, further includes:
When the number of the refresh operation of the token of the network request is greater than preset times, mentioning for network request failure is fed back Show information;
The network request is deleted from the network request of pre-configuration caching array.
4. the method according to claim 1, wherein described choose one from network request caching array Network request, comprising:
The severity level for obtaining network request carries out the network request in network request caching array according to the severity level Sequence;
A network request is chosen from the network request caching array after sequence.
5. according to the method described in claim 4, it is characterized in that, the severity level for obtaining network request, comprising:
Obtain the associated driving function of the network request;
The severity level of the network request is determined according to the rank for driving function.
6. the method according to claim 1, wherein described choose one from network request caching array Network request, comprising:
The timestamp for obtaining network request arranges the network request in network request caching array according to the timestamp Sequence;
A network request is chosen from the network request caching array after sequence according to the principle of first in first out.
7. the method according to claim 1, wherein the network request that token is expired be added to it is prewired The network request caching array set, comprising:
Obtain the expired network request of the token of the same server end interface of access;
The network request that the expired network request of the token is added to pre-configuration is cached into array.
8. a kind of token refreshing apparatus characterized by comprising
Cache module: the network request for the expired network request of token to be added to pre-configuration caches array;
Refresh module: for choosing a network request from network request caching array, within a preset time to the net The token of network request carries out refresh operation;Synchrolock is added to the refresh operation;
Sending module: for the network request for having refreshed token being sent, to access corresponding server when refresh operation success End interface.
9. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program realizes claim 1 to 7 described in any item token method for refreshing when the computer program is executed by processor.
10. a kind of controlling terminal characterized by comprising
One or more processors;
Memory;
One or more computer programs, wherein one or more of computer programs are stored in the memory and quilt It is configured to be executed by one or more of processors, one or more of computer programs are configured to carry out according to right It is required that 1 to 7 described in any item token method for refreshing.
CN201910555368.7A 2019-06-25 2019-06-25 Token method for refreshing, device, storage medium and controlling terminal Pending CN110266703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910555368.7A CN110266703A (en) 2019-06-25 2019-06-25 Token method for refreshing, device, storage medium and controlling terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910555368.7A CN110266703A (en) 2019-06-25 2019-06-25 Token method for refreshing, device, storage medium and controlling terminal

Publications (1)

Publication Number Publication Date
CN110266703A true CN110266703A (en) 2019-09-20

Family

ID=67921357

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910555368.7A Pending CN110266703A (en) 2019-06-25 2019-06-25 Token method for refreshing, device, storage medium and controlling terminal

Country Status (1)

Country Link
CN (1) CN110266703A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112671539A (en) * 2020-11-23 2021-04-16 苏州浪潮智能科技有限公司 Method, system, medium and device for processing overdue renewal of multi-request token
CN114006698A (en) * 2021-12-31 2022-02-01 荣耀终端有限公司 token refreshing method and device, electronic equipment and readable storage medium
CN114520744A (en) * 2022-02-28 2022-05-20 佛山众陶联供应链服务有限公司 Method and system for automatic authentication and login non-refreshing of front end of web system
CN114978605A (en) * 2022-04-25 2022-08-30 联仁健康医疗大数据科技股份有限公司 Page access method and device, electronic equipment and storage medium
WO2023045970A1 (en) * 2021-09-24 2023-03-30 深圳前海微众银行股份有限公司 Method and apparatus for determining access token

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103890711A (en) * 2011-06-29 2014-06-25 亚马逊科技公司 Data locker synchronization
US9819665B1 (en) * 2015-06-26 2017-11-14 EMC IP Holding Company LLC Synchronization of access tokens for session continuity across multiple devices
CN108632329A (en) * 2017-03-24 2018-10-09 华为技术有限公司 A kind of access method and device of third side plug
CN109379192A (en) * 2018-09-21 2019-02-22 广州小鹏汽车科技有限公司 A kind of login authentication processing method, system and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103890711A (en) * 2011-06-29 2014-06-25 亚马逊科技公司 Data locker synchronization
US9819665B1 (en) * 2015-06-26 2017-11-14 EMC IP Holding Company LLC Synchronization of access tokens for session continuity across multiple devices
CN108632329A (en) * 2017-03-24 2018-10-09 华为技术有限公司 A kind of access method and device of third side plug
CN109379192A (en) * 2018-09-21 2019-02-22 广州小鹏汽车科技有限公司 A kind of login authentication processing method, system and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
MR_FOUR,简书: "retrofit刷新token并发处理", 《HTTPS://WWW.JIANSHU.COM/P/C325F5C32709》 *
农田蚂蚁,简书: "retrofit+rxjava 刷新token并发处理", 《HTTPS://WWW.JIANSHU.COM/P/EB7042693D52》 *
胡越明: "《Internet技术及其实现》", 30 September 2003, 高等教育出版社 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112671539A (en) * 2020-11-23 2021-04-16 苏州浪潮智能科技有限公司 Method, system, medium and device for processing overdue renewal of multi-request token
CN112671539B (en) * 2020-11-23 2022-09-20 苏州浪潮智能科技有限公司 Method, system, medium and device for processing overdue renewal of multi-request token
WO2023045970A1 (en) * 2021-09-24 2023-03-30 深圳前海微众银行股份有限公司 Method and apparatus for determining access token
CN114006698A (en) * 2021-12-31 2022-02-01 荣耀终端有限公司 token refreshing method and device, electronic equipment and readable storage medium
CN114006698B (en) * 2021-12-31 2022-03-08 荣耀终端有限公司 token refreshing method and device, electronic equipment and readable storage medium
CN114520744A (en) * 2022-02-28 2022-05-20 佛山众陶联供应链服务有限公司 Method and system for automatic authentication and login non-refreshing of front end of web system
CN114978605A (en) * 2022-04-25 2022-08-30 联仁健康医疗大数据科技股份有限公司 Page access method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110266703A (en) Token method for refreshing, device, storage medium and controlling terminal
CN110636103B (en) Unified scheduling method for multi-heterogeneous cluster jobs and API (application program interface)
US5682478A (en) Method and apparatus for supporting multiple, simultaneous services over multiple, simultaneous connections between a client and network server
US8117258B2 (en) Distributed computing by carrier-hosted agent
CN103038788B (en) Providing multiple network resources
US11409719B2 (en) Co-locating microservice persistence containers within tenant-specific database
CN109379448B (en) File distributed deployment method and device, electronic equipment and storage medium
CN110365752A (en) Processing method, device, electronic equipment and the storage medium of business datum
US10817327B2 (en) Network-accessible volume creation and leasing
CN104980925B (en) The authentication method and device of user's request
CN1894667A (en) System and method for allocating server resources
CN1717676A (en) Methods and systems for communicating over a client-server network
CN102447677A (en) Resource access control method, system and equipment
WO2001071523A1 (en) Transparent user and session management for web applications
CN102148817A (en) Network equipment configuration method, client, server and network system
US9569295B2 (en) Indicating states in a telematic system
CN1701315A (en) Database access control method, database access controller, agent processing server
CN103765387A (en) Distributed resource management in a portable computing device
CN109117252A (en) Method, system and the container cluster management system of task processing based on container
CA3093831C (en) System and method for generating prediction based guis to improve gui response times
CN1475931A (en) Distribution document and system of sending/receiving distributed document
CN108881493A (en) A kind of Task Progress information-pushing method, device and equipment
CN106254411B (en) For providing system, server system and the method for service
CN103069741A (en) Credential authentication method and single sign-on server
US20100222022A1 (en) Communication method, communication system and access method to service provider base

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190920

RJ01 Rejection of invention patent application after publication