Not possible to import realm with newest Java admin-client against Keycloak 24

closes #32035

Signed-off-by: mposolda <mposolda@gmail.com>
This commit is contained in:
mposolda 2024-08-09 19:13:22 +02:00 committed by Marek Posolda
parent 6a91b3be6c
commit e7d9a717c9

View file

@ -1,6 +1,20 @@
package org.keycloak.admin.client; package org.keycloak.admin.client;
import javax.ws.rs.core.MediaType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider; import org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider;
public class JacksonProvider extends ResteasyJackson2Provider { public class JacksonProvider extends ResteasyJackson2Provider {
@Override
public ObjectMapper locateMapper(Class<?> type, MediaType mediaType) {
ObjectMapper objectMapper = super.locateMapper(type, mediaType);
// Same like JSONSerialization class. Makes it possible to use admin-client against older versions of Keycloak server where the properties on representations might be different
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return objectMapper;
}
} }