From f427714c1821ae5092a46548eb612c18371188b8 Mon Sep 17 00:00:00 2001 From: Martin Reinhardt Date: Thu, 9 Apr 2020 18:40:29 +0200 Subject: [PATCH] fix(JSON): Resolve mapping issues, see #43 --- .../keycloak/plugin/internal/http/HttpMethodResponse.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/github/flytreeleft/nexus3/keycloak/plugin/internal/http/HttpMethodResponse.java b/src/main/java/org/github/flytreeleft/nexus3/keycloak/plugin/internal/http/HttpMethodResponse.java index 6c12bd1..75dc533 100644 --- a/src/main/java/org/github/flytreeleft/nexus3/keycloak/plugin/internal/http/HttpMethodResponse.java +++ b/src/main/java/org/github/flytreeleft/nexus3/keycloak/plugin/internal/http/HttpMethodResponse.java @@ -1,6 +1,9 @@ package org.github.flytreeleft.nexus3.keycloak.plugin.internal.http; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.introspect.VisibilityChecker; import org.keycloak.util.JsonSerialization; import java.io.IOException; @@ -33,6 +36,8 @@ public HttpMethodResponse json(final TypeReference responseType) { public R execute() { return method.execute((InputStream inputStream) -> { try { + JsonSerialization.mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + JsonSerialization.mapper.setVisibility(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY)); return JsonSerialization.readValue(inputStream, responseType); } catch (IOException e) { throw new RuntimeException("Error parsing JSON response.", e);