changed the exception name AuthenticationError instead of AuthorizationError since this method we are authenticating, not authorizing

pull/6/head
Chris Veilleux 2018-09-25 22:15:50 -05:00
parent 4cada6d99a
commit eb2c392f01
1 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import jwt
_log = getLogger(__package__)
class AuthorizationError(Exception):
class AuthenticationError(Exception):
pass
@ -23,10 +23,10 @@ def decode_auth_token(auth_token: str, secret_key: str) -> tuple:
except jwt.ExpiredSignatureError:
error_msg = 'Selene token expired'
_log.info(error_msg)
raise AuthorizationError(error_msg)
raise AuthenticationError(error_msg)
except jwt.InvalidTokenError:
error_msg = 'Invalid Selene token'
_log.info(error_msg)
raise AuthorizationError(error_msg)
raise AuthenticationError(error_msg)
return user_uuid