http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
deleted file mode 100644
index 7bea676..0000000
--- 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.fediz.integrationtests;
-
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
-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.tomcat8.FederationAuthenticator;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-
-/**
- * A test for sending a TokenType request to the IdP via the "wreq" parameter.
- */
-public class WReqTest {
-
-    static String idpHttpsPort;
-    static String rpHttpsPort;
-
-    private static Tomcat idpServer;
-    private static Tomcat rpServer;
-
-    @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");
-        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
-
-        idpServer = startServer(true, idpHttpsPort);
-        rpServer = startServer(false, rpHttpsPort);
-    }
-
-    private static Tomcat startServer(boolean idp, String port)
-        throws ServletException, LifecycleException, IOException {
-        Tomcat server = new Tomcat();
-        server.setPort(0);
-        String currentDir = new File(".").getCanonicalPath();
-        String baseDir = currentDir + File.separator + "target";
-        server.setBaseDir(baseDir);
-
-        if (idp) {
-            server.getHost().setAppBase("tomcat/idp/webapps");
-        } else {
-            server.getHost().setAppBase("tomcat/rp/webapps");
-        }
-        server.getHost().setAutoDeploy(true);
-        server.getHost().setDeployOnStartup(true);
-
-        Connector httpsConnector = new Connector();
-        httpsConnector.setPort(Integer.parseInt(port));
-        httpsConnector.setSecure(true);
-        httpsConnector.setScheme("https");
-        //httpsConnector.setAttribute("keyAlias", keyAlias);
-        httpsConnector.setAttribute("keystorePass", "tompass");
-        httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
-        httpsConnector.setAttribute("truststorePass", "tompass");
-        httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
-        httpsConnector.setAttribute("clientAuth", "want");
-        // httpsConnector.setAttribute("clientAuth", "false");
-        httpsConnector.setAttribute("sslProtocol", "TLS");
-        httpsConnector.setAttribute("SSLEnabled", true);
-
-        server.getService().addConnector(httpsConnector);
-
-        if (idp) {
-            File stsWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp-sts");
-            server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
-
-            File idpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp");
-            server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
-        } else {
-            File rpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "simpleWebapp");
-            Context cxt = server.addWebapp("/fedizhelloworld", 
rpWebapp.getAbsolutePath());
-
-            // Substitute the IDP port. Necessary if running the test in 
eclipse where port filtering doesn't seem
-            // to work
-            File f = new File(currentDir + 
"/src/test/resources/fediz_config_wreq.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
-            if (content.contains("idp.https.port")) {
-                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + 
idpHttpsPort);
-
-                File f2 = new File(baseDir + 
"/test-classes/fediz_config_wreq.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) 
{
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
-            }
-
-            FederationAuthenticator fa = new FederationAuthenticator();
-            fa.setConfigFile(currentDir + File.separator + "target" + 
File.separator
-                             + "test-classes" + File.separator + 
"fediz_config_wreq.xml");
-            cxt.getPipeline().addValve(fa);
-        }
-
-        server.start();
-
-        return server;
-    }
-
-    @AfterClass
-    public static void cleanup() {
-        shutdownServer(idpServer);
-        shutdownServer(rpServer);
-    }
-
-    private static void shutdownServer(Tomcat server) {
-        try {
-            if (server != null && server.getServer() != null
-                && server.getServer().getState() != LifecycleState.DESTROYED) {
-                if (server.getServer().getState() != LifecycleState.STOPPED) {
-                    server.stop();
-                }
-                server.destroy();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public String getIdpHttpsPort() {
-        return idpHttpsPort;
-    }
-
-    public String getRpHttpsPort() {
-        return rpHttpsPort;
-    }
-
-    public String getServletContextName() {
-        return "fedizhelloworld";
-    }
-
-    @org.junit.Test
-    public void testSAML1TokenViaWReq() throws Exception {
-        String url = "https://localhost:"; + getRpHttpsPort() + 
"/fedizhelloworld/secure/fedservlet";
-        String user = "alice";
-        String password = "ecila";
-
-        final String bodyTextContent = 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]"));
-
-    }
-
-    private static String login(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 idpPage = webClient.getPage(url);
-        webClient.getOptions().setJavaScriptEnabled(true);
-        Assert.assertEquals("IDP SignIn Response Form", 
idpPage.getTitleText());
-
-        // Test the SAML Version here
-        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.assertTrue(wresult != null
-            && wresult.contains("urn:oasis:names:tc:SAML:1.0:cm:bearer"));
-
-        final HtmlForm form = idpPage.getFormByName("signinresponseform");
-        final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
-
-        final HtmlPage rpPage = button.click();
-        Assert.assertEquals("WS Federation Systests Examples", 
rpPage.getTitleText());
-
-        webClient.close();
-        return rpPage.getBody().getTextContent();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/AudienceRestrictionTest.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/AudienceRestrictionTest.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/AudienceRestrictionTest.java
new file mode 100644
index 0000000..461f3dd
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/AudienceRestrictionTest.java
@@ -0,0 +1,210 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+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.tomcat8.FederationAuthenticator;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * A test to make sure that audience restriction validation is working 
correctly in the plugin.
+ */
+public class AudienceRestrictionTest {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+
+    private static Tomcat idpServer;
+    private static Tomcat rpServer;
+
+    @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");
+        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+
+        idpServer = startServer(true, idpHttpsPort);
+        rpServer = startServer(false, rpHttpsPort);
+    }
+
+    private static Tomcat startServer(boolean idp, String port)
+        throws ServletException, LifecycleException, IOException {
+        Tomcat server = new Tomcat();
+        server.setPort(0);
+        String currentDir = new File(".").getCanonicalPath();
+        String baseDir = currentDir + File.separator + "target";
+        server.setBaseDir(baseDir);
+
+        if (idp) {
+            server.getHost().setAppBase("tomcat/idp/webapps");
+        } else {
+            server.getHost().setAppBase("tomcat/rp/webapps");
+        }
+        server.getHost().setAutoDeploy(true);
+        server.getHost().setDeployOnStartup(true);
+
+        Connector httpsConnector = new Connector();
+        httpsConnector.setPort(Integer.parseInt(port));
+        httpsConnector.setSecure(true);
+        httpsConnector.setScheme("https");
+        //httpsConnector.setAttribute("keyAlias", keyAlias);
+        httpsConnector.setAttribute("keystorePass", "tompass");
+        httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+        httpsConnector.setAttribute("truststorePass", "tompass");
+        httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
+        httpsConnector.setAttribute("clientAuth", "want");
+        // httpsConnector.setAttribute("clientAuth", "false");
+        httpsConnector.setAttribute("sslProtocol", "TLS");
+        httpsConnector.setAttribute("SSLEnabled", true);
+
+        server.getService().addConnector(httpsConnector);
+
+        if (idp) {
+            File stsWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp-sts");
+            server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+            File idpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp");
+            server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+        } else {
+            File rpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "simpleWebapp");
+            Context cxt = server.addWebapp("/fedizhelloworld", 
rpWebapp.getAbsolutePath());
+
+            // Substitute the IDP port. Necessary if running the test in 
eclipse where port filtering doesn't seem
+            // to work
+            File f = new File(currentDir + 
"/src/test/resources/fediz_config_aud_restr.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + 
idpHttpsPort);
+
+                File f2 = new File(baseDir + 
"/test-classes/fediz_config_aud_restr.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) 
{
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+
+            FederationAuthenticator fa = new FederationAuthenticator();
+            fa.setConfigFile(currentDir + File.separator + "target" + 
File.separator
+                             + "test-classes" + File.separator + 
"fediz_config_aud_restr.xml");
+            cxt.getPipeline().addValve(fa);
+        }
+
+        server.start();
+
+        return server;
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        shutdownServer(idpServer);
+        shutdownServer(rpServer);
+    }
+
+    private static void shutdownServer(Tomcat server) {
+        try {
+            if (server != null && server.getServer() != null
+                && server.getServer().getState() != LifecycleState.DESTROYED) {
+                if (server.getServer().getState() != LifecycleState.STOPPED) {
+                    server.stop();
+                }
+                server.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+
+    @org.junit.Test
+    public void testSAMLTokenWithNonMatchingAudienceRestriction() throws 
Exception {
+        String url = "https://localhost:"; + getRpHttpsPort() + 
"/fedizhelloworld/secure/fedservlet";
+        String user = "alice";
+        String password = "ecila";
+
+        final 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);
+        final HtmlPage idpPage = webClient.getPage(url);
+        webClient.getOptions().setJavaScriptEnabled(true);
+        Assert.assertEquals("IDP SignIn Response Form", 
idpPage.getTitleText());
+
+        final HtmlForm form = idpPage.getFormByName("signinresponseform");
+        final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
+
+        try {
+            button.click();
+            Assert.fail("Failure expected on a bad audience restriction 
value");
+        } catch (FailingHttpStatusCodeException ex) {
+            Assert.assertEquals(ex.getStatusCode(), 401);
+        }
+
+        webClient.close();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/ClientCertificateTest.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/ClientCertificateTest.java
new file mode 100644
index 0000000..3082317
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/ClientCertificateTest.java
@@ -0,0 +1,173 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+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.systests.common.AbstractClientCertTests;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * In this test-case, the IdP is set up to require client authentication, 
rather than authenticating using a
+ * username + password, or via Kerberos.
+ */
+public class ClientCertificateTest extends AbstractClientCertTests {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+
+    private static Tomcat idpServer;
+    private static Tomcat rpServer;
+
+    @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");
+        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+
+        idpServer = startServer(true, idpHttpsPort);
+        rpServer = startServer(false, rpHttpsPort);
+    }
+
+    private static Tomcat startServer(boolean idp, String port)
+        throws ServletException, LifecycleException, IOException {
+        Tomcat server = new Tomcat();
+        server.setPort(0);
+        String currentDir = new File(".").getCanonicalPath();
+        String baseDir = currentDir + File.separator + "target";
+        server.setBaseDir(baseDir);
+
+        if (idp) {
+            server.getHost().setAppBase("tomcat/idp/webapps");
+        } else {
+            server.getHost().setAppBase("tomcat/rp/webapps");
+        }
+        server.getHost().setAutoDeploy(true);
+        server.getHost().setDeployOnStartup(true);
+
+        Connector httpsConnector = new Connector();
+        httpsConnector.setPort(Integer.parseInt(port));
+        httpsConnector.setSecure(true);
+        httpsConnector.setScheme("https");
+        //httpsConnector.setAttribute("keyAlias", keyAlias);
+        httpsConnector.setAttribute("keystorePass", "tompass");
+        httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+        httpsConnector.setAttribute("truststorePass", "tompass");
+        httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
+        httpsConnector.setAttribute("clientAuth", "want");
+        // httpsConnector.setAttribute("clientAuth", "false");
+        httpsConnector.setAttribute("sslProtocol", "TLS");
+        httpsConnector.setAttribute("SSLEnabled", true);
+
+        server.getService().addConnector(httpsConnector);
+
+        if (idp) {
+            File stsWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp-sts");
+            server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+            File idpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp");
+            server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+        } else {
+            File rpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "simpleWebapp");
+            Context cxt = server.addWebapp("/fedizhelloworld", 
rpWebapp.getAbsolutePath());
+
+            // Substitute the IDP port. Necessary if running the test in 
eclipse where port filtering doesn't seem
+            // to work
+            File f = new File(currentDir + 
"/src/test/resources/fediz_config_client_cert.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + 
idpHttpsPort);
+
+                File f2 = new File(baseDir + 
"/test-classes/fediz_config_client_cert.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) 
{
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+
+            FederationAuthenticator fa = new FederationAuthenticator();
+            fa.setConfigFile(currentDir + File.separator + "target" + 
File.separator
+                             + "test-classes" + File.separator + 
"fediz_config_client_cert.xml");
+            cxt.getPipeline().addValve(fa);
+        }
+
+        server.start();
+
+        return server;
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        shutdownServer(idpServer);
+        shutdownServer(rpServer);
+    }
+
+    private static void shutdownServer(Tomcat server) {
+        try {
+            if (server != null && server.getServer() != null
+                && server.getServer().getState() != LifecycleState.DESTROYED) {
+                if (server.getServer().getState() != LifecycleState.STOPPED) {
+                    server.stop();
+                }
+                server.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HOKCallbackHandler.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HOKCallbackHandler.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HOKCallbackHandler.java
new file mode 100644
index 0000000..d413dd1
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HOKCallbackHandler.java
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.cxf.fediz.core.spi.WReqCallback;
+
+public class HOKCallbackHandler implements CallbackHandler {
+
+    static final String HOK_WREQ =
+        "<RequestSecurityToken 
xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\";>"
+        + 
"<KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</KeyType>"
+        + "</RequestSecurityToken>";
+
+    public void handle(Callback[] callbacks) throws IOException, 
UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof WReqCallback) {
+                WReqCallback callback = (WReqCallback) callbacks[i];
+                callback.setWreq(HOK_WREQ);
+            } else {
+                throw new UnsupportedCallbackException(callbacks[i], 
"Unrecognized Callback");
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HolderOfKeyTest.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HolderOfKeyTest.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HolderOfKeyTest.java
new file mode 100644
index 0000000..f61d430
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/HolderOfKeyTest.java
@@ -0,0 +1,244 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+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.tomcat8.FederationAuthenticator;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * A test for sending a "PublicKey" KeyType request to the IdP via the "wreq" 
parameter. This
+ * will cause the IdP/STS to issue a "HolderOfKey" SAML Assertion.
+ */
+public class HolderOfKeyTest {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+
+    private static Tomcat idpServer;
+    private static Tomcat rpServer;
+
+    @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");
+        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+
+        idpServer = startServer(true, idpHttpsPort);
+        rpServer = startServer(false, rpHttpsPort);
+    }
+
+    private static Tomcat startServer(boolean idp, String port)
+        throws ServletException, LifecycleException, IOException {
+        Tomcat server = new Tomcat();
+        server.setPort(0);
+        String currentDir = new File(".").getCanonicalPath();
+        String baseDir = currentDir + File.separator + "target";
+        server.setBaseDir(baseDir);
+
+        if (idp) {
+            server.getHost().setAppBase("tomcat/idp/webapps");
+        } else {
+            server.getHost().setAppBase("tomcat/rp/webapps");
+        }
+        server.getHost().setAutoDeploy(true);
+        server.getHost().setDeployOnStartup(true);
+
+        Connector httpsConnector = new Connector();
+        httpsConnector.setPort(Integer.parseInt(port));
+        httpsConnector.setSecure(true);
+        httpsConnector.setScheme("https");
+        //httpsConnector.setAttribute("keyAlias", keyAlias);
+        httpsConnector.setAttribute("keystorePass", "tompass");
+        httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+        httpsConnector.setAttribute("truststorePass", "tompass");
+        httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
+        httpsConnector.setAttribute("clientAuth", "want");
+        // httpsConnector.setAttribute("clientAuth", "false");
+        httpsConnector.setAttribute("sslProtocol", "TLS");
+        httpsConnector.setAttribute("SSLEnabled", true);
+
+        server.getService().addConnector(httpsConnector);
+
+        if (idp) {
+            File stsWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp-sts");
+            server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+            File idpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp");
+            server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+        } else {
+            File rpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "simpleWebapp");
+            Context cxt = server.addWebapp("/fedizhelloworld", 
rpWebapp.getAbsolutePath());
+
+            // Substitute the IDP port. Necessary if running the test in 
eclipse where port filtering doesn't seem
+            // to work
+            File f = new File(currentDir + 
"/src/test/resources/fediz_config_hok.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + 
idpHttpsPort);
+
+                File f2 = new File(baseDir + 
"/test-classes/fediz_config_hok.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) 
{
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+
+            FederationAuthenticator fa = new FederationAuthenticator();
+            fa.setConfigFile(currentDir + File.separator + "target" + 
File.separator
+                             + "test-classes" + File.separator + 
"fediz_config_hok.xml");
+            cxt.getPipeline().addValve(fa);
+        }
+
+        server.start();
+
+        return server;
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        shutdownServer(idpServer);
+        shutdownServer(rpServer);
+    }
+
+    private static void shutdownServer(Tomcat server) {
+        try {
+            if (server != null && server.getServer() != null
+                && server.getServer().getState() != LifecycleState.DESTROYED) {
+                if (server.getServer().getState() != LifecycleState.STOPPED) {
+                    server.stop();
+                }
+                server.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+
+    @org.junit.Test
+    public void testHolderOfKey() throws Exception {
+        String url = "https://localhost:"; + getRpHttpsPort() + 
"/fedizhelloworld/secure/fedservlet";
+        String user = "alice";
+        String password = "ecila";
+
+        final WebClient webClient = new WebClient();
+        webClient.getOptions().setUseInsecureSSL(true);
+        webClient.getOptions().setSSLClientCertificate(
+            this.getClass().getClassLoader().getResource("client.jks"), 
"storepass", "jks");
+        webClient.getCredentialsProvider().setCredentials(
+            new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
+            new UsernamePasswordCredentials(user, password));
+
+        webClient.getOptions().setJavaScriptEnabled(false);
+        final HtmlPage idpPage = webClient.getPage(url);
+        webClient.getOptions().setJavaScriptEnabled(true);
+        Assert.assertEquals("IDP SignIn Response Form", 
idpPage.getTitleText());
+
+        final HtmlForm form = idpPage.getFormByName("signinresponseform");
+        final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
+
+        // Test the Subject Confirmation method here
+        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.assertTrue(wresult != null
+            && 
wresult.contains("urn:oasis:names:tc:SAML:2.0:cm:holder-of-key"));
+
+
+        final HtmlPage rpPage = button.click();
+        Assert.assertEquals("WS Federation Systests Examples", 
rpPage.getTitleText());
+
+        final String bodyTextContent = rpPage.getBody().getTextContent();
+        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]"));
+
+        webClient.close();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TestCallbackHandler.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TestCallbackHandler.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TestCallbackHandler.java
new file mode 100644
index 0000000..b104d66
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TestCallbackHandler.java
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.cxf.fediz.core.spi.WReqCallback;
+
+public class TestCallbackHandler implements CallbackHandler {
+
+    static final String TEST_WREQ =
+        "<RequestSecurityToken 
xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\";>"
+        + 
"<TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</TokenType>"
+        + "</RequestSecurityToken>";
+
+    public void handle(Callback[] callbacks) throws IOException, 
UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof WReqCallback) {
+                WReqCallback callback = (WReqCallback) callbacks[i];
+                callback.setWreq(TEST_WREQ);
+            } else {
+                throw new UnsupportedCallbackException(callbacks[i], 
"Unrecognized Callback");
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TomcatTest.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TomcatTest.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TomcatTest.java
new file mode 100644
index 0000000..bd8365d
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/TomcatTest.java
@@ -0,0 +1,173 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+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.systests.common.AbstractTests;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+public class TomcatTest extends AbstractTests {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+
+    private static Tomcat idpServer;
+    private static Tomcat rpServer;
+
+    @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");
+        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+
+        idpServer = startServer(true, idpHttpsPort);
+        rpServer = startServer(false, rpHttpsPort);
+    }
+
+    private static Tomcat startServer(boolean idp, String port)
+        throws ServletException, LifecycleException, IOException {
+        Tomcat server = new Tomcat();
+        server.setPort(0);
+        String currentDir = new File(".").getCanonicalPath();
+        String baseDir = currentDir + File.separator + "target";
+        server.setBaseDir(baseDir);
+
+        if (idp) {
+            server.getHost().setAppBase("tomcat/idp/webapps");
+        } else {
+            server.getHost().setAppBase("tomcat/rp/webapps");
+        }
+        server.getHost().setAutoDeploy(true);
+        server.getHost().setDeployOnStartup(true);
+
+        Connector httpsConnector = new Connector();
+        httpsConnector.setPort(Integer.parseInt(port));
+        httpsConnector.setSecure(true);
+        httpsConnector.setScheme("https");
+        //httpsConnector.setAttribute("keyAlias", keyAlias);
+        httpsConnector.setAttribute("keystorePass", "tompass");
+        httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+        httpsConnector.setAttribute("truststorePass", "tompass");
+        httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
+        httpsConnector.setAttribute("clientAuth", "want");
+        // httpsConnector.setAttribute("clientAuth", "false");
+        httpsConnector.setAttribute("sslProtocol", "TLS");
+        httpsConnector.setAttribute("SSLEnabled", true);
+
+        server.getService().addConnector(httpsConnector);
+
+        if (idp) {
+            File stsWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp-sts");
+            server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+            File idpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp");
+            server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+        } else {
+            File rpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "simpleWebapp");
+            Context cxt = server.addWebapp("/fedizhelloworld", 
rpWebapp.getAbsolutePath());
+
+            // Substitute the IDP port. Necessary if running the test in 
eclipse where port filtering doesn't seem
+            // to work
+            File f = new File(currentDir + 
"/src/test/resources/fediz_config.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + 
idpHttpsPort);
+
+                File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) 
{
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+
+            FederationAuthenticator fa = new FederationAuthenticator();
+            fa.setConfigFile(currentDir + File.separator + "target" + 
File.separator
+                             + "test-classes" + File.separator + 
"fediz_config.xml");
+            cxt.getPipeline().addValve(fa);
+        }
+
+        server.start();
+
+        return server;
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        shutdownServer(idpServer);
+        shutdownServer(rpServer);
+    }
+
+    private static void shutdownServer(Tomcat server) {
+        try {
+            if (server != null && server.getServer() != null
+                && server.getServer().getState() != LifecycleState.DESTROYED) {
+                if (server.getServer().getState() != LifecycleState.STOPPED) {
+                    server.stop();
+                }
+                server.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    @Override
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+
+    @Override
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/WReqTest.java
----------------------------------------------------------------------
diff --git 
a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/WReqTest.java
 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/WReqTest.java
new file mode 100644
index 0000000..b1fd44a
--- /dev/null
+++ 
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/systests/tomcat8/WReqTest.java
@@ -0,0 +1,246 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.tomcat8;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+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.tomcat8.FederationAuthenticator;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * A test for sending a TokenType request to the IdP via the "wreq" parameter.
+ */
+public class WReqTest {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+
+    private static Tomcat idpServer;
+    private static Tomcat rpServer;
+
+    @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");
+        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+
+        idpServer = startServer(true, idpHttpsPort);
+        rpServer = startServer(false, rpHttpsPort);
+    }
+
+    private static Tomcat startServer(boolean idp, String port)
+        throws ServletException, LifecycleException, IOException {
+        Tomcat server = new Tomcat();
+        server.setPort(0);
+        String currentDir = new File(".").getCanonicalPath();
+        String baseDir = currentDir + File.separator + "target";
+        server.setBaseDir(baseDir);
+
+        if (idp) {
+            server.getHost().setAppBase("tomcat/idp/webapps");
+        } else {
+            server.getHost().setAppBase("tomcat/rp/webapps");
+        }
+        server.getHost().setAutoDeploy(true);
+        server.getHost().setDeployOnStartup(true);
+
+        Connector httpsConnector = new Connector();
+        httpsConnector.setPort(Integer.parseInt(port));
+        httpsConnector.setSecure(true);
+        httpsConnector.setScheme("https");
+        //httpsConnector.setAttribute("keyAlias", keyAlias);
+        httpsConnector.setAttribute("keystorePass", "tompass");
+        httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+        httpsConnector.setAttribute("truststorePass", "tompass");
+        httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
+        httpsConnector.setAttribute("clientAuth", "want");
+        // httpsConnector.setAttribute("clientAuth", "false");
+        httpsConnector.setAttribute("sslProtocol", "TLS");
+        httpsConnector.setAttribute("SSLEnabled", true);
+
+        server.getService().addConnector(httpsConnector);
+
+        if (idp) {
+            File stsWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp-sts");
+            server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+            File idpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "fediz-idp");
+            server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+        } else {
+            File rpWebapp = new File(baseDir + File.separator + 
server.getHost().getAppBase(), "simpleWebapp");
+            Context cxt = server.addWebapp("/fedizhelloworld", 
rpWebapp.getAbsolutePath());
+
+            // Substitute the IDP port. Necessary if running the test in 
eclipse where port filtering doesn't seem
+            // to work
+            File f = new File(currentDir + 
"/src/test/resources/fediz_config_wreq.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + 
idpHttpsPort);
+
+                File f2 = new File(baseDir + 
"/test-classes/fediz_config_wreq.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) 
{
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+
+            FederationAuthenticator fa = new FederationAuthenticator();
+            fa.setConfigFile(currentDir + File.separator + "target" + 
File.separator
+                             + "test-classes" + File.separator + 
"fediz_config_wreq.xml");
+            cxt.getPipeline().addValve(fa);
+        }
+
+        server.start();
+
+        return server;
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        shutdownServer(idpServer);
+        shutdownServer(rpServer);
+    }
+
+    private static void shutdownServer(Tomcat server) {
+        try {
+            if (server != null && server.getServer() != null
+                && server.getServer().getState() != LifecycleState.DESTROYED) {
+                if (server.getServer().getState() != LifecycleState.STOPPED) {
+                    server.stop();
+                }
+                server.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+
+    @org.junit.Test
+    public void testSAML1TokenViaWReq() throws Exception {
+        String url = "https://localhost:"; + getRpHttpsPort() + 
"/fedizhelloworld/secure/fedservlet";
+        String user = "alice";
+        String password = "ecila";
+
+        final String bodyTextContent = 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]"));
+
+    }
+
+    private static String login(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 idpPage = webClient.getPage(url);
+        webClient.getOptions().setJavaScriptEnabled(true);
+        Assert.assertEquals("IDP SignIn Response Form", 
idpPage.getTitleText());
+
+        // Test the SAML Version here
+        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.assertTrue(wresult != null
+            && wresult.contains("urn:oasis:names:tc:SAML:1.0:cm:bearer"));
+
+        final HtmlForm form = idpPage.getFormByName("signinresponseform");
+        final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
+
+        final HtmlPage rpPage = button.click();
+        Assert.assertEquals("WS Federation Systests Examples", 
rpPage.getTitleText());
+
+        webClient.close();
+        return rpPage.getBody().getTextContent();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/resources/fediz_config_client_cert.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/resources/fediz_config_client_cert.xml 
b/systests/tomcat8/src/test/resources/fediz_config_client_cert.xml
index 365836a..ee52aa7 100644
--- a/systests/tomcat8/src/test/resources/fediz_config_client_cert.xml
+++ b/systests/tomcat8/src/test/resources/fediz_config_client_cert.xml
@@ -54,7 +54,7 @@
                                <claimType 
type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"; 
optional="true" />
             </claimTypesRequested>
             
<authenticationType>http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/Ssl</authenticationType>
-            <request 
type="Class">org.apache.cxf.fediz.integrationtests.HOKCallbackHandler</request>
+            <request 
type="Class">org.apache.cxf.fediz.systests.tomcat8.HOKCallbackHandler</request>
         </protocol>
         <logoutURL>/secure/logout</logoutURL>
         <logoutRedirectTo>/index.html</logoutRedirectTo>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/resources/fediz_config_hok.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/resources/fediz_config_hok.xml 
b/systests/tomcat8/src/test/resources/fediz_config_hok.xml
index cd4ad95..dfd162d 100644
--- a/systests/tomcat8/src/test/resources/fediz_config_hok.xml
+++ b/systests/tomcat8/src/test/resources/fediz_config_hok.xml
@@ -48,7 +48,7 @@
                 <claimType type="a particular claim type"
                            optional="true" />
             </claimTypesRequested>
-            <request 
type="Class">org.apache.cxf.fediz.integrationtests.HOKCallbackHandler</request>
+            <request 
type="Class">org.apache.cxf.fediz.systests.tomcat8.HOKCallbackHandler</request>
         </protocol>
         <logoutURL>/secure/logout</logoutURL>
         <logoutRedirectTo>/index.html</logoutRedirectTo>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/tomcat8/src/test/resources/fediz_config_wreq.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/resources/fediz_config_wreq.xml 
b/systests/tomcat8/src/test/resources/fediz_config_wreq.xml
index 2612d98..7c0ea01 100644
--- a/systests/tomcat8/src/test/resources/fediz_config_wreq.xml
+++ b/systests/tomcat8/src/test/resources/fediz_config_wreq.xml
@@ -48,7 +48,7 @@
                 <claimType type="a particular claim type"
                            optional="true" />
             </claimTypesRequested>
-            <request 
type="Class">org.apache.cxf.fediz.integrationtests.TestCallbackHandler</request>
+            <request 
type="Class">org.apache.cxf.fediz.systests.tomcat8.TestCallbackHandler</request>
         </protocol>
         <logoutURL>/secure/logout</logoutURL>
         <logoutRedirectTo>/index.html</logoutRedirectTo>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/websphere/pom.xml
----------------------------------------------------------------------
diff --git a/systests/websphere/pom.xml b/systests/websphere/pom.xml
index c3e31c2..3fa208a 100644
--- a/systests/websphere/pom.xml
+++ b/systests/websphere/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.cxf.fediz</groupId>
         <artifactId>fediz-systests</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>2.0.0-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <groupId>org.apache.cxf.fediz.systests</groupId>
@@ -214,7 +214,7 @@
                                 
<java.util.logging.config.file>${basedir}/target/test-classes/logging.properties</java.util.logging.config.file>
                             </systemPropertyVariables>
                             <includes>
-                                <include>**/integrationtests/**</include>
+                                <include>**/systests/**</include>
                             </includes>
                             <!-- <argLine>-Xms512m -Xmx1024m 
-XX:MaxPermSize=256m </argLine> -->
                             <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=256m 
-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,suspend=y</argLine>
@@ -229,16 +229,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <inherited>true</inherited>
-                <configuration>
-                    <excludes>
-                        <exclude>**/integrationtests/**</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/websphere/src/test/java/org/apache/cxf/fediz/integrationtests/WebsphereTest.java
----------------------------------------------------------------------
diff --git 
a/systests/websphere/src/test/java/org/apache/cxf/fediz/integrationtests/WebsphereTest.java
 
b/systests/websphere/src/test/java/org/apache/cxf/fediz/integrationtests/WebsphereTest.java
deleted file mode 100644
index 88a3f7b..0000000
--- 
a/systests/websphere/src/test/java/org/apache/cxf/fediz/integrationtests/WebsphereTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.cxf.fediz.integrationtests;
-
-import java.io.File;
-
-import org.apache.catalina.LifecycleState;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-public class WebsphereTest extends AbstractTests {
-
-    static String idpHttpsPort;
-    static String rpHttpsPort;
-
-    private static Tomcat idpServer;
-    private static Tomcat rpServer;
-
-    @BeforeClass
-    public static void init() {
-        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");
-        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
-
-        initIdp();
-    }
-
-    private static void initIdp() {
-        try {
-            idpServer = new Tomcat();
-            idpServer.setPort(0);
-            String currentDir = new File(".").getCanonicalPath();
-            idpServer.setBaseDir(currentDir + File.separator + "target");
-
-            idpServer.getHost().setAppBase("tomcat/idp/webapps");
-            idpServer.getHost().setAutoDeploy(true);
-            idpServer.getHost().setDeployOnStartup(true);
-
-            Connector httpsConnector = new Connector();
-            httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
-            httpsConnector.setSecure(true);
-            httpsConnector.setScheme("https");
-            // httpsConnector.setAttribute("keyAlias", keyAlias);
-            httpsConnector.setAttribute("keystorePass", "tompass");
-            httpsConnector.setAttribute("keystoreFile", 
"test-classes/server.jks");
-            httpsConnector.setAttribute("truststorePass", "tompass");
-            httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
-            httpsConnector.setAttribute("clientAuth", "want");
-            // httpsConnector.setAttribute("clientAuth", "false");
-            httpsConnector.setAttribute("sslProtocol", "TLS");
-            httpsConnector.setAttribute("SSLEnabled", true);
-
-            idpServer.getService().addConnector(httpsConnector);
-
-            idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
-            idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
-            idpServer.start();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    @AfterClass
-    public static void cleanup() {
-        try {
-            if (idpServer.getServer() != null && 
idpServer.getServer().getState() != LifecycleState.DESTROYED) {
-                if (idpServer.getServer().getState() != 
LifecycleState.STOPPED) {
-                    idpServer.stop();
-                }
-                idpServer.destroy();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        try {
-            if (rpServer.getServer() != null && 
rpServer.getServer().getState() != LifecycleState.DESTROYED) {
-                if (rpServer.getServer().getState() != LifecycleState.STOPPED) 
{
-                    rpServer.stop();
-                }
-                rpServer.destroy();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Ignored because of missing test environment.
-     */
-    @Override
-    @Ignore
-    public void testRPMetadata() throws Exception {
-
-    }
-
-    @Override
-    public String getIdpHttpsPort() {
-        return idpHttpsPort;
-    }
-
-    @Override
-    public String getRpHttpsPort() {
-        return rpHttpsPort;
-    }
-
-    @Override
-    public String getServletContextName() {
-        return "fedizhelloworld";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/cc76fc31/systests/websphere/src/test/java/org/apache/cxf/fediz/systests/websphere/WebsphereTest.java
----------------------------------------------------------------------
diff --git 
a/systests/websphere/src/test/java/org/apache/cxf/fediz/systests/websphere/WebsphereTest.java
 
b/systests/websphere/src/test/java/org/apache/cxf/fediz/systests/websphere/WebsphereTest.java
new file mode 100644
index 0000000..8101641
--- /dev/null
+++ 
b/systests/websphere/src/test/java/org/apache/cxf/fediz/systests/websphere/WebsphereTest.java
@@ -0,0 +1,145 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.fediz.systests.websphere;
+
+import java.io.File;
+
+import org.apache.catalina.LifecycleState;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Tomcat;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+public class WebsphereTest extends AbstractTests {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+
+    private static Tomcat idpServer;
+    private static Tomcat rpServer;
+
+    @BeforeClass
+    public static void init() {
+        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");
+        Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
+
+        initIdp();
+    }
+
+    private static void initIdp() {
+        try {
+            idpServer = new Tomcat();
+            idpServer.setPort(0);
+            String currentDir = new File(".").getCanonicalPath();
+            idpServer.setBaseDir(currentDir + File.separator + "target");
+
+            idpServer.getHost().setAppBase("tomcat/idp/webapps");
+            idpServer.getHost().setAutoDeploy(true);
+            idpServer.getHost().setDeployOnStartup(true);
+
+            Connector httpsConnector = new Connector();
+            httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
+            httpsConnector.setSecure(true);
+            httpsConnector.setScheme("https");
+            // httpsConnector.setAttribute("keyAlias", keyAlias);
+            httpsConnector.setAttribute("keystorePass", "tompass");
+            httpsConnector.setAttribute("keystoreFile", 
"test-classes/server.jks");
+            httpsConnector.setAttribute("truststorePass", "tompass");
+            httpsConnector.setAttribute("truststoreFile", 
"test-classes/server.jks");
+            httpsConnector.setAttribute("clientAuth", "want");
+            // httpsConnector.setAttribute("clientAuth", "false");
+            httpsConnector.setAttribute("sslProtocol", "TLS");
+            httpsConnector.setAttribute("SSLEnabled", true);
+
+            idpServer.getService().addConnector(httpsConnector);
+
+            idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
+            idpServer.addWebapp("/fediz-idp", "fediz-idp");
+
+            idpServer.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        try {
+            if (idpServer.getServer() != null && 
idpServer.getServer().getState() != LifecycleState.DESTROYED) {
+                if (idpServer.getServer().getState() != 
LifecycleState.STOPPED) {
+                    idpServer.stop();
+                }
+                idpServer.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        try {
+            if (rpServer.getServer() != null && 
rpServer.getServer().getState() != LifecycleState.DESTROYED) {
+                if (rpServer.getServer().getState() != LifecycleState.STOPPED) 
{
+                    rpServer.stop();
+                }
+                rpServer.destroy();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Ignored because of missing test environment.
+     */
+    @Override
+    @Ignore
+    public void testRPMetadata() throws Exception {
+
+    }
+
+    @Override
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    @Override
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+
+    @Override
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+
+}

Reply via email to