Merge branch 'gh-18643-6.5.x' into gh-18643-7.0.x

This commit is contained in:
Ziqin Wang 2026-03-15 15:25:04 +08:00
commit a013bfaaec
No known key found for this signature in database
GPG Key ID: B4A9D243A3DD5D9B
2 changed files with 46 additions and 6 deletions

View File

@ -62,11 +62,8 @@ class AuthenticationExtensionsClientOutputsJackson2Deserializer
throws IOException, JacksonException {
List<AuthenticationExtensionsClientOutput<?>> outputs = new ArrayList<>();
for (String key = parser.nextFieldName(); key != null; key = parser.nextFieldName()) {
JsonToken startObject = parser.nextValue();
if (startObject != JsonToken.START_OBJECT) {
break;
}
if (CredentialPropertiesOutput.EXTENSION_ID.equals(key)) {
JsonToken next = parser.nextToken();
if (next == JsonToken.START_OBJECT && CredentialPropertiesOutput.EXTENSION_ID.equals(key)) {
CredentialPropertiesOutput output = parser.readValueAs(CredentialPropertiesOutput.class);
outputs.add(output);
}
@ -74,7 +71,9 @@ class AuthenticationExtensionsClientOutputsJackson2Deserializer
if (logger.isDebugEnabled()) {
logger.debug("Skipping unknown extension with id " + key);
}
parser.nextValue();
if (next.isStructStart()) {
parser.skipChildren();
}
}
}

View File

@ -122,6 +122,47 @@ class Jackson2Tests {
assertThat(outputs).usingRecursiveComparison().isEqualTo(credProps);
}
@Test
void readAuthenticationExtensionsClientOutputsWhenAppId() throws Exception {
String json = """
{
"appid": false,
"credProps": {
"rk": false
}
}
""";
CredentialPropertiesOutput credProps = new CredentialPropertiesOutput(false);
AuthenticationExtensionsClientOutputs outputs = this.mapper.readValue(json,
AuthenticationExtensionsClientOutputs.class);
assertThat(outputs.getOutputs()).usingRecursiveFieldByFieldElementComparator().contains(credProps);
}
@Test
void readAuthenticationExtensionsClientOutputsWhenUnknownExtension() throws Exception {
String json = """
{
"unknownObject1": {
"key": "value"
},
"unknownArray": [
{ "key": "value1" },
{ "key": "value2" }
],
"credProps": {
"rk": false
},
"unknownObject2": {}
}
""";
CredentialPropertiesOutput credProps = new CredentialPropertiesOutput(false);
AuthenticationExtensionsClientOutputs outputs = this.mapper.readValue(json,
AuthenticationExtensionsClientOutputs.class);
assertThat(outputs.getOutputs()).usingRecursiveFieldByFieldElementComparator().contains(credProps);
}
@Test
void readAuthenticationExtensionsClientOutputsWhenFieldAfter() throws Exception {
String json = """