-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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)type: bugA general bugA general bug
Milestone
Description
The OAuth2AuthorizationServerJacksonModule creates its own polymorphic type validator overriding the type validator created in SecurityJacksonModules.
Affects jackson3 support in 7.0.0-RC1
The following code should be removed from OAuth2AuthorizationServerJacksonModule.
BasicPolymorphicTypeValidator.Builder builder = BasicPolymorphicTypeValidator.builder();
this.configurePolymorphicTypeValidator(builder);
((MapperBuilder<?, ?>) context.getOwner()).activateDefaultTyping(builder.build(), DefaultTyping.NON_FINAL,
JsonTypeInfo.As.PROPERTY);
After removing the type validator I had to create the module and a type validator so the same type validator is used throughout the Jackson configuration.
@Bean
JsonMapperBuilderCustomizer jsonMapperBuilderCustomizer() {
return new JsonMapperBuilderCustomizer() {
@Override
public void customize(@NonNull Builder jsonMapperBuilder) {
BasicPolymorphicTypeValidator.Builder builder = BasicPolymorphicTypeValidator.builder();
var oAuth2AuthorizationServerJacksonModule = new OAuth2AuthorizationServerJacksonModule();
oAuth2AuthorizationServerJacksonModule.configurePolymorphicTypeValidator(builder);
jsonMapperBuilder.addModules(SecurityJacksonModules.getModules(getClass().getClassLoader(), builder))
.addModules(oAuth2AuthorizationServerJacksonModule);
}
};
}
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)type: bugA general bugA general bug