Refactor and improve stability of SAML tests
This commit is contained in:
parent
49dc5363bb
commit
40bf5fb5d2
2 changed files with 87 additions and 177 deletions
|
@ -27,14 +27,15 @@ import org.keycloak.testsuite.adapter.page.SAMLPostEncExample;
|
||||||
import org.keycloak.testsuite.adapter.page.SAMLPostSigExample;
|
import org.keycloak.testsuite.adapter.page.SAMLPostSigExample;
|
||||||
import org.keycloak.testsuite.adapter.page.SAMLRedirectSigExample;
|
import org.keycloak.testsuite.adapter.page.SAMLRedirectSigExample;
|
||||||
import org.keycloak.testsuite.util.URLAssert;
|
import org.keycloak.testsuite.util.URLAssert;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLDEMO;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLDEMO;
|
||||||
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
|
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
|
||||||
|
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mhajas
|
* @author mhajas
|
||||||
|
@ -84,7 +85,7 @@ public abstract class AbstractSAMLExampleAdapterTest extends AbstractExampleAdap
|
||||||
samlPostSigExamplePage.navigateTo();
|
samlPostSigExamplePage.navigateTo();
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||||
|
|
||||||
assertTrue(driver.getPageSource().contains("Welcome to the Sales Tool, " + bburkeUser.getUsername()));
|
waitUntilElement(By.xpath("//body")).text().contains("Welcome to the Sales Tool, " + bburkeUser.getUsername());
|
||||||
|
|
||||||
samlPostSigExamplePage.logout();
|
samlPostSigExamplePage.logout();
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ public abstract class AbstractSAMLExampleAdapterTest extends AbstractExampleAdap
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||||
|
|
||||||
assertTrue(driver.getPageSource().contains("Welcome to the Sales Tool, " + bburkeUser.getUsername()));
|
waitUntilElement(By.xpath("//body")).text().contains("Welcome to the Sales Tool, " + bburkeUser.getUsername());
|
||||||
|
|
||||||
samlPostEncExamplePage.logout();
|
samlPostEncExamplePage.logout();
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ public abstract class AbstractSAMLExampleAdapterTest extends AbstractExampleAdap
|
||||||
|
|
||||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||||
|
|
||||||
assertTrue(driver.getPageSource().contains("Welcome to the Employee Tool,"));
|
waitUntilElement(By.xpath("//body")).text().contains("Welcome to the Employee Tool,");
|
||||||
|
|
||||||
samlRedirectSigExamplePage.logout();
|
samlRedirectSigExamplePage.logout();
|
||||||
|
|
||||||
|
|
|
@ -24,20 +24,26 @@ import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.ClientResource;
|
import org.keycloak.admin.client.resource.ClientResource;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
||||||
import org.keycloak.testsuite.adapter.page.*;
|
import org.keycloak.testsuite.adapter.page.*;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
|
import org.keycloak.testsuite.auth.page.login.Login;
|
||||||
import org.keycloak.testsuite.auth.page.login.SAMLIDPInitiatedLogin;
|
import org.keycloak.testsuite.auth.page.login.SAMLIDPInitiatedLogin;
|
||||||
|
import org.keycloak.testsuite.page.AbstractPage;
|
||||||
import org.keycloak.testsuite.util.IOUtil;
|
import org.keycloak.testsuite.util.IOUtil;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLSERVLETDEMO;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLSERVLETDEMO;
|
||||||
import static org.keycloak.testsuite.util.IOUtil.*;
|
import static org.keycloak.testsuite.util.IOUtil.*;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
||||||
|
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mhajas
|
* @author mhajas
|
||||||
|
@ -163,6 +169,40 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
testRealmSAMLPostLoginPage.setAuthRealm(SAMLSERVLETDEMO);
|
testRealmSAMLPostLoginPage.setAuthRealm(SAMLSERVLETDEMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertForbidden(AbstractPage page) {
|
||||||
|
page.navigateTo();
|
||||||
|
waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
|
||||||
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertSuccessfullyLoggedIn(AbstractPage page) {
|
||||||
|
page.navigateTo();
|
||||||
|
waitUntilElement(By.xpath("//body")).text().contains("principal=bburke");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertForbiddenLogin(AbstractPage page, String username, String password, Login loginPage) {
|
||||||
|
page.navigateTo();
|
||||||
|
assertCurrentUrlStartsWith(loginPage);
|
||||||
|
loginPage.form().login(username, password);
|
||||||
|
waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
|
||||||
|
//Different 403 status page on EAP and Wildfly
|
||||||
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertSuccessfulLogin(AbstractPage page, UserRepresentation user, Login loginPage) {
|
||||||
|
page.navigateTo();
|
||||||
|
assertCurrentUrlStartsWith(loginPage);
|
||||||
|
loginPage.form().login(user);
|
||||||
|
waitUntilElement(By.xpath("//body")).text().contains("principal=bburke");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testSuccessfulAndUnauthorizedLogin(SAMLServletWithLogout page, Login loginPage) {
|
||||||
|
assertSuccessfulLogin(page, bburkeUser, loginPage);
|
||||||
|
page.logout();
|
||||||
|
assertForbiddenLogin(page, "unauthorized", "password", loginPage);
|
||||||
|
page.logout();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void disabledClientTest() {
|
public void disabledClientTest() {
|
||||||
ClientResource clientResource = ApiUtil.findClientResourceByClientId(testRealmResource(), "http://localhost:8081/sales-post-sig/");
|
ClientResource clientResource = ApiUtil.findClientResourceByClientId(testRealmResource(), "http://localhost:8081/sales-post-sig/");
|
||||||
|
@ -171,7 +211,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
clientResource.update(client);
|
clientResource.update(client);
|
||||||
|
|
||||||
salesPostSigServletPage.navigateTo();
|
salesPostSigServletPage.navigateTo();
|
||||||
assertTrue(driver.getPageSource().contains("Login requester not enabled"));
|
waitUntilElement(By.xpath("//body")).text().contains("Login requester not enabled");
|
||||||
|
|
||||||
client.setEnabled(true);
|
client.setEnabled(true);
|
||||||
clientResource.update(client);
|
clientResource.update(client);
|
||||||
|
@ -179,41 +219,20 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void unauthorizedSSOTest() {
|
public void unauthorizedSSOTest() {
|
||||||
salesPostServletPage.navigateTo();
|
assertForbiddenLogin(salesPostServletPage, "unauthorized", "password", testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLRedirectLoginPage.form().login("unauthorized", "password");
|
assertForbidden(employee2ServletPage);
|
||||||
|
assertForbidden(employeeSigFrontServletPage);
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
assertForbidden(salesPostSigPersistentServletPage);
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
|
|
||||||
employee2ServletPage.navigateTo();
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
|
|
||||||
employeeSigFrontServletPage.navigateTo();
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
|
|
||||||
salesPostSigPersistentServletPage.navigateTo();
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
|
|
||||||
salesPostServletPage.logout();
|
salesPostServletPage.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void singleLoginAndLogoutSAMLTest() {
|
public void singleLoginAndLogoutSAMLTest() {
|
||||||
salesPostServletPage.navigateTo();
|
assertSuccessfulLogin(salesPostServletPage, bburkeUser, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
assertSuccessfullyLoggedIn(salesPostSigServletPage);
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
assertSuccessfullyLoggedIn(employee2ServletPage);
|
||||||
|
assertSuccessfullyLoggedIn(salesPostEncServletPage);
|
||||||
salesPostSigServletPage.navigateTo();
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
employee2ServletPage.navigateTo();
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostEncServletPage.navigateTo();
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
employeeSigFrontServletPage.logout();
|
employeeSigFrontServletPage.logout();
|
||||||
|
|
||||||
|
@ -224,6 +243,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||||
|
|
||||||
salesPostPassiveServletPage.navigateTo();
|
salesPostPassiveServletPage.navigateTo();
|
||||||
|
waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body></body>") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body></body>") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
||||||
|
|
||||||
salesPostSigEmailServletPage.navigateTo();
|
salesPostSigEmailServletPage.navigateTo();
|
||||||
|
@ -233,7 +253,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
@Test
|
@Test
|
||||||
public void badClientSalesPostSigTest() {
|
public void badClientSalesPostSigTest() {
|
||||||
badClientSalesPostSigServletPage.navigateTo();
|
badClientSalesPostSigServletPage.navigateTo();
|
||||||
assertTrue(driver.getPageSource().contains("invalidRequesterMessage"));
|
waitUntilElement(By.xpath("//body")).text().contains("invalidRequesterMessage");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -241,59 +261,24 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
badRealmSalesPostSigServletPage.navigateTo();
|
badRealmSalesPostSigServletPage.navigateTo();
|
||||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||||
|
|
||||||
|
waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
|
||||||
//Different 403 status page on EAP and Wildfly
|
//Different 403 status page on EAP and Wildfly
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void employee2Test() {
|
public void employee2Test() {
|
||||||
employee2ServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(employee2ServletPage, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
employee2ServletPage.logout();
|
|
||||||
employee2ServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
employee2ServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void employeeSigTest() {
|
public void employeeSigTest() {
|
||||||
employeeSigServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(employeeSigServletPage, testRealmSAMLRedirectLoginPage);
|
||||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
employeeSigServletPage.logout();
|
|
||||||
employeeSigServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLRedirectLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
employeeSigServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void employeeSigFrontTest() {
|
public void employeeSigFrontTest() {
|
||||||
employeeSigFrontServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(employeeSigFrontServletPage, testRealmSAMLRedirectLoginPage);
|
||||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
employeeSigFrontServletPage.logout();
|
|
||||||
employeeSigFrontServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLRedirectLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
employeeSigFrontServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -318,130 +303,64 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
assertEquals(201, response.getStatus());
|
assertEquals(201, response.getStatus());
|
||||||
response.close();
|
response.close();
|
||||||
|
|
||||||
salesMetadataServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(salesMetadataServletPage, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesMetadataServletPage.logout();
|
|
||||||
salesMetadataServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesMetadataServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void salesPostTest() {
|
public void salesPostTest() {
|
||||||
salesPostServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(salesPostServletPage, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostServletPage.logout();
|
|
||||||
salesPostServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void salesPostEncTest() {
|
public void salesPostEncTest() {
|
||||||
salesPostEncServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(salesPostEncServletPage, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostEncServletPage.logout();
|
|
||||||
salesPostEncServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostEncServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void salesPostPassiveTest() {
|
public void salesPostPassiveTest() {
|
||||||
salesPostPassiveServletPage.navigateTo();
|
salesPostPassiveServletPage.navigateTo();
|
||||||
|
|
||||||
|
waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
|
||||||
//Different 403 status page on EAP and Wildfly
|
//Different 403 status page on EAP and Wildfly
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body></body>") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body></body>") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
||||||
|
|
||||||
salesPostServletPage.navigateTo();
|
assertSuccessfulLogin(salesPostServletPage, bburkeUser, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
|
||||||
|
|
||||||
salesPostPassiveServletPage.navigateTo();
|
assertSuccessfullyLoggedIn(salesPostPassiveServletPage);
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostPassiveServletPage.logout();
|
salesPostPassiveServletPage.logout();
|
||||||
salesPostPassiveServletPage.navigateTo();
|
salesPostPassiveServletPage.navigateTo();
|
||||||
|
|
||||||
|
waitUntilElement(By.xpath("//body")).text().not().contains("principal=");
|
||||||
//Different 403 status page on EAP and Wildfly
|
//Different 403 status page on EAP and Wildfly
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body></body>") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body></body>") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
||||||
|
|
||||||
salesPostServletPage.navigateTo();
|
assertForbiddenLogin(salesPostServletPage, "unauthorized", "password", testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLRedirectLoginPage.form().login("unauthorized", "password");
|
assertForbidden(salesPostPassiveServletPage);
|
||||||
salesPostPassiveServletPage.navigateTo();
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostPassiveServletPage.logout();
|
salesPostPassiveServletPage.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void salesPostSigTest() {
|
public void salesPostSigTest() {
|
||||||
salesPostEncServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(salesPostSigServletPage, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostEncServletPage.logout();
|
|
||||||
salesPostEncServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostEncServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void salesPostSigEmailTest() {
|
public void salesPostSigEmailTest() {
|
||||||
salesPostSigEmailServletPage.navigateTo();
|
testSuccessfulAndUnauthorizedLogin(salesPostSigEmailServletPage, testRealmSAMLPostLoginPage);
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostSigEmailServletPage.logout();
|
|
||||||
salesPostSigEmailServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostSigEmailServletPage.logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void salesPostSigPersistentTest() {
|
public void salesPostSigPersistentTest() {
|
||||||
salesPostSigPersistentServletPage.navigateTo();
|
salesPostSigPersistentServletPage.navigateTo();
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||||
assertFalse(driver.getPageSource().contains("bburke"));
|
waitUntilElement(By.xpath("//body")).text().not().contains("bburke");
|
||||||
assertTrue(driver.getPageSource().contains("principal=G-"));
|
waitUntilElement(By.xpath("//body")).text().contains("principal=G-");
|
||||||
|
|
||||||
salesPostSigPersistentServletPage.logout();
|
salesPostSigPersistentServletPage.logout();
|
||||||
salesPostSigPersistentServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
assertForbiddenLogin(salesPostSigPersistentServletPage, "unauthorized", "password", testRealmSAMLPostLoginPage);
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostSigPersistentServletPage.logout();
|
salesPostSigPersistentServletPage.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,17 +368,12 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
public void salesPostSigTransientTest() {
|
public void salesPostSigTransientTest() {
|
||||||
salesPostSigTransientServletPage.navigateTo();
|
salesPostSigTransientServletPage.navigateTo();
|
||||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||||
assertFalse(driver.getPageSource().contains("bburke"));
|
waitUntilElement(By.xpath("//body")).text().not().contains("bburke");
|
||||||
assertTrue(driver.getPageSource().contains("principal=G-"));
|
waitUntilElement(By.xpath("//body")).text().contains("principal=G-");
|
||||||
|
|
||||||
salesPostSigTransientServletPage.logout();
|
salesPostSigTransientServletPage.logout();
|
||||||
salesPostSigTransientServletPage.navigateTo();
|
|
||||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
|
||||||
|
|
||||||
testRealmSAMLPostLoginPage.form().login("unauthorized", "password");
|
assertForbiddenLogin(salesPostSigTransientServletPage, "unauthorized", "password", testRealmSAMLPostLoginPage);
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
//Different 403 status page on EAP and Wildfly
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
salesPostSigTransientServletPage.logout();
|
salesPostSigTransientServletPage.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,11 +384,9 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
samlidpInitiatedLogin.navigateTo();
|
samlidpInitiatedLogin.navigateTo();
|
||||||
samlidpInitiatedLogin.form().login(bburkeUser);
|
samlidpInitiatedLogin.form().login(bburkeUser);
|
||||||
|
|
||||||
employee2ServletPage.navigateTo();
|
waitUntilElement(By.xpath("//body")).text().contains("principal=bburke");
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
salesPostSigServletPage.navigateTo();
|
assertSuccessfullyLoggedIn(salesPostSigServletPage);
|
||||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
|
||||||
|
|
||||||
employee2ServletPage.logout();
|
employee2ServletPage.logout();
|
||||||
}
|
}
|
||||||
|
@ -486,13 +398,10 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
||||||
samlidpInitiatedLogin.navigateTo();
|
samlidpInitiatedLogin.navigateTo();
|
||||||
samlidpInitiatedLogin.form().login("unauthorized", "password");
|
samlidpInitiatedLogin.form().login("unauthorized", "password");
|
||||||
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
waitUntilElement(By.xpath("//body")).text().not().contains("bburke");
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
|
||||||
|
|
||||||
employee2ServletPage.navigateTo();
|
|
||||||
assertFalse(driver.getPageSource().contains("principal="));
|
|
||||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
||||||
|
|
||||||
|
assertForbidden(employee2ServletPage);
|
||||||
employee2ServletPage.logout();
|
employee2ServletPage.logout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue