Skip to content

Commit

Permalink
general exception
Browse files Browse the repository at this point in the history
  • Loading branch information
rv0lt committed Nov 5, 2024
1 parent 274ff70 commit 2eacf83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dds_web/security/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,10 @@ def decrypt_token(token):
# Decrypt token
try:
decrypted_token = jwt.JWT(key=key, jwt=token, expected_type="JWE")
except (ValueError, InvalidJWEData) as exc:
# "Token format unrecognized"
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.
raise AuthenticationError(message="Invalid token") from exc

return decrypted_token.claims
Expand Down

0 comments on commit 2eacf83

Please sign in to comment.