Search in sources :

Example 1 with PropertyRequirement

use of org.keycloak.testsuite.webauthn.utils.PropertyRequirement in project keycloak by keycloak.

the class WebAuthnPolicySettingsTest method residentKey.

@Test
public void residentKey() {
    PropertyRequirement requireResidentKey = getPolicyPage().requireResidentKey();
    assertThat(requireResidentKey, notNullValue());
    assertThat(requireResidentKey, is(PropertyRequirement.NOT_SPECIFIED));
    getPolicyPage().requireResidentKey(YES);
    getPolicyPage().clickSaveButton();
    // Yes
    requireResidentKey = getPolicyPage().requireResidentKey();
    assertThat(requireResidentKey, notNullValue());
    assertThat(requireResidentKey, is(YES));
    getPolicyPage().requireResidentKey(NO);
    getPolicyPage().clickSaveButton();
    // Null
    getPolicyPage().requireResidentKey(null);
    assertThat(getPolicyPage().isSaveButtonEnabled(), is(false));
    // Not specified
    getPolicyPage().requireResidentKey(PropertyRequirement.NOT_SPECIFIED);
    assertThat(getPolicyPage().isSaveButtonEnabled(), is(true));
    getPolicyPage().clickSaveButton();
    // No
    getPolicyPage().requireResidentKey(NO);
    getPolicyPage().clickSaveButton();
    requireResidentKey = getPolicyPage().requireResidentKey();
    assertThat(requireResidentKey, notNullValue());
    assertThat(requireResidentKey, is(NO));
    assertDataAfterModification(NO.getValue(), DEFAULT_WEBAUTHN_POLICY_NOT_SPECIFIED, WebAuthnRealmData::getRequireResidentKey, (builder) -> builder.requireResidentKey(null));
}
Also used : PropertyRequirement(org.keycloak.testsuite.webauthn.utils.PropertyRequirement) WebAuthnRealmData(org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData) AbstractConsoleTest(org.keycloak.testsuite.console.AbstractConsoleTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AbstractConsoleTest (org.keycloak.testsuite.console.AbstractConsoleTest)1 PropertyRequirement (org.keycloak.testsuite.webauthn.utils.PropertyRequirement)1 WebAuthnRealmData (org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData)1