use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class SigningInPageUtils method testSetUpLink.
public static void testSetUpLink(RealmResource realmResource, SigningInPage.CredentialType credentialType, String requiredActionProviderId) {
assertThat("Set up link for \"" + credentialType.getType() + "\" is not visible", credentialType.isSetUpLinkVisible(), is(true));
RequiredActionProviderRepresentation requiredAction = new RequiredActionProviderRepresentation();
requiredAction.setEnabled(false);
realmResource.flows().updateRequiredAction(requiredActionProviderId, requiredAction);
refreshPageAndWaitForLoad();
assertThat("Set up link for \"" + credentialType.getType() + "\" is visible", credentialType.isSetUpLinkVisible(), is(false));
assertThat("Title for \"" + credentialType.getType() + "\" is visible", credentialType.isTitleVisible(), is(false));
assertThat("Set up link for \"" + credentialType.getType() + "\" is visible", credentialType.isNotSetUpLabelVisible(), is(false));
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class DeleteAccountTest method enableDeleteAccountRequiredAction.
private void enableDeleteAccountRequiredAction() {
RequiredActionProviderRepresentation deleteAccount = testRealmResource().flows().getRequiredAction("delete_account");
deleteAccount.setEnabled(true);
testRealmResource().flows().updateRequiredAction("delete_account", deleteAccount);
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class DeleteAccountTest method disableDeleteAccountRequiredAction.
private void disableDeleteAccountRequiredAction() {
RequiredActionProviderRepresentation deleteAccount = testRealmResource().flows().getRequiredAction("delete_account");
deleteAccount.setEnabled(false);
testRealmResource().flows().updateRequiredAction("delete_account", deleteAccount);
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class RequiredActionsTest method termsAndConditions.
@Test
public void termsAndConditions() {
RequiredActionProviderRepresentation termsAndCondRep = testRealmResource().flows().getRequiredAction(termsAndConditionsPage.getActionId());
termsAndCondRep.setEnabled(true);
testRealmResource().flows().updateRequiredAction(termsAndConditionsPage.getActionId(), termsAndCondRep);
initiateRequiredAction(termsAndConditionsPage);
termsAndConditionsPage.localeDropdown().selectAndAssert(CUSTOM_LOCALE_NAME);
termsAndConditionsPage.acceptTerms();
assertLoginSuccessful();
deleteAllSessionsInTestRealm();
initiateRequiredAction(termsAndConditionsPage);
assertEquals("[TEST LOCALE] souhlas s podmÃnkami", termsAndConditionsPage.getText());
termsAndConditionsPage.declineTerms();
loginErrorPage.assertCurrent();
assertNoAccess();
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class WebAuthnSigningInTest method testWebAuthn.
private void testWebAuthn(boolean passwordless) {
testContext.setTestRealmReps(emptyList());
SigningInPage.CredentialType credentialType;
final String expectedHelpText;
final String providerId;
if (passwordless) {
credentialType = webAuthnPwdlessCredentialType;
expectedHelpText = "Use your security key for passwordless sign in.";
providerId = WebAuthnPasswordlessRegisterFactory.PROVIDER_ID;
} else {
credentialType = webAuthnCredentialType;
expectedHelpText = "Use your security key to sign in.";
providerId = WebAuthnRegisterFactory.PROVIDER_ID;
}
assertThat(credentialType.isSetUp(), is(false));
// no way to simulate registration cancellation
assertThat("Set up link for \"" + credentialType.getType() + "\" is not visible", credentialType.isSetUpLinkVisible(), is(true));
assertThat(credentialType.getTitle(), is("Security Key"));
assertThat(credentialType.getHelpText(), is(expectedHelpText));
final String label1 = "WebAuthn is convenient";
final String label2 = "but not yet widely adopted";
SigningInPage.UserCredential webAuthn1 = addWebAuthnCredential(label1, passwordless);
assertThat(credentialType.isSetUp(), is(true));
assertThat(credentialType.getUserCredentialsCount(), is(1));
assertUserCredential(label1, true, webAuthn1);
SigningInPage.UserCredential webAuthn2 = addWebAuthnCredential(label2, passwordless);
assertThat(credentialType.getUserCredentialsCount(), is(2));
assertUserCredential(label2, true, webAuthn2);
RequiredActionProviderRepresentation requiredAction = new RequiredActionProviderRepresentation();
requiredAction.setEnabled(false);
testRealmResource().flows().updateRequiredAction(providerId, requiredAction);
refreshPageAndWaitForLoad();
assertThat("Set up link for \"" + credentialType.getType() + "\" is visible", credentialType.isSetUpLinkVisible(), is(false));
assertThat("Not set up link for \"" + credentialType.getType() + "\" is visible", credentialType.isNotSetUpLabelVisible(), is(false));
assertThat("Title for \"" + credentialType.getType() + "\" is not visible", credentialType.isTitleVisible(), is(true));
assertThat(credentialType.getUserCredentialsCount(), is(2));
testRemoveCredential(webAuthn1);
}
Aggregations