Skip to content

Nimbus JwtDecoders should differentiate token and service errors #7885

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

Closed
jzheaux opened this issue Jan 31, 2020 · 0 comments
Closed

Nimbus JwtDecoders should differentiate token and service errors #7885

jzheaux opened this issue Jan 31, 2020 · 0 comments
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Jan 31, 2020

In nearly all cases, NimbusJwtDecoder and NimbusReactiveJwtDecoder throw a JwtException when something goes wrong.

However, this makes it tricky to differentiate between invalid tokens and invalid application state.

One way to improve this would be to introduce a new exception that extends JwtException. Like BadCredentialsException, BadJwtException could be a good name.

Then, if the exception is BadJwtException, the application can know that it's an invalid token instead of invalid application state

@jzheaux jzheaux added type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) labels Jan 31, 2020
@jzheaux jzheaux added this to the 5.3.0.RC1 milestone Jan 31, 2020
@jzheaux jzheaux self-assigned this Jan 31, 2020
jzheaux added a commit to jzheaux/spring-security that referenced this issue Feb 4, 2020
Updated NimbusJwtDecoder and NimbusReactiveJwtDecoder to throw.
Updated JwtAuthenticationProvider and JwtReactiveAuthenticationManager
to catch.

Fixes spring-projectsgh-7885
@jzheaux jzheaux changed the title NimbusJwtDecoder and NimbusReactiveJwtDecoder Error Handling Nimbus JwtDecoders should differentiate token and service errors Feb 4, 2020
@jzheaux jzheaux closed this as completed in 0c3754c Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant