mirror of
https://github.com/clearml/clearml
synced 2025-02-07 13:23:40 +00:00
Improve PyJWT resiliency support
This commit is contained in:
parent
3b240b48c4
commit
d747b2e93e
@ -70,10 +70,18 @@ class TokenManager(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_decoded_token(cls, token):
|
def get_decoded_token(cls, token):
|
||||||
""" Get token expiration time. If not present, assume forever """
|
""" Get token expiration time. If not present, assume forever """
|
||||||
|
if hasattr(jwt, '__version__') and jwt.__version__[0] == '1':
|
||||||
|
return jwt.decode(
|
||||||
|
token,
|
||||||
|
verify=False,
|
||||||
|
algorithms=get_default_algorithms(),
|
||||||
|
)
|
||||||
|
|
||||||
return jwt.decode(
|
return jwt.decode(
|
||||||
token,
|
token,
|
||||||
options=dict(verify_signature=False),
|
options=dict(verify_signature=False),
|
||||||
algorithms=get_default_algorithms())
|
algorithms=get_default_algorithms(),
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_token_exp(cls, token):
|
def _get_token_exp(cls, token):
|
||||||
|
@ -11,7 +11,7 @@ Pillow>=4.1.1
|
|||||||
psutil>=3.4.2
|
psutil>=3.4.2
|
||||||
pyparsing>=2.0.3
|
pyparsing>=2.0.3
|
||||||
python-dateutil>=2.6.1
|
python-dateutil>=2.6.1
|
||||||
pyjwt>=1.6.4,<3.0.0
|
pyjwt>=1.6.4,<=2.1.0
|
||||||
PyYAML>=3.12
|
PyYAML>=3.12
|
||||||
requests>=2.20.0
|
requests>=2.20.0
|
||||||
six>=1.11.0
|
six>=1.11.0
|
||||||
|
Loading…
Reference in New Issue
Block a user