spring-projects / spring-projects/spring-security
OAuth2UserService supports signed and/or encrypted UserInfo Response
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Expected Behavior
The implementations of OAuth2UserService support the application/jwt content type when fetching the UserInfo resource.
Related Spec Info:
If the UserInfo Response is signed and/or encrypted, then the Claims are returned in a JWT and the content-type MUST be application/jwt.
OpenID Connect Core 1.0 - 5.3.2. Successful UserInfo Response
Current Behavior
The implementations of OAuth2UserService are DefaultOAuth2UserService and OidcUserService. These implementations only support the application/json content type when fetching the UserInfo resource. Resulting in 406 Not Acceptable when the given identity provider only allows application/jwt or this error when provided with a custom restOperations which allows application/jwt:
Context
The identity provider we have to use is build with "high security in mind" and forces the use of signed JWT.
More in depth information and a workaround I found while developing: https://stackoverflow.com/questions/59876435/spring-fails-for-userinfo-endpoint-returning-signed-jwt
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 DefaultOAuth2UserService.java at the linked UserInfo request code, then compare OidcUserService and how both implementations process UserInfo responses. Trace the handling of application/json and application/jwt, and use the OpenID Connect UserInfo specification to define the expected behavior. Done means both services support the specified signed or encrypted UserInfo response without the reported 406 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100