diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlSignedPostBindingTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java similarity index 50% rename from testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlSignedPostBindingTest.java rename to testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java index 87d5db7bcf5..2700d0f3cfd 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlSignedPostBindingTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java @@ -14,17 +14,20 @@ import org.openqa.selenium.WebDriver; * @author Bill Burke * @version $Revision: 1 $ */ -public class SamlSignedPostBindingTest { +public class SamlBindingTest { @ClassRule public static SamlKeycloakRule keycloakRule = new SamlKeycloakRule() { @Override public void initWars() { - ClassLoader classLoader = SamlSignedPostBindingTest.class.getClassLoader(); + ClassLoader classLoader = SamlBindingTest.class.getClassLoader(); + initializeSamlSecuredWar("/saml/simple-post", "/sales-post", "post.war", classLoader); initializeSamlSecuredWar("/saml/signed-post", "/sales-post-sig", "post-sig.war", classLoader); + initializeSamlSecuredWar("/saml/signed-get", "/employee-sig", "employee-sig.war", classLoader); initializeSamlSecuredWar("/saml/bad-client-signed-post", "/bad-client-sales-post-sig", "bad-client-post-sig.war", classLoader); initializeSamlSecuredWar("/saml/bad-realm-signed-post", "/bad-realm-sales-post-sig", "bad-realm-post-sig.war", classLoader); + initializeSamlSecuredWar("/saml/encrypted-post", "/sales-post-enc", "post-enc.war", classLoader); } @@ -49,7 +52,18 @@ public class SamlSignedPostBindingTest { @Test - public void testSignedLoginLogout() { + public void testPostSimpleLoginLogout() { + driver.navigate().to("http://localhost:8081/sales-post/"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); + loginPage.login("bburke", "password"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/sales-post/"); + Assert.assertTrue(driver.getPageSource().contains("bburke")); + driver.navigate().to("http://localhost:8081/sales-post?GLO=true"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); + + } + @Test + public void testPostSignedLoginLogout() { driver.navigate().to("http://localhost:8081/sales-post-sig/"); Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); loginPage.login("bburke", "password"); @@ -60,7 +74,30 @@ public class SamlSignedPostBindingTest { } @Test - public void testBadClientSignature() { + public void testRedirectSignedLoginLogout() { + driver.navigate().to("http://localhost:8081/employee-sig/"); + Assert.assertTrue(driver.getCurrentUrl().startsWith("http://localhost:8081/auth/realms/demo/protocol/saml")); + loginPage.login("bburke", "password"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/employee-sig/"); + Assert.assertTrue(driver.getPageSource().contains("bburke")); + driver.navigate().to("http://localhost:8081/employee-sig?GLO=true"); + Assert.assertTrue(driver.getCurrentUrl().startsWith("http://localhost:8081/auth/realms/demo/protocol/saml")); + + } + + @Test + public void testPostEncryptedLoginLogout() { + driver.navigate().to("http://localhost:8081/sales-post-enc/"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); + loginPage.login("bburke", "password"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/sales-post-enc/"); + Assert.assertTrue(driver.getPageSource().contains("bburke")); + driver.navigate().to("http://localhost:8081/sales-post-enc?GLO=true"); + Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); + + } + @Test + public void testPostBadClientSignature() { driver.navigate().to("http://localhost:8081/bad-client-sales-post-sig/"); Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); Assert.assertEquals(driver.getTitle(), "We're sorry..."); @@ -68,7 +105,7 @@ public class SamlSignedPostBindingTest { } @Test - public void testBadRealmSignature() { + public void testPostBadRealmSignature() { driver.navigate().to("http://localhost:8081/bad-realm-sales-post-sig/"); Assert.assertEquals(driver.getCurrentUrl(), "http://localhost:8081/auth/realms/demo/protocol/saml"); loginPage.login("bburke", "password"); diff --git a/testsuite/integration/src/test/resources/saml/encrypted-post/WEB-INF/keystore.jks b/testsuite/integration/src/test/resources/saml/encrypted-post/WEB-INF/keystore.jks new file mode 100755 index 00000000000..822162ceafc Binary files /dev/null and b/testsuite/integration/src/test/resources/saml/encrypted-post/WEB-INF/keystore.jks differ diff --git a/testsuite/integration/src/test/resources/saml/encrypted-post/WEB-INF/picketlink.xml b/testsuite/integration/src/test/resources/saml/encrypted-post/WEB-INF/picketlink.xml new file mode 100755 index 00000000000..068d3ecfe58 --- /dev/null +++ b/testsuite/integration/src/test/resources/saml/encrypted-post/WEB-INF/picketlink.xml @@ -0,0 +1,31 @@ + + + ${idp-sig.url::http://localhost:8081/auth/realms/demo/protocol/saml} + + ${sales-post-sig.url::http://localhost:8081/sales-post-enc/} + + + + + + + + + + + + + + + + + + + diff --git a/testsuite/integration/src/test/resources/saml/signed-get/WEB-INF/keystore.jks b/testsuite/integration/src/test/resources/saml/signed-get/WEB-INF/keystore.jks new file mode 100755 index 00000000000..4daad218a3f Binary files /dev/null and b/testsuite/integration/src/test/resources/saml/signed-get/WEB-INF/keystore.jks differ diff --git a/testsuite/integration/src/test/resources/saml/signed-get/WEB-INF/picketlink.xml b/testsuite/integration/src/test/resources/saml/signed-get/WEB-INF/picketlink.xml new file mode 100755 index 00000000000..beed463689e --- /dev/null +++ b/testsuite/integration/src/test/resources/saml/signed-get/WEB-INF/picketlink.xml @@ -0,0 +1,36 @@ + + + ${idp-sig.url::http://localhost:8081/auth/realms/demo/protocol/saml} + + ${employee-sig.url::http://localhost:8081/employee-sig/} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/integration/src/test/resources/saml/simple-get/WEB-INF/picketlink.xml b/testsuite/integration/src/test/resources/saml/simple-get/WEB-INF/picketlink.xml new file mode 100755 index 00000000000..2fb11caca1f --- /dev/null +++ b/testsuite/integration/src/test/resources/saml/simple-get/WEB-INF/picketlink.xml @@ -0,0 +1,20 @@ + + + ${idp.url::http://localhost:8081/auth/realms/demo/protocol/saml} + ${employee.url::http://localhost:8081/employee/} + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/integration/src/test/resources/saml/simple-post/WEB-INF/picketlink.xml b/testsuite/integration/src/test/resources/saml/simple-post/WEB-INF/picketlink.xml new file mode 100755 index 00000000000..4e20d7e401e --- /dev/null +++ b/testsuite/integration/src/test/resources/saml/simple-post/WEB-INF/picketlink.xml @@ -0,0 +1,20 @@ + + + ${idp.url::http://localhost:8081/auth/realms/demo/protocol/saml} + ${sales-post.url::http://localhost:8081/sales-post/} + + localhost,jboss.com,jboss.org,amazonaws.com + + + + + + + + + \ No newline at end of file