Java Code Examples for org.keycloak.representations.idm.RealmRepresentation#setResetPasswordAllowed()
The following examples show how to use
org.keycloak.representations.idm.RealmRepresentation#setResetPasswordAllowed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RequiredActionTotpSetupTest.java From keycloak with Apache License 2.0 | 5 votes |
@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); }
Example 2
Source File: KcOidcBrokerConfiguration.java From keycloak with Apache License 2.0 | 5 votes |
@Override public RealmRepresentation createConsumerRealm() { RealmRepresentation realm = new RealmRepresentation(); realm.setRealm(REALM_CONS_NAME); realm.setEnabled(true); realm.setResetPasswordAllowed(true); return realm; }
Example 3
Source File: KcSamlBrokerConfiguration.java From keycloak with Apache License 2.0 | 5 votes |
@Override public RealmRepresentation createConsumerRealm() { RealmRepresentation realm = new RealmRepresentation(); realm.setEnabled(true); realm.setRealm(REALM_CONS_NAME); realm.setResetPasswordAllowed(true); return realm; }
Example 4
Source File: LoginPageTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void addTestRealms(List<RealmRepresentation> testRealms) { super.addTestRealms(testRealms); RealmRepresentation testRealmRep = testRealms.get(0); testRealmRep.setDisplayNameHtml("Test realm <b>HTML</b>"); testRealmRep.setRememberMe(true); testRealmRep.setResetPasswordAllowed(true); testRealmRep.setRegistrationAllowed(true); }
Example 5
Source File: AppInitiatedActionTotpSetupTest.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void configureTestRealm(RealmRepresentation testRealm) { testRealm.setResetPasswordAllowed(Boolean.TRUE); }
Example 6
Source File: RequiredActionResetPasswordTest.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void configureTestRealm(RealmRepresentation testRealm) { testRealm.setResetPasswordAllowed(Boolean.TRUE); ActionUtil.addRequiredActionForUser(testRealm, "test-user@localhost", RequiredAction.UPDATE_PASSWORD.name()); }
Example 7
Source File: AppInitiatedActionResetPasswordTest.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void configureTestRealm(RealmRepresentation testRealm) { testRealm.setResetPasswordAllowed(Boolean.TRUE); }
Example 8
Source File: AbstractFirstBrokerLoginTest.java From keycloak with Apache License 2.0 | 4 votes |
/** * Refers to in old test suite: org.keycloak.testsuite.broker.AbstractFirstBrokerLoginTest#testLinkAccountByReauthentication_forgetPassword */ @Test public void testLinkAccountByLogInAsUserAfterResettingPassword() throws InterruptedException { RealmResource realm = adminClient.realm(bc.consumerRealmName()); RealmRepresentation realmRep = realm.toRepresentation(); realmRep.setResetPasswordAllowed(true); realm.update(realmRep); updateExecutions(AbstractBrokerTest::disableUpdateProfileOnFirstLogin); String existingUser = createUser("consumer"); UserResource providerUser = adminClient.realm(bc.providerRealmName()).users().get(userId); UserRepresentation userResource = providerUser.toRepresentation(); userResource.setEmail(USER_EMAIL); userResource.setFirstName("FirstName"); userResource.setLastName("LastName"); providerUser.update(userResource); driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName())); logInWithBroker(bc); waitForPage(driver, "account already exists", false); idpConfirmLinkPage.assertCurrent(); idpConfirmLinkPage.clickLinkAccount(); configureSMTPServer(); this.loginPage.resetPassword(); this.loginPasswordResetPage.assertCurrent(); this.loginPasswordResetPage.changePassword(); assertEquals("You should receive an email shortly with further instructions.", this.loginPage.getSuccessMessage()); assertEquals(1, MailServer.getReceivedMessages().length); MimeMessage message = MailServer.getLastReceivedMessage(); String linkFromMail = assertEmailAndGetUrl(MailServerConfiguration.FROM, USER_EMAIL, "credentials", false); driver.navigate().to(linkFromMail.trim()); // Need to update password now this.passwordUpdatePage.assertCurrent(); this.passwordUpdatePage.changePassword("password", "password"); waitForAccountManagementTitle(); accountUpdateProfilePage.assertCurrent(); assertNumFederatedIdentities(existingUser, 1); }
Example 9
Source File: AbstractFirstBrokerLoginTest.java From keycloak with Apache License 2.0 | 4 votes |
/** * Refers to in old test suite: org.keycloak.testsuite.broker.AbstractFirstBrokerLoginTest#testLinkAccountByReauthentication_forgetPassword_differentBrowser */ @Test public void testLinkAccountByLogInAsUserAfterResettingPasswordUsingDifferentBrowsers() throws InterruptedException { RealmResource realm = adminClient.realm(bc.consumerRealmName()); RealmRepresentation realmRep = realm.toRepresentation(); realmRep.setResetPasswordAllowed(true); realm.update(realmRep); updateExecutions(AbstractBrokerTest::disableUpdateProfileOnFirstLogin); String existingUser = createUser("consumer"); UserResource providerUser = adminClient.realm(bc.providerRealmName()).users().get(userId); UserRepresentation userResource = providerUser.toRepresentation(); userResource.setEmail(USER_EMAIL); userResource.setFirstName("FirstName"); userResource.setLastName("LastName"); providerUser.update(userResource); driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName())); logInWithBroker(bc); waitForPage(driver, "account already exists", false); idpConfirmLinkPage.assertCurrent(); idpConfirmLinkPage.clickLinkAccount(); configureSMTPServer(); this.loginPage.resetPassword(); this.loginPasswordResetPage.assertCurrent(); this.loginPasswordResetPage.changePassword(); assertEquals("You should receive an email shortly with further instructions.", this.loginPage.getSuccessMessage()); assertEquals(1, MailServer.getReceivedMessages().length); MimeMessage message = MailServer.getLastReceivedMessage(); String linkFromMail = assertEmailAndGetUrl(MailServerConfiguration.FROM, USER_EMAIL, "credentials", false); driver2.navigate().to(linkFromMail.trim()); removeSMTPConfiguration(realm); // Need to update password now LoginPasswordUpdatePage passwordUpdatePage = PageFactory.initElements(driver2, LoginPasswordUpdatePage.class); passwordUpdatePage.changePassword("password", "password"); assertNumFederatedIdentities(existingUser, 0); log.debug("Clicking social " + bc.getIDPAlias()); loginPage.clickSocial(bc.getIDPAlias()); try { waitForPage(driver, "account already exists", false); } catch (Exception e) { // this is a workaround to make this test work for both oidc and saml. when doing oidc the browser is redirected to the login page to finish the linking loginPage.login(bc.getUserLogin(), bc.getUserPassword()); } waitForPage(driver, "account already exists", false); idpConfirmLinkPage.assertCurrent(); idpConfirmLinkPage.clickLinkAccount(); loginPage.login("password"); assertNumFederatedIdentities(existingUser, 1); }