-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jackson serialization of DefaultSaml2AuthenticatedPrincipal
: LinkedMultiValueMap is not in the allowlist
#11785
Comments
I get the same problem after updating from spring security 5.7.2 to 5.7.3. Note sure which could be the best fix. My current workaround is to copy the principal and overide the attirbute map in a custom ResponseAuthenticationConverter: Saml2Authentication authentication = ...
DefaultSaml2AuthenticatedPrincipal principal = (DefaultSaml2AuthenticatedPrincipal) authentication.getPrincipal();
DefaultSaml2AuthenticatedPrincipal copy = new DefaultSaml2AuthenticatedPrincipal(
principal.getName(),
new LinkedHashMap<>(principal.getAttributes()),
principal.getSessionIndexes()
);
authentication = new Saml2Authentication(
copy, authentication.getSaml2Response(), authentication.getAuthorities()
); |
I ran into same issue post upgrading spring boot from 2.7.0 to 3.0.0. For now, I added a mix-in for
Instead of extending SimpleModule, Saml2Jackson2Module can also be extended. Mixin class -
Custom Deserializer -
I then registered this and everything seems to work fine now. I am still running tests on |
Describe the bug
Jackson serialization of
DefaultSaml2AuthenticatedPrincipal
doesn't work anymore since Spring Boot 2.7.3.An exception is thrown:
To Reproduce
Setup a Jackson object mapper like that
Then try to use the mapper to serialize an
Authentication
containing aDefaultSaml2AuthenticatedPrincipal
constructed byOpenSaml4AuthenticationProvider
.Expected behavior
Serialization works.
Probable cause
I think this is the offending commit e092ec7
The text was updated successfully, but these errors were encountered: