mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Merge pull request #4170 from freqtrade/dependabot/pip/develop/pyjwt-2.0.0
Bump pyjwt from 1.7.1 to 2.0.0
This commit is contained in:
commit
61d225a575
|
@ -44,7 +44,7 @@ def get_user_from_token(token, secret_key: str, token_type: str = "access"):
|
||||||
return username
|
return username
|
||||||
|
|
||||||
|
|
||||||
def create_token(data: dict, secret_key: str, token_type: str = "access") -> bytes:
|
def create_token(data: dict, secret_key: str, token_type: str = "access") -> str:
|
||||||
to_encode = data.copy()
|
to_encode = data.copy()
|
||||||
if token_type == "access":
|
if token_type == "access":
|
||||||
expire = datetime.utcnow() + timedelta(minutes=15)
|
expire = datetime.utcnow() + timedelta(minutes=15)
|
||||||
|
|
|
@ -30,7 +30,7 @@ sdnotify==0.3.2
|
||||||
# API Server
|
# API Server
|
||||||
fastapi==0.63.0
|
fastapi==0.63.0
|
||||||
uvicorn==0.13.3
|
uvicorn==0.13.3
|
||||||
pyjwt==1.7.1
|
pyjwt==2.0.0
|
||||||
|
|
||||||
# Support for colorized terminal output
|
# Support for colorized terminal output
|
||||||
colorama==0.4.4
|
colorama==0.4.4
|
||||||
|
|
|
@ -93,7 +93,7 @@ def test_api_auth():
|
||||||
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
|
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
|
||||||
|
|
||||||
token = create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234')
|
token = create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234')
|
||||||
assert isinstance(token, bytes)
|
assert isinstance(token, str)
|
||||||
|
|
||||||
u = get_user_from_token(token, 'secret1234')
|
u = get_user_from_token(token, 'secret1234')
|
||||||
assert u == 'Freqtrade'
|
assert u == 'Freqtrade'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user