[java-idp-integration-tests] 02/02: Add CAS test with attributes.

Tom Zeller tzeller at dragonacea.biz
Mon Apr 4 15:58:17 EDT 2016


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch master
in repository java-idp-integration-tests.

commit 3d47702d3ff9960b9469515cd826240f6d1a9852
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Mon Apr 4 14:57:39 2016 -0500

    Add CAS test with attributes.
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 13 ++++++++
 .../idp/test/cas/CASIntegrationTest.java           | 39 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index b235936..245ff4d 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -882,6 +882,19 @@ public abstract class BaseIntegrationTest
     }
 
     /**
+     * Release eduPersonAffiliation by adding a wildcard regex to attribute-filter.xml.
+     * 
+     * @throws IOException
+     */
+    public void enableLocalhostCASAttributes() throws IOException {
+        final Path pathToLogbackXML = Paths.get("conf", "attribute-filter.xml");
+
+        final String oldText = "<Rule xsi:type=\"Requester\" value=\"https://another.example.org/shibboleth\" />";
+        final String newText = "<Rule xsi:type=\"RequesterRegex\" regex=\"https?://localhost(:\\\\d+)?/.*\" />";
+        replaceIdPHomeFile(pathToLogbackXML, oldText, newText);
+    }
+
+    /**
      * Log unencrypted SAML.
      */
     public void logUnencryptedSAML() {
diff --git a/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java
index ffef4c1..32a83c3 100644
--- a/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java
@@ -48,6 +48,13 @@ public class CASIntegrationTest extends BaseIntegrationTest {
     /** Expected CAS service response. */
     @Nonnull final String expectedCASServiceResponse = "<cas:serviceresponse xmlns:cas=\"http://www.yale.edu/tp/cas\">"
             + "<cas:authenticationsuccess><cas:user>jdoe</cas:user></cas:authenticationsuccess></cas:serviceresponse>";
+    
+    /** Expected CAS service response with attributes. */
+    @Nonnull final String expectedCASServiceResponseWithAttributes =
+            "<cas:serviceresponse xmlns:cas=\"http://www.yale.edu/tp/cas\"><cas:authenticationsuccess>"
+                    + "<cas:user>jdoe</cas:user><cas:attributes>"
+                    + "<cas:edupersonscopedaffiliation>member</cas:edupersonscopedaffiliation>"
+                    + "</cas:attributes></cas:authenticationsuccess></cas:serviceresponse>";
 
     @BeforeClass
     public void setUpURLs() throws Exception {
@@ -113,4 +120,36 @@ public class CASIntegrationTest extends BaseIntegrationTest {
         Assert.assertEquals(actualCASServiceResponse, expectedCASServiceResponse);
     }
 
+    @Test(dataProvider = "sauceOnDemandBrowserDataProvider")
+    public void testCASSSOWithAttributes(@Nullable final BrowserData browserData) throws Exception {
+
+        startSeleniumClient(browserData);
+
+        enableLogout();
+
+        enableCASProtocol();
+
+        enableLocalhostCASServiceDefinition();
+
+        enableLocalhostCASAttributes();
+
+        startJettyServer();
+
+        startFlow();
+
+        waitForLoginPage();
+
+        login();
+
+        waitForPageWithURL(getBaseURL() + spServicePageURLPath);
+
+        driver.findElement(By.id("cas-service-validate")).click();
+
+        waitForPageWithURL(getBaseURL() + idpServiceValidatePageURLPath);
+
+        final String actualCASServiceResponse = getCASServiceResponse(driver.getPageSource());
+
+        Assert.assertEquals(actualCASServiceResponse, expectedCASServiceResponseWithAttributes);
+    }
+
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list