spring-projects / spring-projects/spring-session
Logging in via oauth2 using redis session throws jackson error
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Describe the bug
When I attempt to login via oauth 2 using redis sessions I get this jackson error
org.springframework.data.redis.serializer.SerializationException: Could not read JSON:Could not resolve type id 'java.net.URL' as a subtype of `java.lang.Object`: Configured `PolymorphicTypeValidator` (of type `tools.jackson.databind.jsontype.BasicPolymorphicTypeValidator`) denied resolution
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); byte offset: #1988] (through reference chain: org.springframework.security.core.context.SecurityContextImpl["authentication"]->org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken["principal"]->org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser["authorities"]->java.util.HashSet[0]->org.springframework.security.oauth2.core.oidc.user.OidcUserAuthority["idToken"]->org.springframework.security.oauth2.core.oidc.OidcIdToken["claims"]->java.util.LinkedHashMap["iss"])
the error location of the json in redis appears to be here
"iss": [
"java.net.URL",
"https://accounts.google.com"
],
I am using the documentation code for 4.0.1-SNAPSHOT
Sample
Here is a link to the sample. To set it up add your oauth2 details to application.yml, start up spring boot and attempt to login
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Spring Session Redis JSON serialization documentation for 4.0.1-SNAPSHOT and the sample project's application.yml. Reproduce the OAuth2 login with Redis sessions, then inspect how the OIDC issuer claim is serialized and read. Done means the login completes without the Jackson error and the session remains readable from Redis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis, spring
- Domain
- authentication, backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100