feat: Replace spring-security-jwt with nimbus-jose-jwt #11555
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've replaced
org.springframework.security.jwt
withcom.nimbusds.nimbus-jose-jwt
(version 10.3).The
org.springframework.security.jwt
library does not correctly handle tokens withtyp="at+jwt"
.nimbus-jose-jwt
is a more robust library for handling various JWT/JOSE specifications and provides the necessary functionality.Changes include:
pom.xml
to swap the JWT library dependencies.JwtTokenVerifierBuilder.java
,OAuth2DataAccessTokenServiceImpl.java
, andOAuth2TokenAuthenticationProvider.java
to use the Nimbus library for JWT parsing, signature verification (via JWKS), and claims extraction.Your existing tests are expected to cover this change as it's primarily a library replacement for underlying token processing.
Fix # (see https://help.github.com/en/articles/closing-issues-using-keywords)
Checks
Any screenshots or GIFs?
If this is a new visual feature please add a before/after screenshot or gif
here with e.g. Giphy CAPTURE or Peek
Notify reviewers
Read our Pull request merging
policy. It can help to figure out who worked on the
file before you. Please use
git blame <filename>
to determine thatand notify them either through slack or by assigning them as a reviewer on the PR