Skip to content

Relax auth_time validation on ID token refresh#18850

Closed
answndud wants to merge 1 commit intospring-projects:mainfrom
answndud:fix/auth-time-refresh-validation-18839
Closed

Relax auth_time validation on ID token refresh#18850
answndud wants to merge 1 commit intospring-projects:mainfrom
answndud:fix/auth-time-refresh-validation-18839

Conversation

@answndud
Copy link
Copy Markdown

@answndud answndud commented Mar 5, 2026

When an OP refreshes an ID token and updates auth_time (for example after SSO session renewal), strict equality with the previous ID token can reject an otherwise valid refreshed token.

This change relaxes that check in both servlet and reactive paths:

  • keep issuer/sub/aud/nonce checks as-is
  • validate auth_time is not after refreshed token iat (with configured clock skew)

Updated tests:

  • OidcAuthorizedClientRefreshedEventListenerTests
  • RefreshOidcUserReactiveOAuth2AuthorizationSuccessHandlerTests

Verification:

  • ./gradlew -PtestToolchain=21 -PtestCompileTargetVersion=21 :spring-security-oauth2-client:test --tests "org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizedClientRefreshedEventListenerTests" --tests "org.springframework.security.oauth2.client.RefreshOidcUserReactiveOAuth2AuthorizationSuccessHandlerTests" -x :spring-security-javascript:nodeSetup -x :spring-security-javascript:npmInstall -x :spring-security-javascript:npm_run_assemble -x :spring-security-javascript:assemble

Fixes #18839

Signed-off-by: MJY <jmoon0227@gmail.com>
@answndud answndud force-pushed the fix/auth-time-refresh-validation-18839 branch from 851c33d to 0b5f175 Compare March 5, 2026 04:24
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 5, 2026
@answndud
Copy link
Copy Markdown
Author

Hi team, friendly follow-up on this PR. If you'd prefer a different direction or any changes, I'm happy to update it.

@jgrandja
Copy link
Copy Markdown
Contributor

@answndud Closing this as a fix is not required. Please see this comment.

In the future, please hold off on submitting a fix until the team has evaluated the issue and determined if a fix is required. Thanks.

@jgrandja jgrandja closed this Mar 18, 2026
@jgrandja jgrandja self-assigned this Mar 18, 2026
@jgrandja jgrandja added status: declined A suggestion or change that we don't feel we should currently apply in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 18, 2026
@answndud
Copy link
Copy Markdown
Author

Sorry for jumping ahead with a fix before the team had finished evaluating the issue. I’ve been experimenting with an AI agent to automate parts of the contribution process, and I mistakenly allowed it to submit this PR prematurely without proper oversight. I’ll make sure to wait for the team's evaluation in the future before submitting any further fixes. Thanks for your understanding."

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

Labels

in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth_time validation fails when SSO session is renewed

3 participants