Skip to content

OidcAuthorizationCodeAuthenticationProvider adds FactorGrantedAuthority#19141

Open
louis-jaris wants to merge 1 commit intospring-projects:mainfrom
louis-jaris:oidc-auth-code-factor-authority
Open

OidcAuthorizationCodeAuthenticationProvider adds FactorGrantedAuthority#19141
louis-jaris wants to merge 1 commit intospring-projects:mainfrom
louis-jaris:oidc-auth-code-factor-authority

Conversation

@louis-jaris
Copy link
Copy Markdown

Mirror what OAuth2LoginAuthenticationProvider already does on a successful authentication: append a FACTOR_AUTHORIZATION_CODE FactorGrantedAuthority to the resulting authentication's authorities.

Without this, OIDC logins were missing the factor authority that JwtGenerator.getAuthenticationTime relies on to derive the OIDC auth_time claim, breaking id_token issuance for the authorization_code grant when a SessionInformation is registered (the assertion fails with "authenticationTime cannot be null").

NOTE: this code changes have been generated by my Claude Code... Just letting you know....

Fixes #19140

Mirror what OAuth2LoginAuthenticationProvider already does on a successful
authentication: append a FACTOR_AUTHORIZATION_CODE FactorGrantedAuthority
to the resulting authentication's authorities.

Without this, OIDC logins were missing the factor authority that
JwtGenerator.getAuthenticationTime relies on to derive the OIDC `auth_time`
claim, breaking id_token issuance for the authorization_code grant when a
SessionInformation is registered (the assertion fails with
"authenticationTime cannot be null").
Authentication authentication = this.securityContextRepository
.loadContext(new HttpRequestResponseHolder(this.request, this.response))
.getAuthentication();
assertThat(authentication.getAuthorities()).hasSize(1);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My Claude removed this line, but I guess we can also transform the 1 into 2 ? I don't know what is the standard you want guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OidcAuthorizationCodeAuthenticationProvider is missing a FactorGrantedAuthority

3 participants