Skip to content

Commit

Permalink
simpler solution
Browse files Browse the repository at this point in the history
  • Loading branch information
rv0lt committed Nov 7, 2024
1 parent cf3981b commit 53b6593
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions dds_web/security/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ def __verify_general_token(token):
# ValueError is raised when the token doesn't look right (for example no periods)
# jwcryopto.common.JWException is the base exception raised by jwcrypto,
# and is raised when the token is malformed or invalid.
flask.current_app.logger.exception(e)
raise AuthenticationError(message="Invalid token") from e

expiration_time = data.get("exp")
Expand Down Expand Up @@ -370,10 +369,7 @@ def decrypt_token(token):
# Decrypt token
try:
decrypted_token = jwt.JWT(key=key, jwt=token, expected_type="JWE")
except (ValueError, jwcrypto.common.JWException) as exc:
# ValueError is raised when the token doesn't look right (for example no periods)
# jwcryopto.common.JWException is the base exception raised by jwcrypto,
# and is raised when the token is malformed or invalid.
except ValueError as exc:
raise AuthenticationError(message="Invalid token") from exc

return decrypted_token.claims
Expand Down

0 comments on commit 53b6593

Please sign in to comment.