Skip to content
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

Saml2AuthenticationExceptionMixin doesn't work in JDK 17 #13804

Closed
sjohnr opened this issue Sep 12, 2023 · 0 comments
Closed

Saml2AuthenticationExceptionMixin doesn't work in JDK 17 #13804

sjohnr opened this issue Sep 12, 2023 · 0 comments
Assignees
Labels
in: saml2 An issue in SAML2 modules type: bug A general bug
Milestone

Comments

@sjohnr
Copy link
Member

sjohnr commented Sep 12, 2023

Saml2AuthenticationExceptionMixin fails when serializing Saml2AuthenticationException on JDK 17, unless the VM option --add-opens java.base/java.lang=ALL-UNNAMED is present.

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid type definition for type `org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationException`: Failed to call `setAccess()` on Field 'detailMessage' (of class `java.lang.Throwable`) due to `java.lang.reflect.InaccessibleObjectException`, problem: Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not "opens java.lang" to unnamed module @5562c41e
 at [Source: (String)"{  "@class": "org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationException",  "detailMessage": "exceptionMessage",  "error": {    "@class": "org.springframework.security.saml2.core.Saml2Error",    "errorCode": "errorCode",    "description": "errorDescription"  }}"; line: 1, column: 1]
	at app//com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:62)
	at app//com.fasterxml.jackson.databind.DeserializationContext.reportBadTypeDefinition(DeserializationContext.java:1887)
	at app//com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder._handleBadAccess(BeanDeserializerBuilder.java:620)
	at app//com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder._fixAccess(BeanDeserializerBuilder.java:537)
	at app//com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder.build(BeanDeserializerBuilder.java:384)
	at app//com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildThrowableDeserializer(BeanDeserializerFactory.java:463)
	at app//com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:113)
	at app//com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:415)
	at app//com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:350)
	at app//com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
	at app//com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
	at app//com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
	at app//com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:648)
	at app//com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4861)
	at app//com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4731)
	at app//com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3677)
	at app//com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3645)
	at app//org.springframework.security.saml2.jackson2.Saml2AuthenticationExceptionMixinTests.shouldDeserialize(Saml2AuthenticationExceptionMixinTests.java:53)
        ...

This test began failing when updating the jacoco tool version to 0.8.9. Related gh-13798 and gh-11893. See this comment.

cc @ugrave

@sjohnr sjohnr added type: bug A general bug in: saml2 An issue in SAML2 modules labels Sep 12, 2023
@sjohnr sjohnr added this to the 5.8.7 milestone Sep 12, 2023
@sjohnr sjohnr self-assigned this Sep 12, 2023
@sjohnr sjohnr closed this as completed in 3feb809 Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: saml2 An issue in SAML2 modules type: bug A general bug
Projects
Archived in project
Development

No branches or pull requests

1 participant