update
This commit is contained in:
parent
122ba38beb
commit
2c9224cfeb
|
@ -25,10 +25,11 @@ def create_token(username: str, stream_key: str, exp: int = settings.JWT_EXP_TIM
|
||||||
|
|
||||||
|
|
||||||
def verify(token: str):
|
def verify(token: str):
|
||||||
try:
|
jwt.decode(token, JWT_PUB_KEY, algorithms=["RS256"])
|
||||||
jwt.decode(token, JWT_PUB_KEY, algorithms=["RS256"])
|
# try:
|
||||||
except (jwt.exceptions.ExpiredSignatureError, jwt.InvalidTokenError):
|
# jwt.decode(token, JWT_PUB_KEY, algorithms=["RS256"])
|
||||||
return False
|
# except (jwt.exceptions.ExpiredSignatureError, jwt.InvalidTokenError):
|
||||||
|
# return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,12 @@ def publish_check():
|
||||||
stream_key = request.form.get('stream_key')
|
stream_key = request.form.get('stream_key')
|
||||||
username = request.form.get('name')
|
username = request.form.get('name')
|
||||||
stream_user = user.search_stream_key(stream_key)[0]
|
stream_user = user.search_stream_key(stream_key)[0]
|
||||||
if username != stream_user['username'] or jwt.verify(stream_key.encode('utf-8')):
|
if username != stream_user['username']:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
print('vish')
|
print('vish')
|
||||||
return Response('Invalid Stream Key', 401)
|
return Response('Invalid Stream Key', 401)
|
||||||
|
|
||||||
|
jwt.verify(stream_key.encode('utf-8'))
|
||||||
return Response('OK', 200)
|
return Response('OK', 200)
|
||||||
|
|
Loading…
Reference in New Issue