Fix PyJWT support v2

This commit is contained in:
allegroai 2021-01-10 13:02:08 +02:00
parent d39f7bc195
commit 189a2b54de
2 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from abc import ABCMeta, abstractmethod
from time import time
import jwt
from jwt.algorithms import get_default_algorithms
import six
@ -69,7 +70,10 @@ class TokenManager(object):
@classmethod
def _get_token_exp(cls, token):
""" Get token expiration time. If not present, assume forever """
return jwt.decode(token, verify=False).get('exp', sys.maxsize)
return jwt.decode(
token, verify=False,
options=dict(verify_signature=False),
algorithms=get_default_algorithms()).get('exp', sys.maxsize)
def _set_token(self, token):
if token:

View File

@ -13,7 +13,7 @@ Pillow>=4.1.1
psutil>=3.4.2
pyparsing>=2.0.3
python-dateutil>=2.6.1
pyjwt>=1.6.4,<2.0.0
pyjwt>=1.6.4,<3.0.0
PyYAML>=3.12
requests-file>=1.4.2
requests>=2.20.0