Search in sources :

Example 1 with JsonConverter

use of com.webauthn4j.converter.util.JsonConverter in project webauthn4j by webauthn4j.

the class AuthenticationExtensionsClientInputsDeserializerTest method deserialize_test_with_authentication_extension_JSON_data.

@Test
void deserialize_test_with_authentication_extension_JSON_data() {
    ObjectConverter objectConverter = new ObjectConverter();
    JsonConverter jsonConverter = objectConverter.getJsonConverter();
    AuthenticationExtensionsClientInputs<AuthenticationExtensionClientInput> extensionInputs = jsonConverter.readValue("{ " + "\"appid\": \"dummy\" " + "}", new TypeReference<AuthenticationExtensionsClientInputs<AuthenticationExtensionClientInput>>() {
    });
    assertAll(() -> assertThat(extensionInputs.getExtension(FIDOAppIDExtensionClientInput.class).getValue()).isEqualTo("dummy"));
}
Also used : ObjectConverter(com.webauthn4j.converter.util.ObjectConverter) JsonConverter(com.webauthn4j.converter.util.JsonConverter) Test(org.junit.jupiter.api.Test)

Example 2 with JsonConverter

use of com.webauthn4j.converter.util.JsonConverter in project webauthn4j by webauthn4j.

the class AuthenticationExtensionsClientInputsDeserializerTest method deserialize_test_with_registration_extension_JSON_data.

@Test
void deserialize_test_with_registration_extension_JSON_data() {
    ObjectConverter objectConverter = new ObjectConverter();
    JsonConverter jsonConverter = objectConverter.getJsonConverter();
    AuthenticationExtensionsClientInputs<RegistrationExtensionClientInput> extensionInputs = jsonConverter.readValue("{ " + "\"credProps\": true " + "}", new TypeReference<AuthenticationExtensionsClientInputs<RegistrationExtensionClientInput>>() {
    });
    assertAll(() -> assertThat(extensionInputs.getExtension(CredentialPropertiesExtensionClientInput.class).getValue()).isTrue());
}
Also used : ObjectConverter(com.webauthn4j.converter.util.ObjectConverter) JsonConverter(com.webauthn4j.converter.util.JsonConverter) Test(org.junit.jupiter.api.Test)

Aggregations

JsonConverter (com.webauthn4j.converter.util.JsonConverter)2 ObjectConverter (com.webauthn4j.converter.util.ObjectConverter)2 Test (org.junit.jupiter.api.Test)2