From 44937d33ad8780ab6a639b0b98439bbbb3dc3017 Mon Sep 17 00:00:00 2001 From: mposolda Date: Tue, 2 Sep 2014 12:43:14 +0200 Subject: [PATCH] Use stronger passwords in LDAP tests due to password policy on MSAD2012 --- .../FederationProvidersIntegrationTest.java | 26 +++++++++---------- .../testsuite/forms/SyncProvidersTest.java | 10 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/FederationProvidersIntegrationTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/FederationProvidersIntegrationTest.java index 0ffa2ac6d0ae..a662611b027d 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/FederationProvidersIntegrationTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/FederationProvidersIntegrationTest.java @@ -69,7 +69,7 @@ public void config(RealmManager manager, RealmModel adminstrationRealm, RealmMod LDAPUtils.removeAllUsers(partitionManager); User john = LDAPUtils.addUser(partitionManager, "johnkeycloak", "John", "Doe", "john@email.org"); - LDAPUtils.updatePassword(partitionManager, john, "password"); + LDAPUtils.updatePassword(partitionManager, john, "Password1"); User existing = LDAPUtils.addUser(partitionManager, "existing", "Existing", "Foo", "existing@email.org"); } @@ -137,7 +137,7 @@ public void loginClassic() { @Test public void loginLdap() { loginPage.open(); - loginPage.login("johnkeycloak", "password"); + loginPage.login("johnkeycloak", "Password1"); Assert.assertEquals(AppPage.RequestType.AUTH_RESPONSE, appPage.getRequestType()); Assert.assertNotNull(oauth.getCurrentQuery().get(OAuth2Constants.CODE)); @@ -164,7 +164,7 @@ public void XdeleteLink() { } } loginPage.open(); - loginPage.login("johnkeycloak", "password"); + loginPage.login("johnkeycloak", "Password1"); loginPage.assertCurrent(); Assert.assertEquals("Invalid username or password.", loginPage.getError()); @@ -187,19 +187,19 @@ public void XdeleteLink() { @Test public void passwordChangeLdap() throws Exception { changePasswordPage.open(); - loginPage.login("johnkeycloak", "password"); - changePasswordPage.changePassword("password", "new-password", "new-password"); + loginPage.login("johnkeycloak", "Password1"); + changePasswordPage.changePassword("Password1", "New-password1", "New-password1"); Assert.assertEquals("Your password has been updated", profilePage.getSuccess()); changePasswordPage.logout(); loginPage.open(); - loginPage.login("johnkeycloak", "bad-password"); + loginPage.login("johnkeycloak", "Bad-password1"); Assert.assertEquals("Invalid username or password.", loginPage.getError()); loginPage.open(); - loginPage.login("johnkeycloak", "new-password"); + loginPage.login("johnkeycloak", "New-password1"); Assert.assertEquals(AppPage.RequestType.AUTH_RESPONSE, appPage.getRequestType()); } @@ -210,12 +210,12 @@ public void registerExistingLdapUser() { registerPage.assertCurrent(); // check existing username - registerPage.register("firstName", "lastName", "email", "existing", "password", "password"); + registerPage.register("firstName", "lastName", "email", "existing", "Password1", "Password1"); registerPage.assertCurrent(); Assert.assertEquals("Username already exists", registerPage.getError()); // Check existing email - registerPage.register("firstName", "lastName", "existing@email.org", "nonExisting", "password", "password"); + registerPage.register("firstName", "lastName", "existing@email.org", "nonExisting", "Password1", "Password1"); registerPage.assertCurrent(); Assert.assertEquals("Email already exists", registerPage.getError()); } @@ -226,7 +226,7 @@ public void registerUserLdapSuccess() { loginPage.clickRegister(); registerPage.assertCurrent(); - registerPage.register("firstName", "lastName", "email2", "registerUserSuccess2", "password", "password"); + registerPage.register("firstName", "lastName", "email2", "registerUserSuccess2", "Password1", "Password1"); Assert.assertEquals(AppPage.RequestType.AUTH_RESPONSE, appPage.getRequestType()); KeycloakSession session = keycloakRule.startSession(); @@ -274,7 +274,7 @@ public void testReadonly() { } try { - UserCredentialModel cred = UserCredentialModel.password("poop"); + UserCredentialModel cred = UserCredentialModel.password("PoopyPoop1"); user.updateCredential(cred); Assert.fail("should fail"); } catch (ModelReadOnlyException e) { @@ -364,14 +364,14 @@ public void testUnsynced() { Assert.assertNotNull(user.getFederationLink()); Assert.assertEquals(user.getFederationLink(), ldapModel.getId()); - UserCredentialModel cred = UserCredentialModel.password("candy"); + UserCredentialModel cred = UserCredentialModel.password("Candycand1"); user.updateCredential(cred); UserCredentialValueModel userCredentialValueModel = user.getCredentialsDirectly().get(0); Assert.assertEquals(UserCredentialModel.PASSWORD, userCredentialValueModel.getType()); Assert.assertTrue(session.users().validCredentials(appRealm, user, cred)); // LDAP password is still unchanged - Assert.assertTrue(LDAPUtils.validatePassword(getPartitionManager(session, model), "johnkeycloak", "new-password")); + Assert.assertTrue(LDAPUtils.validatePassword(getPartitionManager(session, model), "johnkeycloak", "New-password1")); // ATM it's not permitted to delete user in unsynced mode. Should be user deleted just locally instead? Assert.assertFalse(session.users().removeUser(appRealm, user)); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/SyncProvidersTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/SyncProvidersTest.java index 4d2da8e06371..d629996dd727 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/SyncProvidersTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/SyncProvidersTest.java @@ -58,15 +58,15 @@ public void config(RealmManager manager, RealmModel adminstrationRealm, RealmMod LDAPUtils.removeAllUsers(partitionManager); User user1 = LDAPUtils.addUser(partitionManager, "user1", "User1FN", "User1LN", "user1@email.org"); - LDAPUtils.updatePassword(partitionManager, user1, "password1"); + LDAPUtils.updatePassword(partitionManager, user1, "Password1"); User user2 = LDAPUtils.addUser(partitionManager, "user2", "User2FN", "User2LN", "user2@email.org"); - LDAPUtils.updatePassword(partitionManager, user2, "password2"); + LDAPUtils.updatePassword(partitionManager, user2, "Password2"); User user3 = LDAPUtils.addUser(partitionManager, "user3", "User3FN", "User3LN", "user3@email.org"); - LDAPUtils.updatePassword(partitionManager, user3, "password3"); + LDAPUtils.updatePassword(partitionManager, user3, "Password3"); User user4 = LDAPUtils.addUser(partitionManager, "user4", "User4FN", "User4LN", "user4@email.org"); - LDAPUtils.updatePassword(partitionManager, user4, "password4"); + LDAPUtils.updatePassword(partitionManager, user4, "Password4"); User user5 = LDAPUtils.addUser(partitionManager, "user5", "User5FN", "User5LN", "user5@email.org"); - LDAPUtils.updatePassword(partitionManager, user5, "password5"); + LDAPUtils.updatePassword(partitionManager, user5, "Password5"); // Add properties provider dummyModel = appRealm.addUserFederationProvider(DummyUserFederationProviderFactory.PROVIDER_NAME, new HashMap(), 1, "test-dummy", -1, 1, 0);