-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Is your feature request related to a problem? Please describe.
The rocket request guard will always pass the outcome forward if there is a missing Authorization header, the header is missing "Bearer", and if the token itself is invalid.
Describe the solution you'd like
Depending on how your project is set up, many times this will cause the request to get caught in one of the catchers the user has defined. Most commonly I've seen 404 not found. I believe the module should be reporting back failures with the Status::Unauthorized. Similar to how you force the Outcome as "Internal Server Error" when the underlying credentials object has not yet been set.
Describe alternatives you've considered
According to rocketrs documentation there doesn't seem to be any way to catch these "forwards" unless they have some "status" associated with it.
Additional context
For example: If the module were to return a failure or forward with the content Status::Unauthorized, the developer using rocket could catch it with a #[catch(401)] so it can properly be returning the end user.