warden-jwt_auth
warden-jwt_auth copied to clipboard
JWT::DecodeError must be suppressed as JWT::ExpiredSignature is
Expected behavior
When I use an invalid JWT through the revocation middleware, it should suppress the JWT::DecodeError as JWT::ExpiredSignature. This will allow to handle properly on the receiving part of the request and generate a proper HTTP status.
Actual behavior
When I use an invalid JWT through the revocation middleware, it raises an exception JWT::DecodeError, since this middleware will resolve after the response was generated occurring in a 500 HTTP status and not preserving any HTTP status previously defined.
Steps to Reproduce the Problem
- Configure this gem
- Send an invalid JWT
- Receives an exception about
JWT::DecodeError
Debugging information
Trying to understand. Isn't it the other way round? We're catching JWT::DecodeError here:
https://github.com/waiting-for-dev/warden-jwt_auth/blob/09c78d747cab802180e4d93a14cc33cf313e27d0/lib/warden/jwt_auth/strategy.rb#L22
Closing, feel free to follow up, though.