Fix "typ" header value in NimbusJwtEncoder-encoded JWT#18270
Merged
jzheaux merged 3 commits intospring-projects:mainfrom Dec 15, 2025
Merged
Fix "typ" header value in NimbusJwtEncoder-encoded JWT#18270jzheaux merged 3 commits intospring-projects:mainfrom
jzheaux merged 3 commits intospring-projects:mainfrom
Conversation
This test encodes an JWT with NimbusJwtEncoder, and then decodes it with NimbusJwtDecoder. This test will fail when NimbusJwtEncoder emits a JWT with a wrong `typ' parameter in the header, as NimbusJwtDecoder validates the JWT with JwtTypeValidator by default. It may be beneficial for finding out other similiar bugs too. Signed-off-by: Ziqin Wang <ziqin@wangziqin.net>
Closes spring-projectsgh-18269 Signed-off-by: Ziqin Wang <ziqin@wangziqin.net>
Issue spring-projectsgh-18269 Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
Contributor
|
Thanks for the PR, @ziqin. Will you please open a separate ticket to discuss handling the JWT type and RFC 9068 tokens? |
Contributor
|
Thanks for the PR, @ziqin! This is now merged into |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes gh-18269 by passing a constant string
"JWT"toJwsHeader.Builder::type(String type).This PR doesn't generate RFC 9068 compliant JWT access tokens. Should we add a configuration method to
NimbusJwtEncoderandSecretKeyJwtEncoderBuilder/RsaKeyPairJwtEncoderBuilder/EcKeyPairJwtEncoderBuilderto support generating RFC 9068 JWT access tokens?I am not sure whether it affects compatibility with the existing support for RFC 9068, e.g., the
JwtValidators.AtJwtBuilder.