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));
}
Aggregations