[java-idp-integration-tests] 02/02: IDP-1044 - Add test which resolves attributes from LDAP

Tom Zeller tzeller at dragonacea.biz
Fri Sep 16 16:37:46 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.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=f51a4396a7f69146db7f1190e949e04a3e014593

commit f51a4396a7f69146db7f1190e949e04a3e014593
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Fri Sep 16 15:37:21 2016 -0500

    IDP-1044 - Add test which resolves attributes from LDAP
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 12 +++++
 .../test/saml2/AbstractSAML2IntegrationTest.java   | 49 ++++++++++++++++++++
 .../saml2/SAML2SSORedirectLDAPIntegrationTest.java | 54 ++++++++++++++++++++++
 3 files changed, 115 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 8314e6f..dbeff6d 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -1040,6 +1040,18 @@ public abstract class BaseIntegrationTest
     }
 
     /**
+     * Use attribute-resolver-ldap.xml instead of attribute-resolver.xml.
+     * 
+     * @throws IOException
+     */
+    public void enableAttributeResolverLDAP() throws IOException {
+        final Path pathToServicesXML = Paths.get("conf", "services.xml");
+        final String oldText = "<value>%\\{idp.home\\}/conf/attribute-resolver.xml</value>";
+        final String newText = "<value>%\\{idp.home\\}/conf/attribute-resolver-ldap.xml</value>";
+        replaceIdPHomeFile(pathToServicesXML, oldText, newText);
+    }
+
+    /**
      * Log unencrypted SAML.
      */
     public void logUnencryptedSAML() {
diff --git a/src/test/java/net/shibboleth/idp/test/saml2/AbstractSAML2IntegrationTest.java b/src/test/java/net/shibboleth/idp/test/saml2/AbstractSAML2IntegrationTest.java
index 8bbc49a..c600421 100644
--- a/src/test/java/net/shibboleth/idp/test/saml2/AbstractSAML2IntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/saml2/AbstractSAML2IntegrationTest.java
@@ -615,4 +615,53 @@ public abstract class AbstractSAML2IntegrationTest extends BaseIntegrationTest {
         validateLogoutResponse();
     }
 
+    /**
+     * Test SAML 2 SSO releasing attributes from an LDAP directory.
+     * 
+     * @param browserData browser/os/version triplet provided by data provider
+     * @throws Exception if an error occurs
+     */
+    public void testSSOReleaseLDAPAttributes(@Nullable final BrowserData browserData) throws Exception {
+
+        // Only the mail attribute is released from LDAP by default
+        validator.expectedAttributes.clear();
+        validator.expectedAttributes.add(validator.mailAttribute);
+
+        enableAttributeResolverLDAP();
+
+        startSeleniumClient(browserData);
+
+        startServer();
+
+        startFlow();
+
+        waitForLoginPage();
+
+        login();
+
+        // attribute release
+
+        waitForAttributeReleasePage();
+
+        releaseAllAttributes();
+
+        rememberConsent();
+
+        submitForm();
+
+        // response
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // twice
+
+        startFlow();
+
+        waitForResponsePage();
+
+        validateResponse();
+    }
+
 }
diff --git a/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java
new file mode 100644
index 0000000..4f41d90
--- /dev/null
+++ b/src/test/java/net/shibboleth/idp/test/saml2/SAML2SSORedirectLDAPIntegrationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development, 
+ * Inc. (UCAID) under one or more contributor license agreements.  See the 
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache 
+ * License, Version 2.0 (the "License"); you may not use this file except in 
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.test.saml2;
+
+import javax.annotation.Nullable;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.test.BrowserData;
+
+/** SAML 2 HTTP Redirect binding test with attributes from LDAP. */
+public class SAML2SSORedirectLDAPIntegrationTest extends AbstractSAML2IntegrationTest {
+
+    @BeforeClass
+    public void setUpURLs() throws Exception {
+
+        startFlowURLPath = "/sp/SAML2/InitSSO/Redirect";
+
+        loginPageURLPath = "/idp/profile/SAML2/Redirect/SSO";
+
+        responsePageURLPath = "/sp/SAML2/POST/ACS";
+
+        isPassiveRequestURLPath = "/sp/SAML2/InitSSO/Passive";
+
+        forceAuthnRequestURLPath = "/sp/SAML2/InitSSO/ForceAuthn";
+
+        idpLogoutURLPath = "/idp/profile/SAML2/Redirect/SLO";
+
+        spLogoutURLPath = "/sp/SAML2/Redirect/SLO";
+
+        logoutTransientIDInputID = "InitSLO_Redirect";
+    }
+
+    @Test(dataProvider = "sauceOnDemandBrowserDataProvider")
+    public void testSSOReleaseLDAPAttributes(@Nullable final BrowserData browserData) throws Exception {
+        super.testSSOReleaseLDAPAttributes(browserData);
+    }
+}

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


More information about the commits mailing list