This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 1.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git

commit 1673243fa1b7cf65ff69bdc686e24836627b7560
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Wed May 16 17:42:09 2018 +0100

    Adding SAML SSO RP tests
---
 .../systests/custom/CustomParametersTest.java      |   3 +-
 .../cxf/fediz/integrationtests/LDAPTest.java       |   2 +-
 systests/samlsso/pom.xml                           |  22 ++--
 .../fediz/systests/samlsso/Tomcat8PluginTest.java} | 127 +++------------------
 .../samlsso/src/test/resources/fediz_config.xml    |  61 ++++++++++
 .../cxf/fediz/integrationtests/AbstractTests.java  |  89 ++++++++++++---
 .../cxf/fediz/integrationtests/HTTPTestUtils.java  |  19 +--
 7 files changed, 169 insertions(+), 154 deletions(-)

diff --git 
a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
 
b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
index 307c4b2..1d1318d 100644
--- 
a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
+++ 
b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
@@ -251,7 +251,8 @@ public class CustomParametersTest {
         String user = "alice";
         String password = "ecila";
 
-        final String bodyTextContent = HTTPTestUtils.login(url, user, 
password, getIdpHttpsPort());
+        final String bodyTextContent =
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
"signinresponseform");
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
diff --git 
a/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
 
b/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
index ac0347a..e5dd002 100644
--- 
a/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
+++ 
b/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
@@ -256,7 +256,7 @@ public class LDAPTest extends AbstractLdapTestUnit {
         String password = "ecila";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
"signinresponseform");
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
diff --git a/systests/samlsso/pom.xml b/systests/samlsso/pom.xml
index 563fcef..7f5828a 100644
--- a/systests/samlsso/pom.xml
+++ b/systests/samlsso/pom.xml
@@ -37,13 +37,7 @@
         <dependency>
             <groupId>org.apache.tomcat.embed</groupId>
             <artifactId>tomcat-embed-core</artifactId>
-            <version>${tomcat7.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat.embed</groupId>
-            <artifactId>tomcat-embed-logging-juli</artifactId>
-            <version>${tomcat7.version}</version>
+            <version>${tomcat8.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -55,7 +49,7 @@
         <dependency>
             <groupId>org.apache.tomcat.embed</groupId>
             <artifactId>tomcat-embed-jasper</artifactId>
-            <version>${tomcat7.version}</version>
+            <version>${tomcat8.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -66,7 +60,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf.fediz</groupId>
-            <artifactId>fediz-tomcat7</artifactId>
+            <artifactId>fediz-tomcat8</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
@@ -147,6 +141,14 @@
                                     
<outputDirectory>target/tomcat/idp/webapps/fediz-idp-sts</outputDirectory>
                                 </artifactItem>
                                 <artifactItem>
+                                    
<groupId>org.apache.cxf.fediz.systests.webapps</groupId>
+                                    
<artifactId>fediz-systests-webapps-simple</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>war</type>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>target/tomcat/rp/webapps/simpleWebapp</outputDirectory>
+                                </artifactItem>
+                                <artifactItem>
                                     
<groupId>org.apache.cxf.fediz.systests</groupId>
                                     
<artifactId>fediz-systests-tests</artifactId>
                                     <version>${project.version}</version>
@@ -210,6 +212,7 @@
                             </systemPropertyVariables>
                             <includes>
                                 <include>**/idp/**</include>
+                                <include>**/samlsso/**</include>
                             </includes>
                             <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=256m 
</argLine>
                             <!--argLine>-Xms512m -Xmx1024m 
-XX:MaxPermSize=256m -Xdebug 
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y</argLine-->
@@ -231,6 +234,7 @@
                 <configuration>
                     <excludes>
                         <exclude>**/idp/**</exclude>
+                        <exclude>**/samlsso/**</exclude>
                     </excludes>
                 </configuration>
             </plugin>
diff --git 
a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
 
b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
similarity index 52%
copy from 
systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
copy to 
systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
index 307c4b2..e100ad7 100644
--- 
a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
+++ 
b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
@@ -17,42 +17,31 @@
  * under the License.
  */
 
-package org.apache.cxf.fediz.systests.custom;
+package org.apache.cxf.fediz.systests.samlsso;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.net.URLEncoder;
 
 import javax.servlet.ServletException;
 
-import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
 import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.commons.io.IOUtils;
-import org.apache.cxf.fediz.core.ClaimTypes;
-import org.apache.cxf.fediz.integrationtests.HTTPTestUtils;
-import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.wss4j.dom.engine.WSSConfig;
+import org.apache.cxf.fediz.integrationtests.AbstractTests;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 
 /**
- * Some tests invoking directly on the IdP and sending custom parameters
+ * Some tests for SAML SSO with the Tomcat 8 plugin, invoking on the Fediz IdP 
configured for SAML SSO.
  */
-public class CustomParametersTest {
+public class Tomcat8PluginTest extends AbstractTests {
 
     static String idpHttpsPort;
     static String rpHttpsPort;
@@ -62,15 +51,6 @@ public class CustomParametersTest {
 
     @BeforeClass
     public static void init() throws Exception {
-        System.setProperty("org.apache.commons.logging.Log", 
"org.apache.commons.logging.impl.SimpleLog");
-        
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
-        
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", 
"info");
-        
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
 "info");
-        
System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow",
 "info");
-        
System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web",
 "info");
-        
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz",
 "info");
-        
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", 
"info");
-
         idpHttpsPort = System.getProperty("idp.https.port");
         Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
         rpHttpsPort = System.getProperty("rp.https.port");
@@ -78,8 +58,6 @@ public class CustomParametersTest {
 
         idpServer = startServer(true, idpHttpsPort);
         rpServer = startServer(false, rpHttpsPort);
-
-        WSSConfig.init();
     }
 
     private static Tomcat startServer(boolean idp, String port)
@@ -170,108 +148,33 @@ public class CustomParametersTest {
         }
     }
 
+    @Override
     public String getIdpHttpsPort() {
         return idpHttpsPort;
     }
 
+    @Override
     public String getRpHttpsPort() {
         return rpHttpsPort;
     }
 
+    @Override
     public String getServletContextName() {
         return "fedizhelloworld";
     }
 
-    // Test a custom parameter that gets passed through to the STS
-    @org.junit.Test
-    public void testCustomParameter() throws Exception {
-        String url = "https://localhost:"; + getIdpHttpsPort() + 
"/fediz-idp/federation?";
-        url += "wa=wsignin1.0";
-        url += "&whr=urn:org:apache:cxf:fediz:idp:realm-A";
-        url += "&wtrealm=urn:org:apache:cxf:fediz:fedizhelloworld";
-        String wreply = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName() + "/secure/fedservlet";
-        url += "&wreply=" + wreply;
-
-        String user = "alice";
-        String password = "ecila";
-
-        // Successful test
-        WebClient webClient = new WebClient();
-        webClient.getOptions().setUseInsecureSSL(true);
-        webClient.getCredentialsProvider().setCredentials(
-            new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
-
-        webClient.getOptions().setJavaScriptEnabled(false);
-
-        String authUrl = url + "&auth_realm="
-            + URLEncoder.encode("<realm 
xmlns=\"http://cxf.apache.org/custom\";>custom-realm</realm>", "UTF-8");
-        HtmlPage idpPage = webClient.getPage(authUrl);
-        webClient.getOptions().setJavaScriptEnabled(true);
-        Assert.assertEquals("IDP SignIn Response Form", 
idpPage.getTitleText());
-
-        // Parse the form to get the token (wresult)
-        DomNodeList<DomElement> results = 
idpPage.getElementsByTagName("input");
-
-        String wresult = null;
-        for (DomElement result : results) {
-            if ("wresult".equals(result.getAttributeNS(null, "name"))) {
-                wresult = result.getAttributeNS(null, "value");
-                break;
-            }
-        }
-
-        Assert.assertNotNull(wresult);
-
-        webClient.close();
-
-        // Unsuccessful test
-        webClient = new WebClient();
-        webClient.getOptions().setUseInsecureSSL(true);
-        webClient.getCredentialsProvider().setCredentials(
-            new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
-            new UsernamePasswordCredentials(user, password));
-
-        webClient.getOptions().setJavaScriptEnabled(false);
-        authUrl = url + "&auth_realm="
-            + URLEncoder.encode("<realm 
xmlns=\"http://cxf.apache.org/custom\";>unknown-realm</realm>", "UTF-8");
-        try {
-            webClient.getPage(authUrl);
-            Assert.fail("Failure expected on a bad auth_realm value");
-        } catch (FailingHttpStatusCodeException ex) {
-            Assert.assertEquals(ex.getStatusCode(), 401);
-        }
-
-        webClient.close();
+    @Override
+    protected boolean isWSFederation() {
+        return false;
     }
 
     @org.junit.Test
-    public void testCustomParameterViaRP() throws Exception {
+    @org.junit.Ignore
+    public void testBrowser() throws Exception {
         String url = "https://localhost:"; + getRpHttpsPort() + 
"/fedizhelloworld/secure/fedservlet";
-        String user = "alice";
-        String password = "ecila";
-
-        final String bodyTextContent = HTTPTestUtils.login(url, user, 
password, getIdpHttpsPort());
-
-        Assert.assertTrue("Principal not " + user,
-                          bodyTextContent.contains("userPrincipal=" + user));
-        Assert.assertTrue("User " + user + " does not have role Admin",
-                          bodyTextContent.contains("role:Admin=false"));
-        Assert.assertTrue("User " + user + " does not have role Manager",
-                          bodyTextContent.contains("role:Manager=false"));
-        Assert.assertTrue("User " + user + " must have role User",
-                          bodyTextContent.contains("role:User=true"));
-
-        String claim = ClaimTypes.FIRSTNAME.toString();
-        Assert.assertTrue("User " + user + " claim " + claim + " is not 
'Alice'",
-                          bodyTextContent.contains(claim + "=Alice"));
-        claim = ClaimTypes.LASTNAME.toString();
-        Assert.assertTrue("User " + user + " claim " + claim + " is not 
'Smith'",
-                          bodyTextContent.contains(claim + "=Smith"));
-        claim = ClaimTypes.EMAILADDRESS.toString();
-        Assert.assertTrue("User " + user + " claim " + claim + " is not 
'[email protected]'",
-                          bodyTextContent.contains(claim + 
"[email protected]"));
 
+        System.out.println("URL: " + url);
+        Thread.sleep(5 * 60 * 1000);
     }
 
 }
diff --git a/systests/samlsso/src/test/resources/fediz_config.xml 
b/systests/samlsso/src/test/resources/fediz_config.xml
new file mode 100644
index 0000000..232ee80
--- /dev/null
+++ b/systests/samlsso/src/test/resources/fediz_config.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF 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.
+-->
+<!-- Place in Tomcat conf folder or other location as designated in this 
sample's webapp/META-INF/context.xml file. 
+     Keystore referenced below must have IDP STS' public cert included in it.  
This example re-uses the Tomcat SSL 
+     keystore (tomcat-rp.jks) for this task; alternatively you may wish to use 
a Fediz-specific keystore instead. 
+-->
+<FedizConfig>
+    <contextConfig name="/fedizhelloworld">
+        <audienceUris>
+            
<audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
+        </audienceUris>
+        <certificateStores>
+            <trustManager>
+                <keyStore file="test-classes/clienttrust.jks"
+                          password="storepass" type="JKS" />
+            </trustManager>
+        </certificateStores>
+        <trustedIssuers>
+            <issuer certificateValidation="PeerTrust" />
+        </trustedIssuers>
+        <maximumClockSkew>1000</maximumClockSkew>
+        <signingKey keyAlias="realma" keyPassword="realma">
+            <keyStore file="test-classes/stsrealm_a.jks" password="storepass" 
type="JKS" />
+        </signingKey>
+        <protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+            xsi:type="samlProtocolType" version="1.0.0">
+            <realm>urn:org:apache:cxf:fediz:fedizhelloworld</realm>
+            <signRequest>true</signRequest>
+            <issuer>https://localhost:${idp.https.port}/fediz-idp/saml</issuer>
+            <roleDelimiter>,</roleDelimiter>
+            
<roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
+            <disableDeflateEncoding>true</disableDeflateEncoding>
+            <claimTypesRequested>
+                <claimType 
type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role"; 
optional="false" />
+                               <claimType 
type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"; 
optional="true" />
+                               <claimType 
type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"; 
optional="true" />
+                               <claimType 
type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"; 
optional="true" />
+            </claimTypesRequested>
+        </protocol>
+        <logoutURL>/secure/logout</logoutURL>
+        <logoutRedirectTo>/index.html</logoutRedirectTo>
+    </contextConfig>
+</FedizConfig>
+
diff --git 
a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
 
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
index e232e4a..fba3cd6 100644
--- 
a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
+++ 
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
@@ -68,6 +68,17 @@ public abstract class AbstractTests {
 
     public abstract String getRpHttpsPort();
 
+    protected boolean isWSFederation() {
+        return true;
+    }
+
+    private String getLoginFormName() {
+        if (isWSFederation()) {
+            return "signinresponseform";
+        }
+        return "samlsigninresponseform";
+    }
+
     @Test
     public void testAlice() throws Exception {
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName()
@@ -76,7 +87,7 @@ public abstract class AbstractTests {
         String password = "ecila";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -107,7 +118,7 @@ public abstract class AbstractTests {
         String password = "ecila";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -127,7 +138,7 @@ public abstract class AbstractTests {
         String password = "ecila";
 
         try {
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
             Assert.fail("Exception expected");
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 403);
@@ -142,7 +153,7 @@ public abstract class AbstractTests {
         String password = "ecila";
 
         try {
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
             Assert.fail("Exception expected");
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 403);
@@ -157,7 +168,7 @@ public abstract class AbstractTests {
         String password = "alice";
 
         try {
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
             Assert.fail("Exception expected");
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 401);
@@ -172,7 +183,7 @@ public abstract class AbstractTests {
         String password = "bob";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -202,7 +213,7 @@ public abstract class AbstractTests {
         String password = "bob";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -222,7 +233,7 @@ public abstract class AbstractTests {
         String password = "bob";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -242,7 +253,7 @@ public abstract class AbstractTests {
         String password = "bob";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -262,7 +273,7 @@ public abstract class AbstractTests {
         String password = "det";
 
         final String bodyTextContent =
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
 
         Assert.assertTrue("Principal not " + user,
                           bodyTextContent.contains("userPrincipal=" + user));
@@ -292,7 +303,7 @@ public abstract class AbstractTests {
         String password = "det";
 
         try {
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
             Assert.fail("Exception expected");
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 403);
@@ -307,7 +318,7 @@ public abstract class AbstractTests {
         String password = "det";
 
         try {
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
             Assert.fail("Exception expected");
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 403);
@@ -322,7 +333,7 @@ public abstract class AbstractTests {
         String password = "det";
 
         try {
-            HTTPTestUtils.login(url, user, password, getIdpHttpsPort());
+            HTTPTestUtils.login(url, user, password, getIdpHttpsPort(), 
getLoginFormName());
             Assert.fail("Exception expected");
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 403);
@@ -331,6 +342,11 @@ public abstract class AbstractTests {
 
     @Test
     public void testRPMetadata() throws Exception {
+
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort()
             + "/" + getServletContextName() + 
"/FederationMetadata/2007-06/FederationMetadata.xml";
 
@@ -365,6 +381,10 @@ public abstract class AbstractTests {
     @Test
     public void testRPLogout() throws Exception {
 
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName()
             + "/secure/fedservlet";
         String user = "alice";
@@ -408,6 +428,10 @@ public abstract class AbstractTests {
     @Test
     public void testRPLogoutViaAction() throws Exception {
 
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName()
             + "/secure/fedservlet";
         String user = "alice";
@@ -451,6 +475,10 @@ public abstract class AbstractTests {
     @Test
     public void testIdPLogout() throws Exception {
 
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName()
             + "/secure/fedservlet";
         String user = "alice";
@@ -494,6 +522,10 @@ public abstract class AbstractTests {
     @Test
     public void testIdPLogoutCleanup() throws Exception {
 
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName()
             + "/secure/fedservlet";
         String user = "alice";
@@ -536,6 +568,11 @@ public abstract class AbstractTests {
 
     @Test
     public void testAliceModifiedSignature() throws Exception {
+
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName()
             + "/secure/fedservlet";
         String user = "alice";
@@ -608,7 +645,7 @@ public abstract class AbstractTests {
         Assert.assertEquals("IDP SignIn Response Form", 
idpPage2.getTitleText());
 
         // Invoke back on the page1 RP
-        final HtmlForm form = idpPage1.getFormByName("signinresponseform");
+        final HtmlForm form = idpPage1.getFormByName(getLoginFormName());
         final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
         final HtmlPage rpPage1 = button.click();
         Assert.assertTrue("WS Federation Systests 
Examples".equals(rpPage1.getTitleText())
@@ -620,7 +657,7 @@ public abstract class AbstractTests {
                           bodyTextContent1.contains("userPrincipal=" + user));
 
         // Invoke back on the page2 RP
-        final HtmlForm form2 = idpPage2.getFormByName("signinresponseform");
+        final HtmlForm form2 = idpPage2.getFormByName(getLoginFormName());
         final HtmlSubmitInput button2 = 
form2.getInputByName("_eventId_submit");
         final HtmlPage rpPage2 = button2.click();
         String bodyTextContent2 = rpPage2.getBody().getTextContent();
@@ -632,6 +669,10 @@ public abstract class AbstractTests {
 
     @org.junit.Test
     public void testMaliciousRedirect() throws Exception {
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName() + "/secure/fedservlet";
         String user = "alice";
         String password = "ecila";
@@ -678,6 +719,11 @@ public abstract class AbstractTests {
 
     @Test
     public void testEntityExpansionAttack() throws Exception {
+
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName() + "/secure/fedservlet";
         String user = "alice";
         String password = "ecila";
@@ -730,6 +776,10 @@ public abstract class AbstractTests {
 
     @Test
     public void testEntityExpansionAttack2() throws Exception {
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName() + "/secure/fedservlet";
         String user = "alice";
         String password = "ecila";
@@ -783,6 +833,11 @@ public abstract class AbstractTests {
 
     @org.junit.Test
     public void testCSRFAttack() throws Exception {
+
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName() + "/secure/fedservlet";
         csrfAttackTest(url);
     }
@@ -854,6 +909,10 @@ public abstract class AbstractTests {
 
     @org.junit.Test
     public void testCSRFAttack2() throws Exception {
+        if (!isWSFederation()) {
+            return;
+        }
+
         String url = "https://localhost:"; + getRpHttpsPort() + "/" + 
getServletContextName() + "/secure/fedservlet";
         csrfAttackTest2(url);
     }
diff --git 
a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
 
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
index f5a530d..b2305c9 100644
--- 
a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
+++ 
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
@@ -42,7 +42,8 @@ public final class HTTPTestUtils {
         // complete
     }
 
-    public static String login(String url, String user, String password, 
String idpPort) throws IOException {
+    public static String login(String url, String user, String password, 
String idpPort,
+                               String formName) throws IOException {
         final WebClient webClient = new WebClient();
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getCredentialsProvider().setCredentials(
@@ -54,7 +55,7 @@ public final class HTTPTestUtils {
         webClient.getOptions().setJavaScriptEnabled(true);
         Assert.assertEquals("IDP SignIn Response Form", 
idpPage.getTitleText());
 
-        final HtmlForm form = idpPage.getFormByName("signinresponseform");
+        final HtmlForm form = idpPage.getFormByName(formName);
         final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
 
         final HtmlPage rpPage = button.click();
@@ -65,20 +66,6 @@ public final class HTTPTestUtils {
         return rpPage.getBody().getTextContent();
     }
 
-    public static String loginForSAMLSSO(String url, String user, String 
password, String idpPort) throws IOException {
-        final WebClient webClient = new WebClient();
-        webClient.getOptions().setUseInsecureSSL(true);
-        webClient.getCredentialsProvider().setCredentials(
-            new AuthScope("localhost", Integer.parseInt(idpPort)),
-            new UsernamePasswordCredentials(user, password));
-
-        webClient.getOptions().setJavaScriptEnabled(false);
-        final HtmlPage rpPage = webClient.getPage(url);
-
-        // webClient.close();
-        return rpPage.getBody().getTextContent();
-    }
-
     public static String loginWithCookieManager(String url, String user, 
String password,
                                                 String idpPort, CookieManager 
cookieManager) throws IOException {
         final WebClient webClient = new WebClient();

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to