Add regression test for FactorGrantedAuthority Jackson support - #19594
Open
jyx-07 wants to merge 1 commit into
Open
Add regression test for FactorGrantedAuthority Jackson support#19594jyx-07 wants to merge 1 commit into
jyx-07 wants to merge 1 commit into
Conversation
Add a test to OAuth2AuthorizationServerJackson2ModuleTests and its Jackson 3 counterpart that round-trips an OAuth2Authorization's Principal attribute when the principal's authorities include a FactorGrantedAuthority, using the same ObjectMapper/JsonMapper setup JdbcOAuth2AuthorizationService builds internally. FactorGrantedAuthorityMixin already exists and is registered in CoreJackson2Module/CoreJacksonModule (added together with FactorGrantedAuthority itself), so this round trip already succeeds on main. This test only locks in that existing, previously uncovered behavior so a future regression is caught before release. Closes spring-projectsgh-18771 Signed-off-by: jyx-07 <s25069@gsm.hs.kr>
|
Acknowledged, I will update my test project to springboot 4.1.0 and retest the native image within the week, thanks for the heads-up, @jyx-07. |
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.
Summary
#18771 reports that
JdbcOAuth2AuthorizationServicefails to deserializeFactorGrantedAuthoritybecause of a missing Jackson mixin, and @k6leung validated aFactorGrantedAuthorityMixin+ module as a workaround.Investigating on current
main,FactorGrantedAuthorityMixinalready exists and is already registered in bothCoreJackson2ModuleandCoreJacksonModule— it was added together withFactorGrantedAuthorityitself, before this issue was filed. A from-scratch reproduction (round-tripping aUsernamePasswordAuthenticationTokenwhose authorities include aFactorGrantedAuthority, through the exactObjectMapper/JsonMappersetupJdbcOAuth2AuthorizationServicebuilds internally) already passes onmain, so adding another mixin would just duplicate existing plumbing.Rather than duplicate that fix, this PR adds a regression test — to
OAuth2AuthorizationServerJackson2ModuleTestsand its Jackson 3 counterpartOAuth2AuthorizationServerJacksonModuleTests— that locks in the already-working round trip so a future regression here is caught before release. I verified the test is non-tautological by temporarily reverting the mixin registration locally and confirming both new tests fail without it.I'll comment on #18771 to let @k6leung know the underlying mixin is already fixed on
main.Test plan
readValueWhenOAuth2AuthorizationAttributesWithFactorGrantedAuthorityThenSuccessto bothOAuth2AuthorizationServerJackson2ModuleTestsandOAuth2AuthorizationServerJacksonModuleTests.FactorGrantedAuthorityMixinregistration is reverted, confirming they're not tautological../gradlew :spring-security-oauth2-authorization-server:test— full module suite passes.Closes gh-18771