diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/security/AuthenticateResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/security/AuthenticateResponse.java index b3b8fc2c235..9bf770d89db 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/security/AuthenticateResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/security/AuthenticateResponse.java @@ -53,11 +53,11 @@ public final class AuthenticateResponse { @SuppressWarnings("unchecked") private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( - "client_security_authenticate_response", + "client_security_authenticate_response", true, a -> new AuthenticateResponse(new User((String) a[0], ((List) a[1]), (Map) a[2], (String) a[3], (String) a[4]), (Boolean) a[5], (RealmInfo) a[6], (RealmInfo) a[7])); static { - final ConstructingObjectParser realmInfoParser = new ConstructingObjectParser<>("realm_info", + final ConstructingObjectParser realmInfoParser = new ConstructingObjectParser<>("realm_info", true, a -> new RealmInfo((String) a[0], (String) a[1])); realmInfoParser.declareString(constructorArg(), REALM_NAME); realmInfoParser.declareString(constructorArg(), REALM_TYPE); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/security/AuthenticateResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/security/AuthenticateResponseTests.java index f59038af55a..e348cb4d46c 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/security/AuthenticateResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/security/AuthenticateResponseTests.java @@ -42,7 +42,9 @@ public class AuthenticateResponseTests extends ESTestCase { this::createTestInstance, this::toXContent, AuthenticateResponse::fromXContent) - .supportsUnknownFields(false) + .supportsUnknownFields(true) + //metadata is a series of kv pairs, so we dont want to add random fields here for test equality + .randomFieldsExcludeFilter(f -> f.startsWith("metadata")) .test(); }