forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use stronger passwords in LDAP tests due to password policy on MSAD2012
- Loading branch information
Showing
2 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 69,7 @@ public void config(RealmManager manager, RealmModel adminstrationRealm, RealmMod | |
LDAPUtils.removeAllUsers(partitionManager); | ||
|
||
User john = LDAPUtils.addUser(partitionManager, "johnkeycloak", "John", "Doe", "[email protected]"); | ||
LDAPUtils.updatePassword(partitionManager, john, "password"); | ||
LDAPUtils.updatePassword(partitionManager, john, "Password1"); | ||
|
||
User existing = LDAPUtils.addUser(partitionManager, "existing", "Existing", "Foo", "[email protected]"); | ||
} | ||
|
@@ -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", "[email protected]", "nonExisting", "password", "password"); | ||
registerPage.register("firstName", "lastName", "[email protected]", "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)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,15 58,15 @@ public void config(RealmManager manager, RealmModel adminstrationRealm, RealmMod | |
LDAPUtils.removeAllUsers(partitionManager); | ||
|
||
User user1 = LDAPUtils.addUser(partitionManager, "user1", "User1FN", "User1LN", "[email protected]"); | ||
LDAPUtils.updatePassword(partitionManager, user1, "password1"); | ||
LDAPUtils.updatePassword(partitionManager, user1, "Password1"); | ||
User user2 = LDAPUtils.addUser(partitionManager, "user2", "User2FN", "User2LN", "[email protected]"); | ||
LDAPUtils.updatePassword(partitionManager, user2, "password2"); | ||
LDAPUtils.updatePassword(partitionManager, user2, "Password2"); | ||
User user3 = LDAPUtils.addUser(partitionManager, "user3", "User3FN", "User3LN", "[email protected]"); | ||
LDAPUtils.updatePassword(partitionManager, user3, "password3"); | ||
LDAPUtils.updatePassword(partitionManager, user3, "Password3"); | ||
User user4 = LDAPUtils.addUser(partitionManager, "user4", "User4FN", "User4LN", "[email protected]"); | ||
LDAPUtils.updatePassword(partitionManager, user4, "password4"); | ||
LDAPUtils.updatePassword(partitionManager, user4, "Password4"); | ||
User user5 = LDAPUtils.addUser(partitionManager, "user5", "User5FN", "User5LN", "[email protected]"); | ||
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); | ||
|