Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"jwt" authenticator returns 403 instead of 401 #256

Closed
ngrigoriev opened this issue Sep 18, 2019 · 1 comment
Closed

"jwt" authenticator returns 403 instead of 401 #256

ngrigoriev opened this issue Sep 18, 2019 · 1 comment
Labels
bug Something is not working.

Comments

@ngrigoriev
Copy link
Contributor

"jwt" authenticator returns 403 instead of 401

From what I see in the code, "jwt" authenticator return 403 (StatusForbidden) in case of authentication failure. I would expect 401 (StatusUnauthorized), the documentation actually says 401 too.

Reproducing the bug

  1. Access a protected resource with an expired token
func (a *AuthenticatorJWT) Authenticate(r *http.Request, config json.RawMessage, _ pipeline.Rule) (*AuthenticationSession, error) {
...
        if err != nil {
                return nil, helper.ErrForbidden.WithReason(err.Error()).WithTrace(err)
        }

Expected behavior

401 status is returned instead (e.g. the token is not valid).

Environment

  • latest/master
@aeneasr
Copy link
Member

aeneasr commented Sep 19, 2019

Yes totally, would you be up for a PR?

@aeneasr aeneasr added the bug Something is not working. label Sep 19, 2019
ngrigoriev added a commit to ngrigoriev/oathkeeper that referenced this issue Sep 19, 2019
ngrigoriev added a commit to ngrigoriev/oathkeeper that referenced this issue Sep 20, 2019
ngrigoriev added a commit to ngrigoriev/oathkeeper that referenced this issue Sep 23, 2019
ngrigoriev added a commit to ngrigoriev/oathkeeper that referenced this issue Sep 23, 2019
Signed-off-by: Grigoriev, Nikolai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants