Update authenticate to allow unknown fields (#37713)
AuthenticateResponse did not allow unknown fields. This commit fixes the test and ConstructingObjectParser such that it does now allow unknown fields. Relates #36938
This commit is contained in:
parent
944972a249
commit
04c64147bd
|
@ -53,11 +53,11 @@ public final class AuthenticateResponse {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final ConstructingObjectParser<AuthenticateResponse, Void> PARSER = new ConstructingObjectParser<>(
|
||||
"client_security_authenticate_response",
|
||||
"client_security_authenticate_response", true,
|
||||
a -> new AuthenticateResponse(new User((String) a[0], ((List<String>) a[1]), (Map<String, Object>) a[2],
|
||||
(String) a[3], (String) a[4]), (Boolean) a[5], (RealmInfo) a[6], (RealmInfo) a[7]));
|
||||
static {
|
||||
final ConstructingObjectParser<RealmInfo, Void> realmInfoParser = new ConstructingObjectParser<>("realm_info",
|
||||
final ConstructingObjectParser<RealmInfo, Void> 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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue