Search in sources :

Example 1 with AttestationConveyancePreference

use of com.webauthn4j.data.AttestationConveyancePreference in project keycloak by keycloak.

the class WebAuthnPolicySettingsTest method attestationConveyancePreference.

@Test
public void attestationConveyancePreference() {
    // default not specified
    AttestationConveyancePreference attestation = getPolicyPage().getAttestationConveyancePreference();
    assertThat(attestation, nullValue());
    // Direct
    getPolicyPage().setAttestationConveyancePreference(AttestationConveyancePreference.DIRECT);
    getPolicyPage().clickSaveButton();
    attestation = getPolicyPage().getAttestationConveyancePreference();
    assertThat(attestation, notNullValue());
    assertThat(attestation, is(AttestationConveyancePreference.DIRECT));
    // Indirect
    getPolicyPage().setAttestationConveyancePreference(AttestationConveyancePreference.INDIRECT);
    getPolicyPage().clickSaveButton();
    attestation = getPolicyPage().getAttestationConveyancePreference();
    assertThat(attestation, notNullValue());
    assertThat(attestation, is(AttestationConveyancePreference.INDIRECT));
    // None
    getPolicyPage().setAttestationConveyancePreference(AttestationConveyancePreference.NONE);
    getPolicyPage().clickSaveButton();
    attestation = getPolicyPage().getAttestationConveyancePreference();
    assertThat(attestation, notNullValue());
    assertThat(attestation, is(AttestationConveyancePreference.NONE));
    try {
        getPolicyPage().setAttestationConveyancePreference(AttestationConveyancePreference.ENTERPRISE);
        Assert.fail("We don't support 'Enterprise' mode at this moment");
    } catch (NoSuchElementException e) {
    // Expected - NOP
    }
    assertDataAfterModification(AttestationConveyancePreference.NONE.getValue(), DEFAULT_WEBAUTHN_POLICY_NOT_SPECIFIED, WebAuthnRealmData::getAttestationConveyancePreference, (builder) -> builder.attestationConveyancePreference(null));
}
Also used : AttestationConveyancePreference(com.webauthn4j.data.AttestationConveyancePreference) NoSuchElementException(org.openqa.selenium.NoSuchElementException) WebAuthnRealmData(org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData) AbstractConsoleTest(org.keycloak.testsuite.console.AbstractConsoleTest) Test(org.junit.Test)

Aggregations

AttestationConveyancePreference (com.webauthn4j.data.AttestationConveyancePreference)1 Test (org.junit.Test)1 AbstractConsoleTest (org.keycloak.testsuite.console.AbstractConsoleTest)1 WebAuthnRealmData (org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1