Skip to content

Add allowIfSubType for URL and Instant in OAuth2ClientJacksonModule#19243

Open
qwerty7878 wants to merge 1 commit into
spring-projects:mainfrom
qwerty7878:fix/oauth2-jackson-module-allow-url-instant
Open

Add allowIfSubType for URL and Instant in OAuth2ClientJacksonModule#19243
qwerty7878 wants to merge 1 commit into
spring-projects:mainfrom
qwerty7878:fix/oauth2-jackson-module-allow-url-instant

Conversation

@qwerty7878

@qwerty7878 qwerty7878 commented May 30, 2026

Copy link
Copy Markdown

Fixes gh-19241

Problem

OAuth2ClientJacksonModule was missing allowIfSubType entries for java.net.URL and java.time.Instant, causing a SerializationException when deserializing OAuth2 authentication tokens stored in Redis session. The error occurs because OidcIdToken claims contain iss as a URL and iat/exp as Instant, which the PolymorphicTypeValidator denied.

Fix

Added allowIfSubType(URL.class) and allowIfSubType(Instant.class) to configurePolymorphicTypeValidator in OAuth2ClientJacksonModule.

Tests

  • deserializeWhenClaimsContainUrlAndInstantThenDeserializes — verifies that OAuth2AuthenticationToken containing URL and Instant claim types can be serialized and deserialized successfully

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.

OAuth2ClientJacksonModule is missing allowIfSubType for URL and Instant

2 participants