Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ class AuthenticatorTransportDeserializer extends StdDeserializer<AuthenticatorTr
public @Nullable AuthenticatorTransport deserialize(JsonParser parser, DeserializationContext ctxt)
throws JacksonException {
String transportValue = parser.readValueAs(String.class);
for (AuthenticatorTransport transport : AuthenticatorTransport.values()) {
if (transport.getValue().equals(transportValue)) {
return transport;
}
if (transportValue == null) {
return null;
}
return null;
return AuthenticatorTransport.valueOf(transportValue);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ class AuthenticatorTransportJackson2Deserializer extends StdDeserializer<Authent
public @Nullable AuthenticatorTransport deserialize(JsonParser parser, DeserializationContext ctxt)
throws IOException, JacksonException {
String transportValue = parser.readValueAs(String.class);
for (AuthenticatorTransport transport : AuthenticatorTransport.values()) {
if (transport.getValue().equals(transportValue)) {
return transport;
}
if (transportValue == null) {
return null;
}
return null;
return AuthenticatorTransport.valueOf(transportValue);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ void readAuthenticatorTransport() throws Exception {
assertThat(transport).isEqualTo(AuthenticatorTransport.HYBRID);
}

@Test
void readAuthenticatorTransportWhenUnknownThenPreservesValue() throws Exception {
AuthenticatorTransport transport = this.mapper.readValue("\"cable\"", AuthenticatorTransport.class);

assertThat(transport).isNotNull();
assertThat(transport.getValue()).isEqualTo("cable");
}

@Test
void readAuthenticatorAttachment() throws Exception {
AuthenticatorAttachment value = this.mapper.readValue("\"cross-platform\"", AuthenticatorAttachment.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ void readAuthenticatorTransport() throws Exception {
assertThat(transport).isEqualTo(AuthenticatorTransport.HYBRID);
}

@Test
void readAuthenticatorTransportWhenUnknownThenPreservesValue() throws Exception {
AuthenticatorTransport transport = this.mapper.readValue("\"cable\"", AuthenticatorTransport.class);

assertThat(transport).isNotNull();
assertThat(transport.getValue()).isEqualTo("cable");
}

@Test
void readAuthenticatorAttachment() throws Exception {
AuthenticatorAttachment value = this.mapper.readValue("\"cross-platform\"", AuthenticatorAttachment.class);
Expand Down