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