-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove AccountPasswordPage from testsuite #15204
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,6 @@ public void logout(String idTokenHint) { | |
oauth.idTokenHint(idTokenHint).openLogout(); | ||
} | ||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import javax.ws.rs.core.Response; | ||
|
||
import org.ietf.jgss.GSSCredential; | ||
import org.jboss.arquillian.graphene.page.Page; | ||
import org.junit.Assume; | ||
import org.junit.Test; | ||
import org.keycloak.admin.client.resource.ClientResource; | ||
|
@@ -46,6 +47,10 @@ | |
import org.keycloak.testsuite.Assert; | ||
import org.keycloak.testsuite.admin.ApiUtil; | ||
import org.keycloak.testsuite.arquillian.annotation.DisableFeature; | ||
import org.keycloak.testsuite.pages.AppPage; | ||
import org.keycloak.testsuite.pages.LoginPage; | ||
import org.keycloak.testsuite.util.AccountHelper; | ||
import org.keycloak.testsuite.util.TestAppHelper; | ||
|
||
import static org.keycloak.testsuite.admin.ApiUtil.findClientByClientId; | ||
|
||
|
@@ -57,6 +62,9 @@ | |
@DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) | ||
public abstract class AbstractKerberosSingleRealmTest extends AbstractKerberosTest { | ||
|
||
@Page | ||
protected AppPage appPage; | ||
|
||
@Test | ||
public void spnegoNotAvailableTest() throws Exception { | ||
initHttpClient(false); | ||
|
@@ -131,35 +139,27 @@ public void usernamePasswordLoginTest() throws Exception { | |
// Change editMode to READ_ONLY | ||
updateProviderEditMode(UserStorageProvider.EditMode.READ_ONLY); | ||
|
||
// Login with username/password from kerberos | ||
changePasswordPage.open(); | ||
loginPage.assertCurrent(); | ||
loginPage.login("jduke", "theduke"); | ||
changePasswordPage.assertCurrent(); | ||
TestAppHelper testAppHelper = new TestAppHelper(oauth, loginPage, appPage); | ||
|
||
// Bad existing password | ||
changePasswordPage.changePassword("theduke-invalid", "newPass", "newPass"); | ||
Assert.assertTrue(driver.getPageSource().contains("Invalid existing password.")); | ||
Assert.assertTrue(testAppHelper.login("jduke", "theduke")); | ||
Assert.assertTrue(testAppHelper.logout()); | ||
|
||
// Change password is not possible as editMode is READ_ONLY | ||
changePasswordPage.changePassword("theduke", "newPass", "newPass"); | ||
Assert.assertTrue( | ||
driver.getPageSource().contains("You can't update your password as your account is read-only")); | ||
Assert.assertFalse(AccountHelper.updatePassword(testRealmResource(), "jduke", "newPass")); | ||
|
||
Assert.assertFalse(testAppHelper.login("jduke", "newPass")); | ||
|
||
// Change editMode to UNSYNCED | ||
updateProviderEditMode(UserStorageProvider.EditMode.UNSYNCED); | ||
|
||
// Successfully change password now | ||
changePasswordPage.changePassword("theduke", "newPass", "newPass"); | ||
Assert.assertTrue(driver.getPageSource().contains("Your password has been updated.")); | ||
changePasswordPage.logout(); | ||
Assert.assertTrue(AccountHelper.updatePassword(testRealmResource(), "jduke", "newPass")); | ||
|
||
// Login with old password doesn't work, but with new password works | ||
loginPage.login("jduke", "theduke"); | ||
loginPage.assertCurrent(); | ||
loginPage.login("jduke", "newPass"); | ||
changePasswordPage.assertCurrent(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to verify the login was really successful? In the following steps, there's only used |
||
changePasswordPage.logout(); | ||
Assert.assertFalse(testAppHelper.login("jduke", "theduke")); | ||
Assert.assertTrue(testAppHelper.login("jduke", "newPass")); | ||
|
||
testAppHelper.logout(); | ||
|
||
// Assert SPNEGO login still with the old password as mode is unsynced | ||
events.clear(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,10 @@ | |
import org.keycloak.storage.ldap.kerberos.LDAPProviderKerberosConfig; | ||
import org.keycloak.testsuite.ProfileAssume; | ||
import org.keycloak.testsuite.arquillian.annotation.DisableFeature; | ||
import org.keycloak.testsuite.util.AccountHelper; | ||
import org.keycloak.testsuite.util.KerberosRule; | ||
import org.keycloak.testsuite.KerberosEmbeddedServer; | ||
import org.keycloak.testsuite.util.TestAppHelper; | ||
|
||
/** | ||
* Test for the LDAPStorageProvider with kerberos enabled (kerberos with LDAP integration) | ||
|
@@ -121,53 +123,39 @@ public void testClientOverrideFlowUsingBrowserHttpChallenge() throws Exception { | |
public void validatePasswordPolicyTest() throws Exception{ | ||
updateProviderEditMode(UserStorageProvider.EditMode.WRITABLE); | ||
|
||
changePasswordPage.open(); | ||
loginPage.open(); | ||
loginPage.login("jduke", "theduke"); | ||
|
||
updateProviderValidatePasswordPolicy(true); | ||
changePasswordPage.changePassword("theduke", "jduke", "jduke"); | ||
Assert.assertTrue(driver.getPageSource().contains("Invalid")); | ||
|
||
Assert.assertFalse(AccountHelper.updatePassword(testRealmResource(), "jduke", "jduke")); | ||
|
||
updateProviderValidatePasswordPolicy(false); | ||
changePasswordPage.changePassword("theduke", "jduke", "jduke"); | ||
Assert.assertTrue(driver.getPageSource().contains("Your password has been updated.")); | ||
Assert.assertTrue(AccountHelper.updatePassword(testRealmResource(), "jduke", "jduke")); | ||
|
||
// Change password back | ||
changePasswordPage.open(); | ||
changePasswordPage.changePassword("jduke", "theduke", "theduke"); | ||
Assert.assertTrue(AccountHelper.updatePassword(testRealmResource(), "jduke", "theduke")); | ||
} | ||
|
||
@Test | ||
public void writableEditModeTest() throws Exception { | ||
TestAppHelper testAppHelper = new TestAppHelper(oauth, loginPage, appPage); | ||
|
||
// Change editMode to WRITABLE | ||
updateProviderEditMode(UserStorageProvider.EditMode.WRITABLE); | ||
|
||
// Login with username/password from kerberos | ||
changePasswordPage.open(); | ||
// Only needed if you are providing a click thru to bypass kerberos. Currently there is a javascript | ||
// to forward the user if kerberos isn't enabled. | ||
//bypassPage.isCurrent(); | ||
//bypassPage.clickContinue(); | ||
loginPage.assertCurrent(); | ||
loginPage.login("jduke", "theduke"); | ||
Assert.assertTrue(changePasswordPage.isCurrent()); | ||
|
||
// Successfully change password now | ||
changePasswordPage.changePassword("theduke", "newPass", "newPass"); | ||
Assert.assertTrue(driver.getPageSource().contains("Your password has been updated.")); | ||
changePasswordPage.logout(); | ||
Assert.assertTrue(AccountHelper.updatePassword(testRealmResource(), "jduke", "newPass")); | ||
|
||
// Only needed if you are providing a click thru to bypass kerberos. Currently there is a javascript | ||
// to forward the user if kerberos isn't enabled. | ||
//bypassPage.isCurrent(); | ||
//bypassPage.clickContinue(); | ||
|
||
// Login with old password doesn't work, but with new password works | ||
loginPage.login("jduke", "theduke"); | ||
Assert.assertTrue(loginPage.isCurrent()); | ||
loginPage.login("jduke", "newPass"); | ||
changePasswordPage.assertCurrent(); | ||
changePasswordPage.logout(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above with the assertion. |
||
|
||
Assert.assertFalse(testAppHelper.login("jduke", "theduke")); | ||
Assert.assertTrue(testAppHelper.login("jduke", "newPass")); | ||
|
||
// Assert SPNEGO login with the new password as mode is writable | ||
events.clear(); | ||
|
@@ -187,9 +175,6 @@ public void writableEditModeTest() throws Exception { | |
assertAuthenticationSuccess(codeUrl); | ||
|
||
// Change password back | ||
changePasswordPage.open(); | ||
loginPage.login("jduke", "newPass"); | ||
changePasswordPage.assertCurrent(); | ||
changePasswordPage.changePassword("newPass", "theduke", "theduke"); | ||
Assert.assertTrue(AccountHelper.updatePassword(testRealmResource(), "jduke", "theduke")); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this test case is included in the abstract test and is used for various additional test classes, IMHO, the login should be verified here via the LoginPage. Also, the test case is named
usernamePasswordLoginTest
, and one could say if I execute this successfully, I'm really confident the login works as expected.We're not sure the login with password
"theduke"
worked before, as it's tested in the following steps.