-
Notifications
You must be signed in to change notification settings - Fork 6k
gh-8589 Additional Jwt validation debug messages #8665
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Budlee! Before I review, can you tell me what this PR gives you that printing the stack trace in AuthenticationWebFilter
would not give you? The reason I ask is that logging the stack trace is something that I'm thinking about adding.
Hey @jzheaux, I think that would be good to have as well. The other thing is in this specific case is that I have logging for each JWT Validator that fails. This is quite nice in the log. Maybe it should change but the current validate gets the first validation fail even if there is many. So if we had the stach trace you would only see the first error of the token if ( result.hasErrors() ) {
String message = result.getErrors().iterator().next().getDescription();
throw new JwtValidationException(message, result.getErrors());
} This seems silly as the DelegatedOauth collects all for (OAuth2TokenValidator<T> validator : this.tokenValidators) {
errors.addAll(validator.validate(token).getErrors());
} Also I think this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Budlee! I've left some feedback inline.
...oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtTimestampValidator.java
Outdated
Show resolved
Hide resolved
...amework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManager.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidator.java
Outdated
Show resolved
Hide resolved
That's great feedback, @Budlee. I'll try and address a couple of your comments:
What would you supply as the message for the exception if not the first validation error message?
I agree that this could be polished. The |
@jzheaux, As the validators are now all logging it does make sense for just the first error to go back Please let me know if you want any more changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Budlee! I've left a bit more feedback.
...th2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoder.java
Outdated
Show resolved
Hide resolved
...oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtTimestampValidator.java
Outdated
Show resolved
Hide resolved
...amework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManager.java
Outdated
Show resolved
Hide resolved
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimValidator.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidator.java
Outdated
Show resolved
Hide resolved
@jzheaux i've updates |
Thanks for the updates, @Budlee! It looks like the build is failing. Will you try rebasing, and double-check by running Then, at that point in preparation for merging, would you please squash your commits and format the commit message. |
Adding extra logging for JWT Validation
#8589