1
0
mirror of synced 2026-05-22 21:33:16 +00:00

JacksonDelegate uses SecurityJacksonModules

This commit is contained in:
Rob Winch
2025-10-17 11:10:38 -05:00
parent 50568da1e5
commit 803936cfbe
@@ -36,6 +36,7 @@ import java.util.function.Function;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.databind.JacksonModule;
import tools.jackson.databind.json.JsonMapper;
import org.springframework.aot.hint.RuntimeHints;
@@ -54,6 +55,7 @@ import org.springframework.jdbc.support.lob.DefaultLobHandler;
import org.springframework.jdbc.support.lob.LobCreator;
import org.springframework.jdbc.support.lob.LobHandler;
import org.springframework.lang.Nullable;
import org.springframework.security.jackson.SecurityJacksonModules;
import org.springframework.security.jackson2.SecurityJackson2Modules;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.oauth2.core.OAuth2AccessToken;
@@ -897,11 +899,14 @@ public class JdbcOAuth2AuthorizationService implements OAuth2AuthorizationServic
private final JsonMapper jsonMapper;
public JacksonDelegate() {
this.jsonMapper = JsonMapper.builder().addModules(new OAuth2AuthorizationServerJacksonModule()).build();
this(JsonMapper.builder());
}
public JacksonDelegate(JsonMapper.Builder builder) {
this.jsonMapper = builder.addModules(new OAuth2AuthorizationServerJacksonModule()).build();
List<JacksonModule> modules = SecurityJacksonModules.getModules(getClass().getClassLoader());
this.jsonMapper = builder.addModules(modules)
.addModules(new OAuth2AuthorizationServerJacksonModule())
.build();
}
@Override