Skip to content

Jackson serialization of DefaultSaml2AuthenticatedPrincipal: LinkedMultiValueMap is not in the allowlist #11785

@felixscheinost

Description

@felixscheinost

Describe the bug

Jackson serialization of DefaultSaml2AuthenticatedPrincipal doesn't work anymore since Spring Boot 2.7.3.

An exception is thrown:

Caused by: com.fasterxml.jackson.databind.JsonMappingException: The class with org.springframework.util.LinkedMultiValueMap and name of org.springframework.util.LinkedMultiValueMap is not in the allowlist.

To Reproduce

Setup a Jackson object mapper like that

    val springSecurityObjectMapper: JsonMapper = jacksonMapperBuilder()
        .addModules(SecurityJackson2Modules.getModules(Companion::class.java.classLoader))

Then try to use the mapper to serialize an Authentication containing a DefaultSaml2AuthenticatedPrincipal constructed by OpenSaml4AuthenticationProvider.

Expected behavior

Serialization works.

Probable cause

I think this is the offending commit e092ec7

Metadata

Metadata

Assignees

Labels

in: saml2An issue in SAML2 modulestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions