You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I Have logged this ticket earlier regarding the issue with the spring JDBC session deserialization after spring upgrade #1805
They recommend it to use Jackson support to Spring JDBC HTTP session
I have create object mapper like :
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new CoreJackson2Module());
objectMapper.registerModules(SecurityJackson2Modules.getModules(loader));
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.addMixIn(DefaultOAuth2ClientContext.class, DefaultOAuth2ClientContextMixIn.class);
used this objectMapper for deserialization and serialization set it to JdbcIndexedSessionRepository conversion service.
DefaultOAuth2ClientContextMixIn create custom mixin :
public interface DefaultOAuth2ClientContextMixIn {
@JsonTypeInfo(defaultImpl = DefaultOAuth2AccessToken.class, use = JsonTypeInfo.Id.NONE)
OAuth2AccessToken getAccessToken();
@JsonTypeInfo(defaultImpl = DefaultAccessTokenRequest.class, use = JsonTypeInfo.Id.NONE)
AccessTokenRequest getAccessTokenRequest();
}
Getting error
com.fasterxml.jackson.databind.JsonMappingException: The class with com.sun.proxy.$Proxy344 and name of com.sun.proxy.$Proxy344 is not in the allowlist. If you believe this class is safe to deserialize, please provide an explicit mapping using Jackson annotations or by providing a Mixin. If the serialization is only done by a trusted source, you can also enable default typing. See spring-projects/spring-security#4370 for details (through reference chain: org.springframework.security.oauth2.client.DefaultOAuth2ClientContext["accessTokenRequest"])
Wrapped by: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [UPDATE SPRING_SESSION_ATTRIBUTES SET ATTRIBUTE_BYTES = ? WHERE SESSION_PRIMARY_ID = ? AND ATTRIBUTE_NAME = ?]; ERROR: null value in column "attribute_bytes" violates not-null constraint
Detail: Failing row contains (f12d0737-815c-4b4d-8c8b-780ed8a171aa, scopedTarget.oauth2ClientContext, null).; nested exception is org.postgresql.util.PSQLException: ERROR: null value in column "attribute_bytes" violates not-null constraint
any clue what's wrong here?
The text was updated successfully, but these errors were encountered:
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Uh oh!
There was an error while loading. Please reload this page.
I Have logged this ticket earlier regarding the issue with the spring JDBC session deserialization after spring upgrade
#1805
They recommend it to use Jackson support to Spring JDBC HTTP session
I have create object mapper like :
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new CoreJackson2Module());
objectMapper.registerModules(SecurityJackson2Modules.getModules(loader));
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.addMixIn(DefaultOAuth2ClientContext.class, DefaultOAuth2ClientContextMixIn.class);
used this objectMapper for deserialization and serialization set it to JdbcIndexedSessionRepository conversion service.
DefaultOAuth2ClientContextMixIn create custom mixin :
public interface DefaultOAuth2ClientContextMixIn {
}
Getting error
com.fasterxml.jackson.databind.JsonMappingException: The class with com.sun.proxy.$Proxy344 and name of com.sun.proxy.$Proxy344 is not in the allowlist. If you believe this class is safe to deserialize, please provide an explicit mapping using Jackson annotations or by providing a Mixin. If the serialization is only done by a trusted source, you can also enable default typing. See spring-projects/spring-security#4370 for details (through reference chain: org.springframework.security.oauth2.client.DefaultOAuth2ClientContext["accessTokenRequest"])
Wrapped by: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [UPDATE SPRING_SESSION_ATTRIBUTES SET ATTRIBUTE_BYTES = ? WHERE SESSION_PRIMARY_ID = ? AND ATTRIBUTE_NAME = ?]; ERROR: null value in column "attribute_bytes" violates not-null constraint
Detail: Failing row contains (f12d0737-815c-4b4d-8c8b-780ed8a171aa, scopedTarget.oauth2ClientContext, null).; nested exception is org.postgresql.util.PSQLException: ERROR: null value in column "attribute_bytes" violates not-null constraint
any clue what's wrong here?
The text was updated successfully, but these errors were encountered: