File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/DIRAC/FrameworkSystem/Client Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1
1
""" The TokenManagerClient is a class representing the client of the DIRAC
2
2
:py:mod:`TokenManager <DIRAC.FrameworkSystem.Service.TokenManagerHandler>` service.
3
3
"""
4
+ import time
5
+
4
6
from DIRAC import S_OK , S_ERROR
5
7
from DIRAC .Core .Utilities import ThreadSafe
6
8
from DIRAC .Core .Utilities .DictCache import DictCache
@@ -70,15 +72,15 @@ def getToken(
70
72
if result ["OK" ]:
71
73
token = OAuth2Token (dict (result ["Value" ]))
72
74
73
- # Get the date at which the token will expire
75
+ # Get the date at which the token will expire (it is expressed as a Unix timestamp)
74
76
# If the refresh token is present, we use it as we can easily generate an access token from it
75
77
duration = token .get_claim ("exp" , "access_token" ) or DEFAULT_AT_EXPIRATION_TIME
76
78
if token .get ("refresh_token" ):
77
79
duration = token .get_claim ("exp" , "refresh_token" ) or DEFAULT_RT_EXPIRATION_TIME
78
80
79
81
self .__tokensCache .add (
80
82
cachedKey ,
81
- duration ,
83
+ duration - time . time () ,
82
84
token ,
83
85
)
84
86
You can’t perform that action at this time.
0 commit comments