use of com.webauthn4j.data.UserVerificationRequirement in project keycloak by keycloak.
the class WebAuthnPolicySettingsTest method userVerification.
@Test
public void userVerification() {
UserVerificationRequirement userVerification = getPolicyPage().getUserVerification();
assertThat(userVerification, nullValue());
// Preferred
getPolicyPage().setUserVerification(UserVerificationRequirement.PREFERRED);
getPolicyPage().clickSaveButton();
userVerification = getPolicyPage().getUserVerification();
assertThat(userVerification, notNullValue());
assertThat(userVerification, is(UserVerificationRequirement.PREFERRED));
// Required
getPolicyPage().setUserVerification(UserVerificationRequirement.REQUIRED);
getPolicyPage().clickSaveButton();
userVerification = getPolicyPage().getUserVerification();
assertThat(userVerification, notNullValue());
assertThat(userVerification, is(UserVerificationRequirement.REQUIRED));
// Discouraged
getPolicyPage().setUserVerification(UserVerificationRequirement.DISCOURAGED);
getPolicyPage().clickSaveButton();
userVerification = getPolicyPage().getUserVerification();
assertThat(userVerification, notNullValue());
assertThat(userVerification, is(UserVerificationRequirement.DISCOURAGED));
assertDataAfterModification(UserVerificationRequirement.DISCOURAGED.getValue(), DEFAULT_WEBAUTHN_POLICY_NOT_SPECIFIED, WebAuthnRealmData::getUserVerificationRequirement, (builder) -> builder.userVerificationRequirement(null));
}
Aggregations