commit
6d2eeb7cd6
12 changed files with 109 additions and 80 deletions
|
@ -29,7 +29,7 @@ import java.net.URL;
|
|||
* @author mhajas
|
||||
*/
|
||||
public class SAMLPostSigExample extends AbstractPageWithInjectedUrl {
|
||||
public static final String DEPLOYMENT_NAME = "saml-post-signatures";
|
||||
public static final String DEPLOYMENT_NAME = "sales-post-sig";
|
||||
|
||||
@ArquillianResource
|
||||
@OperateOnDeployment(DEPLOYMENT_NAME)
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package org.keycloak.testsuite.arquillian;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import org.jboss.arquillian.container.spi.event.container.BeforeDeploy;
|
||||
import org.jboss.arquillian.container.test.api.ContainerController;
|
||||
import org.jboss.arquillian.core.api.Instance;
|
||||
|
@ -13,12 +9,18 @@ import org.jboss.arquillian.core.api.annotation.Observes;
|
|||
import org.jboss.arquillian.test.spi.annotation.ClassScoped;
|
||||
import org.jboss.arquillian.test.spi.event.suite.BeforeClass;
|
||||
import org.jboss.logging.Logger;
|
||||
import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.getAuthServerContextRoot;
|
||||
import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.getAuthServerQualifier;
|
||||
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
|
||||
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||
import static org.keycloak.testsuite.util.IOUtil.execCommand;
|
||||
import org.keycloak.testsuite.util.LogChecker;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.getAuthServerContextRoot;
|
||||
import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.getAuthServerQualifier;
|
||||
import static org.keycloak.testsuite.util.IOUtil.execCommand;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.pause;
|
||||
|
||||
/**
|
||||
|
@ -158,7 +160,9 @@ public class AppServerTestEnricher {
|
|||
execCommand(command + " --connect --command=reload" + controllerArg, bin);
|
||||
log.info("Container restarted");
|
||||
pause(5000);
|
||||
LogChecker.checkJBossServerLog(jbossHomePath);
|
||||
if (System.getProperty("app.server.log.check","true").equals("true")) {
|
||||
LogChecker.checkJBossServerLog(jbossHomePath);
|
||||
}
|
||||
}
|
||||
|
||||
appServerInfo.setAdapterLibsInstalled(true);
|
||||
|
|
|
@ -35,11 +35,12 @@ public abstract class Login extends AuthRealm {
|
|||
public static final String PROTOCOL = "protocol";
|
||||
public static final String OIDC = "openid-connect";
|
||||
public static final String SAML = "saml";
|
||||
public static final String LOGIN_ACTION = "login-action";
|
||||
|
||||
@Override
|
||||
public UriBuilder createUriBuilder() {
|
||||
return super.createUriBuilder()
|
||||
.path("protocol/{" + PROTOCOL + "}" + (getProtocol().equals(OIDC) ? "/auth" : ""));
|
||||
.path((getProtocol().equals(OIDC) || getProtocol().equals(SAML)) ? "protocol/" : "" + "{" + PROTOCOL + "}" + (getProtocol().equals(OIDC) ? "/auth" : ""));
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package org.keycloak.testsuite.auth.page.login;
|
||||
|
||||
/**
|
||||
* @author mhajas
|
||||
*/
|
||||
public class SAMLPostLogin extends Login {
|
||||
SAMLPostLogin() {
|
||||
setProtocol(LOGIN_ACTION);
|
||||
}
|
||||
}
|
|
@ -20,8 +20,8 @@ package org.keycloak.testsuite.auth.page.login;
|
|||
/**
|
||||
* @author mhajas
|
||||
*/
|
||||
public class SAMLLogin extends Login {
|
||||
SAMLLogin() {
|
||||
public class SAMLRedirectLogin extends Login {
|
||||
SAMLRedirectLogin() {
|
||||
setProtocol(SAML);
|
||||
}
|
||||
}
|
|
@ -23,7 +23,8 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
|||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
|
||||
import org.keycloak.testsuite.auth.page.login.SAMLLogin;
|
||||
import org.keycloak.testsuite.auth.page.login.SAMLPostLogin;
|
||||
import org.keycloak.testsuite.auth.page.login.SAMLRedirectLogin;
|
||||
import org.openqa.selenium.Cookie;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
@ -47,7 +48,10 @@ public abstract class AbstractAuthTest extends AbstractKeycloakTest {
|
|||
protected OIDCLogin testRealmLoginPage;
|
||||
|
||||
@Page
|
||||
protected SAMLLogin testRealmSAMLLoginPage;
|
||||
protected SAMLPostLogin testRealmSAMLPostLoginPage;
|
||||
|
||||
@Page
|
||||
protected SAMLRedirectLogin testRealmSAMLRedirectLoginPage;
|
||||
|
||||
protected UserRepresentation testUser;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest {
|
|||
masterUrl = client.getBaseUrl();
|
||||
}
|
||||
masterUrl = masterUrl.replaceFirst(regex, replacement);
|
||||
client.setAdminUrl(masterUrl);
|
||||
client.setAdminUrl(masterUrl + ((!masterUrl.endsWith("/saml")) ? "/saml" : ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public abstract class AbstractSAMLExampleAdapterTest extends AbstractExampleAdap
|
|||
public void setDefaultPageUriParameters() {
|
||||
super.setDefaultPageUriParameters();
|
||||
testRealmPage.setAuthRealm(SAMLDEMO);
|
||||
testRealmSAMLLoginPage.setAuthRealm(SAMLDEMO);
|
||||
testRealmSAMLRedirectLoginPage.setAuthRealm(SAMLDEMO);
|
||||
testRealmSAMLPostLoginPage.setAuthRealm(SAMLDEMO);
|
||||
}
|
||||
|
||||
@Deployment(name = SAMLPostSigExample.DEPLOYMENT_NAME)
|
||||
|
@ -81,41 +82,41 @@ public abstract class AbstractSAMLExampleAdapterTest extends AbstractExampleAdap
|
|||
@Test
|
||||
public void samlPostWithSignatureExampleTest() {
|
||||
samlPostSigExamplePage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
|
||||
assertTrue(driver.getPageSource().contains("Welcome to the Sales Tool, " + bburkeUser.getUsername()));
|
||||
|
||||
samlPostSigExamplePage.logout();
|
||||
|
||||
samlPostSigExamplePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void samlPostWithEncryptionExampleTest() {
|
||||
samlPostEncExamplePage.navigateTo();
|
||||
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
|
||||
assertTrue(driver.getPageSource().contains("Welcome to the Sales Tool, " + bburkeUser.getUsername()));
|
||||
|
||||
samlPostEncExamplePage.logout();
|
||||
|
||||
samlPostEncExamplePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void samlRedirectWithSignatureExampleTest() {
|
||||
samlRedirectSigExamplePage.navigateTo();
|
||||
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
|
||||
assertTrue(driver.getPageSource().contains("Welcome to the Employee Tool,"));
|
||||
|
||||
samlRedirectSigExamplePage.logout();
|
||||
|
||||
samlRedirectSigExamplePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@ import org.w3c.dom.Document;
|
|||
import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLSERVLETDEMO;
|
||||
import static org.keycloak.testsuite.util.IOUtil.*;
|
||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
||||
|
@ -157,7 +155,8 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
public void setDefaultPageUriParameters() {
|
||||
super.setDefaultPageUriParameters();
|
||||
testRealmPage.setAuthRealm(SAMLSERVLETDEMO);
|
||||
testRealmSAMLLoginPage.setAuthRealm(SAMLSERVLETDEMO);
|
||||
testRealmSAMLRedirectLoginPage.setAuthRealm(SAMLSERVLETDEMO);
|
||||
testRealmSAMLPostLoginPage.setAuthRealm(SAMLSERVLETDEMO);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -177,7 +176,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void unauthorizedSSOTest() {
|
||||
salesPostServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
testRealmSAMLRedirectLoginPage.form().login("unauthorized", "password");
|
||||
|
||||
assertFalse(driver.getPageSource().contains("principal="));
|
||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
||||
|
@ -200,7 +199,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void singleLoginAndLogoutSAMLTest() {
|
||||
salesPostServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
salesPostSigServletPage.navigateTo();
|
||||
|
@ -215,16 +214,16 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
employeeSigFrontServletPage.logout();
|
||||
|
||||
employeeSigFrontServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
|
||||
employeeSigServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
|
||||
salesPostPassiveServletPage.navigateTo();
|
||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
||||
|
||||
salesPostSigEmailServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -236,7 +235,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void badRealmSalesPostSigTest() {
|
||||
badRealmSalesPostSigServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
|
||||
//Different 403 status page on EAP and Wildfly
|
||||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("Status 403"));
|
||||
|
@ -245,14 +244,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void employee2Test() {
|
||||
employee2ServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
employee2ServletPage.logout();
|
||||
employee2ServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -262,14 +261,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void employeeSigTest() {
|
||||
employeeSigServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
employeeSigServletPage.logout();
|
||||
employeeSigServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -279,14 +278,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void employeeSigFrontTest() {
|
||||
employeeSigFrontServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
employeeSigFrontServletPage.logout();
|
||||
employeeSigFrontServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -301,19 +300,29 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
modifyDocElementAttribute(doc, "AssertionConsumerService", "Location", "8080", System.getProperty("app.server.http.port", null));
|
||||
|
||||
ClientRepresentation clientRep = testRealmResource().convertClientDescription(IOUtil.documentToString(doc));
|
||||
|
||||
String appServerUrl;
|
||||
if (Boolean.parseBoolean(System.getProperty("app.server.ssl.required"))) {
|
||||
appServerUrl = "https://localhost:" + System.getProperty("app.server.https.port", "8543") + "/";
|
||||
} else {
|
||||
appServerUrl = "http://localhost:" + System.getProperty("app.server.http.port", "8280") + "/";
|
||||
}
|
||||
|
||||
clientRep.setAdminUrl(appServerUrl + "sales-metadata/saml");
|
||||
|
||||
Response response = testRealmResource().clients().create(clientRep);
|
||||
assertEquals(201, response.getStatus());
|
||||
response.close();
|
||||
|
||||
salesMetadataServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
salesMetadataServletPage.logout();
|
||||
salesMetadataServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -323,14 +332,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void salesPostTest() {
|
||||
salesPostServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
salesPostServletPage.logout();
|
||||
salesPostServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -340,14 +349,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void salesPostEncTest() {
|
||||
salesPostEncServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
salesPostEncServletPage.logout();
|
||||
salesPostEncServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -361,7 +370,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
||||
|
||||
salesPostServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
|
||||
salesPostPassiveServletPage.navigateTo();
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
@ -372,7 +381,7 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
assertTrue(driver.getPageSource().contains("Forbidden") || driver.getPageSource().contains("<body><pre></pre></body>"));
|
||||
|
||||
salesPostServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
testRealmSAMLRedirectLoginPage.form().login("unauthorized", "password");
|
||||
salesPostPassiveServletPage.navigateTo();
|
||||
assertFalse(driver.getPageSource().contains("principal="));
|
||||
//Different 403 status page on EAP and Wildfly
|
||||
|
@ -383,14 +392,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void salesPostSigTest() {
|
||||
salesPostEncServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
salesPostEncServletPage.logout();
|
||||
salesPostEncServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -400,14 +409,14 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void salesPostSigEmailTest() {
|
||||
salesPostSigEmailServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("principal=bburke"));
|
||||
|
||||
salesPostSigEmailServletPage.logout();
|
||||
salesPostSigEmailServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -417,15 +426,15 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void salesPostSigPersistentTest() {
|
||||
salesPostSigPersistentServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertFalse(driver.getPageSource().contains("bburke"));
|
||||
assertTrue(driver.getPageSource().contains("principal=G-"));
|
||||
|
||||
salesPostSigPersistentServletPage.logout();
|
||||
salesPostSigPersistentServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
@ -435,15 +444,15 @@ public abstract class AbstractSAMLServletsAdapterTest extends AbstractServletsAd
|
|||
@Test
|
||||
public void salesPostSigTransientTest() {
|
||||
salesPostSigTransientServletPage.navigateTo();
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
testRealmSAMLPostLoginPage.form().login(bburkeUser);
|
||||
assertFalse(driver.getPageSource().contains("bburke"));
|
||||
assertTrue(driver.getPageSource().contains("principal=G-"));
|
||||
|
||||
salesPostSigTransientServletPage.logout();
|
||||
salesPostSigTransientServletPage.navigateTo();
|
||||
assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
assertCurrentUrlStartsWith(testRealmSAMLPostLoginPage);
|
||||
|
||||
testRealmSAMLLoginPage.form().login("unauthorized", "password");
|
||||
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"));
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol urn:oasis:names:tc:SAML:1.1:protocol http://schemas.xmlsoap.org/ws/2003/07/secext">
|
||||
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient
|
||||
</NameIDFormat>
|
||||
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8080/sales-metadata/"/>
|
||||
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8080/sales-metadata/"/>
|
||||
<AssertionConsumerService
|
||||
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8080/sales-metadata/"
|
||||
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8080/sales-metadata/"
|
||||
index="1" isDefault="true" />
|
||||
<KeyDescriptor use="signing">
|
||||
<dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
|
||||
|
|
|
@ -172,8 +172,8 @@
|
|||
"enabled": true,
|
||||
"protocol": "saml",
|
||||
"fullScopeAllowed": true,
|
||||
"baseUrl": "http://localhost:8080/bad-realm-sales-post-sig/",
|
||||
"adminUrl": "http://localhost:8080/bad-realm-sales-post-sig/",
|
||||
"baseUrl": "http://localhost:8080/bad-realm-sales-post-sig",
|
||||
"adminUrl": "http://localhost:8080/bad-realm-sales-post-sig",
|
||||
"redirectUris": [
|
||||
"http://localhost:8080/bad-realm-sales-post-sig/*"
|
||||
],
|
||||
|
@ -189,8 +189,8 @@
|
|||
"enabled": true,
|
||||
"protocol": "saml",
|
||||
"fullScopeAllowed": true,
|
||||
"baseUrl": "http://localhost:8080/bad-client-sales-post-sig/",
|
||||
"adminUrl": "http://localhost:8080/bad-client-sales-post-sig/",
|
||||
"baseUrl": "http://localhost:8080/bad-client-sales-post-sig",
|
||||
"adminUrl": "http://localhost:8080/bad-client-sales-post-sig",
|
||||
"redirectUris": [
|
||||
"http://localhost:8080/bad-client-sales-post-sig/*"
|
||||
],
|
||||
|
@ -229,7 +229,7 @@
|
|||
"redirectUris": [
|
||||
"http://localhost:8080/employee-sig/*"
|
||||
],
|
||||
"adminUrl": "http://localhost:8080/employee-sig/",
|
||||
"adminUrl": "http://localhost:8080/employee-sig",
|
||||
"attributes": {
|
||||
"saml.server.signature": "true",
|
||||
"saml.client.signature": "true",
|
||||
|
@ -243,11 +243,11 @@
|
|||
"enabled": true,
|
||||
"protocol": "saml",
|
||||
"fullScopeAllowed": true,
|
||||
"baseUrl": "http://localhost:8080/employee/",
|
||||
"baseUrl": "http://localhost:8080/employee",
|
||||
"redirectUris": [
|
||||
"http://localhost:8080/employee/*"
|
||||
],
|
||||
"adminUrl": "http://localhost:8080/employee/",
|
||||
"adminUrl": "http://localhost:8080/employee",
|
||||
"attributes": {
|
||||
"saml.authnstatement": "true"
|
||||
},
|
||||
|
@ -293,11 +293,11 @@
|
|||
"enabled": true,
|
||||
"protocol": "saml",
|
||||
"fullScopeAllowed": true,
|
||||
"baseUrl": "http://localhost:8080/employee2/",
|
||||
"baseUrl": "http://localhost:8080/employee2",
|
||||
"redirectUris": [
|
||||
"http://localhost:8080/employee2/*"
|
||||
],
|
||||
"adminUrl": "http://localhost:8080/employee2/",
|
||||
"adminUrl": "http://localhost:8080/employee2",
|
||||
"attributes": {
|
||||
"saml.authnstatement": "true"
|
||||
},
|
||||
|
@ -344,7 +344,7 @@
|
|||
"protocol": "saml",
|
||||
"fullScopeAllowed": true,
|
||||
"frontchannelLogout": true,
|
||||
"baseUrl": "http://localhost:8080/employee-sig-front/",
|
||||
"baseUrl": "http://localhost:8080/employee-sig-front",
|
||||
"redirectUris": [
|
||||
"http://localhost:8080/employee-sig-front/*"
|
||||
],
|
||||
|
|
|
@ -30,20 +30,20 @@ public class ModAuthMellonTest extends AbstractAuthTest {
|
|||
@Test
|
||||
public void modAuthMellonTest() throws TransformerException {
|
||||
testRealmPage.setAuthRealm("mellon-test");
|
||||
testRealmSAMLLoginPage.setAuthRealm("mellon-test");
|
||||
testRealmSAMLRedirectLoginPage.setAuthRealm("mellon-test");
|
||||
|
||||
modAuthMellonUnprotectedResourcePage.navigateTo();
|
||||
assertTrue(driver.getPageSource().contains("Unprotected resource"));
|
||||
|
||||
modAuthMellonProtectedResourcePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("Protected resource"));
|
||||
|
||||
modAuthMellonProtectedResourcePage.logout();
|
||||
assertTrue(driver.getPageSource().contains("Unprotected resource"));
|
||||
|
||||
modAuthMellonProtectedResourcePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue