Search in sources :

Example 1 with UserVerificationRequirement

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));
}
Also used : UserVerificationRequirement(com.webauthn4j.data.UserVerificationRequirement) WebAuthnRealmData(org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData) AbstractConsoleTest(org.keycloak.testsuite.console.AbstractConsoleTest) Test(org.junit.Test)

Aggregations

UserVerificationRequirement (com.webauthn4j.data.UserVerificationRequirement)1 Test (org.junit.Test)1 AbstractConsoleTest (org.keycloak.testsuite.console.AbstractConsoleTest)1 WebAuthnRealmData (org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData)1