-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug
Milestone
Description
Describe the bug
If an IdP sends an ID token with claim amr
, the Jackson ObjectMapper
with SecurityJackson2Modules
cannot serialize the ID token to JSON (related: #4370).
The amr
claim in the ID token has the type com.nimbusds.jose.shaded.json.JSONArray
for which there is no default mixin.
Tested with Spring-Security 5.4.1.
To Reproduce
These steps resemble a normal oauth2Login
configuration where additionally the ID token is serialized to JSON.
- Include an
amr
claim in the ID token - Decode the string token value using an
JwtDecoder
created byOidcIdTokenDecoderFactory
to aJwt
. - Create an
OidcIdToken
from theJwt
. - Serialize the
OidcIdToken
to a JSON string using anObjectMapper
with theSecurityJackson2Modules
.
Expected behavior
The amr
claim should be an ArrayList
instead of JSONArray
.
Workaround
Define a mixin for the JSONArray
class.
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug