use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class AbstractMigrationTest method testNameOfOTPRequiredAction.
protected void testNameOfOTPRequiredAction(RealmResource... realms) {
log.info("testing OTP Required Action");
for (RealmResource realm : realms) {
RequiredActionProviderRepresentation otpAction = realm.flows().getRequiredAction(UserModel.RequiredAction.CONFIGURE_TOTP.name());
assertEquals("The name of CONFIGURE_TOTP required action should be 'Configure OTP'.", "Configure OTP", otpAction.getName());
}
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class SigningInTest method otpTest.
@Test
public void otpTest() {
testContext.setTestRealmReps(emptyList());
assertThat(otpCredentialType.isSetUp(), is(false));
otpCredentialType.clickSetUpLink();
otpSetupPage.cancel();
signingInPage.assertCurrent();
assertThat(otpCredentialType.isSetUp(), is(false));
assertThat(otpCredentialType.getTitle(), is("Authenticator Application"));
final String label1 = "OTP is secure";
final String label2 = "OTP is inconvenient";
SigningInPage.UserCredential otp1 = addOtpCredential(label1);
assertThat(otpCredentialType.isSetUp(), is(true));
assertThat(otpCredentialType.getUserCredentialsCount(), is(1));
assertUserCredential(label1, true, otp1);
SigningInPage.UserCredential otp2 = addOtpCredential(label2);
assertThat(otpCredentialType.getUserCredentialsCount(), is(2));
assertUserCredential(label2, true, otp2);
assertThat("Set up link is not visible", otpCredentialType.isSetUpLinkVisible(), is(true));
RequiredActionProviderRepresentation requiredAction = new RequiredActionProviderRepresentation();
requiredAction.setEnabled(false);
testRealmResource().flows().updateRequiredAction(CONFIGURE_TOTP.name(), requiredAction);
refreshPageAndWaitForLoad();
assertThat("Set up link for \"otp\" is visible", otpCredentialType.isSetUpLinkVisible(), is(false));
assertThat("Not set up link for \"otp\" is visible", otpCredentialType.isNotSetUpLabelVisible(), is(false));
assertThat("Title for \"otp\" is not visible", otpCredentialType.isTitleVisible(), is(true));
assertThat(otpCredentialType.getUserCredentialsCount(), is(2));
testRemoveCredential(otp1);
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class TermsAndConditionsTest method termsDisabled.
@Test
public // KEYCLOAK-3192
void termsDisabled() {
RequiredActionProviderRepresentation rep = adminClient.realm("test").flows().getRequiredAction("terms_and_conditions");
rep.setEnabled(false);
adminClient.realm("test").flows().updateRequiredAction("terms_and_conditions", rep);
loginPage.open();
loginPage.login("test-user@localhost", "password");
assertTrue(appPage.isCurrent());
events.expectLogin().assertEvent();
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class RequiredActionTotpSetupTest method configureTestRealm.
@Override
public void configureTestRealm(RealmRepresentation testRealm) {
RequiredActionProviderRepresentation requiredAction = new RequiredActionProviderRepresentation();
requiredAction.setAlias(UserModel.RequiredAction.CONFIGURE_TOTP.name());
requiredAction.setProviderId(UserModel.RequiredAction.CONFIGURE_TOTP.name());
requiredAction.setName("Configure Totp");
requiredAction.setEnabled(true);
requiredAction.setDefaultAction(true);
List<RequiredActionProviderRepresentation> requiredActions = new LinkedList<>();
requiredActions.add(requiredAction);
testRealm.setRequiredActions(requiredActions);
testRealm.setResetPasswordAllowed(Boolean.TRUE);
}
use of org.keycloak.representations.idm.RequiredActionProviderRepresentation in project keycloak by keycloak.
the class ActionUtil method addRequiredActionForRealm.
public static void addRequiredActionForRealm(RealmRepresentation testRealm, String providerId) {
List<RequiredActionProviderRepresentation> requiredActions = testRealm.getRequiredActions();
if (requiredActions == null)
requiredActions = new LinkedList();
RequiredActionProviderRepresentation last = requiredActions.get(requiredActions.size() - 1);
RequiredActionProviderRepresentation action = new RequiredActionProviderRepresentation();
action.setAlias(providerId);
action.setProviderId(providerId);
action.setEnabled(true);
action.setDefaultAction(true);
action.setPriority(last.getPriority() + 1);
requiredActions.add(action);
testRealm.setRequiredActions(requiredActions);
}
Aggregations