Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Revisit the OIDC/OAuth2 bearer middleware to stop re-throwing exceptions for invalid tokens #411

@kevinchalet

Description

@kevinchalet

By default, both the OIDC and the OAuth2 bearer middleware throw a bunch of security exceptions when a token is invalid. These exceptions are caught but the catch handler always re-throw them if you don't override the AuthenticationFailed notification and explicitly call HandleResponse() or SkipToNextMiddleware(), which is - obviously - a very bad thing, as you don't want to get a 500 response - or worse, an error page - for an invalid token.

In this case, 401 is the only response you want: https://tools.ietf.org/html/rfc6750#section-3.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions