Use stronger passwords in LDAP tests due to password policy on MSAD2012

This commit is contained in:
mposolda 2014-09-02 12:43:14 +02:00
parent b561080f3a
commit 44937d33ad
2 changed files with 18 additions and 18 deletions

View file

@ -69,7 +69,7 @@ public class FederationProvidersIntegrationTest {
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 class FederationProvidersIntegrationTest {
@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 class FederationProvidersIntegrationTest {
}
}
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 class FederationProvidersIntegrationTest {
@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 class FederationProvidersIntegrationTest {
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 class FederationProvidersIntegrationTest {
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 class FederationProvidersIntegrationTest {
}
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 class FederationProvidersIntegrationTest {
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));

View file

@ -58,15 +58,15 @@ public class SyncProvidersTest {
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<String, String>(), 1, "test-dummy", -1, 1, 0);