Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions auth_jwt/application.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import jwt
import logging
import os
import json
from datetime import datetime, timedelta
Expand All @@ -23,7 +22,6 @@ def verify_client(self, client):
if 'client_id' in client_info:
client_id = client_info['client_id']
obj_client = client.query(client.client_id == client_id).get()
logging.warning("Client: %s" % obj_client)

if obj_client:
decoded_token = verify_jwt_flask(inbound_app_id, obj_client.client_secret)
Expand Down Expand Up @@ -62,7 +60,7 @@ def verify_client(self, client):
def verify_user(self, user):
if self:
if issubclass(self.__class__, Resource):
logging.warning('verifying user requests')

if 'Authorization' in request.headers:
authorization_header = request.headers.get('Authorization')
inbound_app_id = authorization_header.split(' ')[1]
Expand Down Expand Up @@ -98,11 +96,9 @@ def verify_jwt_flask(token, secret):
return decoded_token
except jwt.exceptions.ExpiredSignatureError, e:
msg = "Error: %s - %s" % (e.__class__, e.message)
logging.warning(msg)
abort(403, message=e.message)

except jwt.InvalidTokenError, e:
logging.warning("Error in JWT token: %s" % e)
return False


Expand Down Expand Up @@ -208,4 +204,4 @@ def inner(self, *args, **kwargs):
abort(401, message="Unauthorized: Please set ALLOWED_HOSTS environment variable")
else:
abort(401, message="Unauthorized no origin")
return inner
return inner