Keycloak-admin-client should work with the future versions of Keycloak server (#34285)

closes #34284

Signed-off-by: mposolda <mposolda@gmail.com>
This commit is contained in:
Marek Posolda 2024-10-24 12:43:04 +02:00 committed by GitHub
parent 5bac1b2567
commit 2e4a3f6f5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
package org.keycloak.admin.client;
import com.fasterxml.jackson.databind.DeserializationFeature;
import jakarta.ws.rs.core.MediaType;
import com.fasterxml.jackson.annotation.JsonInclude;
@ -14,7 +15,10 @@ public class JacksonProvider extends ResteasyJackson2Provider {
// 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);
// The client must work with the newer versions of Keycloak server, which might contain the JSON fields not yet known by the client. So unknown fields will be ignored.
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
}