cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1454493 - in /cxf/fediz/trunk/systests: ./ spring/ spring/src/ spring/src/test/ spring/src/test/java/ spring/src/test/java/org/ spring/src/test/java/org/apache/ spring/src/test/java/org/apache/cxf/ spring/src/test/java/org/apache/cxf/fediz...
Date Fri, 08 Mar 2013 18:43:15 GMT
Author: owulff
Date: Fri Mar  8 18:43:14 2013
New Revision: 1454493

URL: http://svn.apache.org/r1454493
Log:
Integration tests added for spring-security plugin

Added:
    cxf/fediz/trunk/systests/spring/
    cxf/fediz/trunk/systests/spring/pom.xml
    cxf/fediz/trunk/systests/spring/src/
    cxf/fediz/trunk/systests/spring/src/test/
    cxf/fediz/trunk/systests/spring/src/test/java/
    cxf/fediz/trunk/systests/spring/src/test/java/org/
    cxf/fediz/trunk/systests/spring/src/test/java/org/apache/
    cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/
    cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/
    cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/
    cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
    cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
    cxf/fediz/trunk/systests/spring/src/test/resources/
    cxf/fediz/trunk/systests/spring/src/test/resources/fediz_config.xml
    cxf/fediz/trunk/systests/spring/src/test/resources/idp-server.xml
    cxf/fediz/trunk/systests/spring/src/test/resources/log4j.properties
    cxf/fediz/trunk/systests/spring/src/test/resources/logging.properties
    cxf/fediz/trunk/systests/spring/src/test/resources/rp-server.xml
    cxf/fediz/trunk/systests/spring/src/test/resources/server.jks
    cxf/fediz/trunk/systests/springWebapp/pom.xml
    cxf/fediz/trunk/systests/springWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
    cxf/fediz/trunk/systests/springWebapp/src/main/resources/log4j.properties
    cxf/fediz/trunk/systests/springWebapp/src/main/resources/logging.properties
    cxf/fediz/trunk/systests/springWebapp/src/main/resources/stsstore.jks   (with props)
    cxf/fediz/trunk/systests/springWebapp/src/main/webapp/META-INF/context.xml
    cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/applicationContext-security.xml
    cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/web.xml
    cxf/fediz/trunk/systests/springWebapp/src/main/webapp/index.html
    cxf/fediz/trunk/systests/springWebapp/src/main/webapp/secure/test.html
Modified:
    cxf/fediz/trunk/systests/pom.xml
    cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java

Modified: cxf/fediz/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/pom.xml?rev=1454493&r1=1454492&r2=1454493&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/pom.xml (original)
+++ cxf/fediz/trunk/systests/pom.xml Fri Mar  8 18:43:14 2013
@@ -33,8 +33,10 @@
       <module>tests</module>
       <module>simpleWebapp</module>
       <module>springPreauthWebapp</module>
+      <module>springWebapp</module>
       <module>jetty8</module>
       <module>tomcat7</module>
+      <module>spring</module>
    </modules>
 
 </project>

Added: cxf/fediz/trunk/systests/spring/pom.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/pom.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/pom.xml (added)
+++ cxf/fediz/trunk/systests/spring/pom.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,211 @@
+<?xml version="1.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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.cxf.fediz</groupId>
+        <artifactId>systests</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <groupId>org.apache.cxf.fediz.systests</groupId>
+    <artifactId>systests-spring</artifactId>
+    <name>Apache Fediz Systests Spring Security</name>
+    <packaging>jar</packaging>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-security</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-xml</artifactId>
+            <version>${jetty.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-webapp</artifactId>
+            <version>${jetty.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-jsp</artifactId>
+            <version>${jetty.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.fediz.systests</groupId>
+            <artifactId>systests-tests</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>            
+            <scope>test</scope>
+        </dependency>        
+    </dependencies>
+    <build>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/idp-server.xml</include>
+                    <include>**/rp-server.xml</include>
+                    <include>**/fediz_config.xml</include>
+                </includes>
+            </testResource>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>false</filtering>
+                <excludes>
+                    <exclude>**/idp-server.xml</exclude>
+                    <exclude>**/rp-server.xml</exclude>
+                    <exclude>**/fediz_config.xml</exclude>
+                </excludes>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.7</version>
+                <executions>
+                    <execution>
+                        <id>reserve-network-port</id>
+                        <goals>
+                            <goal>reserve-network-port</goal>
+                        </goals>
+                        <phase>initialize</phase>
+                        <configuration>
+                            <portNames>
+                                <portName>idp.https.port</portName>
+                                <portName>rp.https.port</portName>
+                            </portNames>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>        
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.6</version>
+                <executions>
+                    <execution>
+                        <id>copy-idp-sts</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.cxf.fediz</groupId>
+                                    <artifactId>fediz-idp</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>war</type>
+                                    <overWrite>true</overWrite>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.cxf.fediz</groupId>
+                                    <artifactId>fediz-idp-sts</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>war</type>
+                                    <overWrite>true</overWrite>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.cxf.fediz.systests</groupId>
+                                    <artifactId>systests-springWebapp</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>war</type>
+                                    <overWrite>true</overWrite>
+                                </artifactItem>                                
+                            </artifactItems>
+                            <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
+                            <outputDirectory>target</outputDirectory>
+                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <overWriteIfNewer>true</overWriteIfNewer>
+                            <stripVersion>true</stripVersion>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.12.2</version>
+                <inherited>true</inherited>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>integration-test</goal>
+                        </goals>
+                        <configuration>
+                            <skip>false</skip>
+                            <systemPropertyVariables>
+                                <wt.headless>true</wt.headless>
+                                <idp.https.port>${idp.https.port}</idp.https.port>
+                                <rp.https.port>${rp.https.port}</rp.https.port>
+                            </systemPropertyVariables>
+                            <includes>
+                                <include>**/integrationtests/**</include>
+                            </includes>
+                            <argLine>-XX:MaxPermSize=512M</argLine>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>verify</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.12</version>
+                <inherited>true</inherited>
+                <configuration>
+                    <excludes>
+                        <exclude>**/integrationtests/**</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java (added)
+++ cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java Fri Mar  8 18:43:14 2013
@@ -0,0 +1,100 @@
+/**
+ * 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 org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.xml.XmlConfiguration;
+
+public final class JettyUtils {
+
+    private static Server idpServer;
+    private static Server rpServer;
+    
+    private JettyUtils() {
+    }
+        
+    public static void initIdpServer() {
+        if (idpServer == null) {
+            try {
+                Resource testServerConfig = Resource.newSystemResource("idp-server.xml");
+                XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
+                idpServer = (Server)configuration.configure();   
+                
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public static void startIdpServer() {
+        if (idpServer != null && !idpServer.isStarted()) {
+            try {
+                idpServer.start();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public static void stopIdpServer() {
+        if (idpServer != null && idpServer.isStarted()) {
+            try {
+                idpServer.stop();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public static void initRpServer() {
+        if (rpServer == null) {
+            try {
+                Resource testServerConfig = Resource.newSystemResource("rp-server.xml");
+                XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
+                rpServer = (Server)configuration.configure();   
+                
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public static void startRpServer() {
+        if (rpServer != null && !rpServer.isStarted()) {
+            try {
+                rpServer.start();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public static void stopRpServer() {
+        if (rpServer != null && rpServer.isStarted()) {
+            try {
+                rpServer.stop();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+}

Added: cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java (added)
+++ cxf/fediz/trunk/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java Fri Mar  8 18:43:14 2013
@@ -0,0 +1,76 @@
+/**
+ * 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 org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+
+public class SpringTest extends AbstractTests {
+
+    static String idpHttpsPort;
+    static String rpHttpsPort;
+    
+    @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", "debug");
+
+        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
+
+        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);
+
+        JettyUtils.initIdpServer();
+        JettyUtils.startIdpServer();
+        JettyUtils.initRpServer();
+        JettyUtils.startRpServer();
+    }
+    
+    @AfterClass
+    public static void cleanup() {
+        JettyUtils.stopIdpServer();
+        JettyUtils.stopRpServer();
+    }
+
+    @Override
+    public String getIdpHttpsPort() {
+        return idpHttpsPort;
+    }
+
+    @Override
+    public String getRpHttpsPort() {
+        return rpHttpsPort;
+    }
+    
+    @Override
+    public String getServletContextName() {
+        return "fedizhelloworld";
+    }
+    
+    
+}

Added: cxf/fediz/trunk/systests/spring/src/test/resources/fediz_config.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/resources/fediz_config.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/resources/fediz_config.xml (added)
+++ cxf/fediz/trunk/systests/spring/src/test/resources/fediz_config.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- 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="stsstore.jks" password="stsspass" type="JKS" />
+			</trustManager>
+		</certificateStores>
+		<trustedIssuers>
+			<issuer subject=".*CN=www.sts.com.*" certificateValidation="ChainTrust"
+				name="DoubleItSTSIssuer" />
+		</trustedIssuers>
+		<maximumClockSkew>1000</maximumClockSkew>
+		<protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+			xsi:type="federationProtocolType" version="1.0.0">
+			<realm>urn:org:apache:cxf:fediz:fedizhelloworld</realm>
+			<issuer>https://localhost:${idp.https.port}/fediz-idp/</issuer>
+			<roleDelimiter>,</roleDelimiter>
+			<roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
+                        <reply>/j_spring_fediz_security_check</reply>
+			<!--<authenticationType type="String">some auth type</authenticationType>-->
+			<!--<homeRealm type="Class">org.apache.fediz.realm.MyHomeRealm</homeRealm>-->
+			<!--<freshness>0</freshness>-->
+			<!--<reply>reply value</reply>-->
+			<!--<request>REQUEST</request>-->
+			<claimTypesRequested>
+				<claimType type="a particular claim type" optional="true" />
+			</claimTypesRequested>
+		</protocol>
+	</contextConfig>
+</FedizConfig>
+

Added: cxf/fediz/trunk/systests/spring/src/test/resources/idp-server.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/resources/idp-server.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/resources/idp-server.xml (added)
+++ cxf/fediz/trunk/systests/spring/src/test/resources/idp-server.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+ 
+<Configure id="IdpServer" class="org.eclipse.jetty.server.Server">
+ 
+    <Call class="org.eclipse.jetty.util.log.Log" name="getRootLogger">
+      <Call name="setDebugEnabled">
+        <Arg type="boolean">true</Arg>
+      </Call>
+    </Call>
+    
+    <Call name="addConnector">
+     <Arg>
+       <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
+         <Arg>
+           <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
+             <Set name="keyStore">./target/test-classes/server.jks</Set>
+             <Set name="keyStorePassword">tompass</Set>
+             <Set name="keyManagerPassword">tompass</Set>
+           </New>
+         </Arg>
+         <Set name="port">${idp.https.port}</Set>
+         <Set name="maxIdleTime">30000</Set>
+       </New>
+     </Arg>
+   </Call>
+ 
+    <Set name="handler">
+      <New class="org.eclipse.jetty.server.handler.HandlerList">
+        <Set name="handlers">
+          <Array type="org.eclipse.jetty.server.Handler">
+            <Item>
+              <New class="org.eclipse.jetty.webapp.WebAppContext">
+                <Set name="contextPath">/fediz-idp</Set>
+                <Set name="war">./target/fediz-idp.war</Set>
+                <Set name="throwUnavailableOnStartupException">true</Set>
+              </New>
+            </Item>
+            <Item>
+              <New class="org.eclipse.jetty.webapp.WebAppContext">
+                <Set name="contextPath">/fediz-idp-sts</Set>
+                <Set name="war">./target/fediz-idp-sts.war</Set>
+                <Set name="throwUnavailableOnStartupException">true</Set>
+              </New>	          
+            </Item>
+          </Array>
+        </Set>
+      </New>
+    </Set>    
+    
+</Configure>

Added: cxf/fediz/trunk/systests/spring/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/resources/log4j.properties?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/resources/log4j.properties (added)
+++ cxf/fediz/trunk/systests/spring/src/test/resources/log4j.properties Fri Mar  8 18:43:14 2013
@@ -0,0 +1,20 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+#log4j.rootLogger=INFO, CONSOLE
+log4j.rootLogger=DEBUG, CONSOLE
+#log4j.logger.org.springframework=INFO, CONSOLE
+#log4j.logger.org.springframework.security=DEBUG, CONSOLE,LOGFILE
+#log4j.logger.org.apache.cxf.fediz=DEBUG, CONSOLE,LOGFILE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=fedizhelloworld.log
+log4j.appender.LOGFILE.Append=false
+log4j.appender.LOGFILE.Threshold=DEBUG
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

Added: cxf/fediz/trunk/systests/spring/src/test/resources/logging.properties
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/resources/logging.properties?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/resources/logging.properties (added)
+++ cxf/fediz/trunk/systests/spring/src/test/resources/logging.properties Fri Mar  8 18:43:14 2013
@@ -0,0 +1,53 @@
+############################################################
+#  	Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.  
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+#  	Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler 
+# classes.  These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the WARNING and above levels.
+handlers= java.util.logging.ConsoleHandler
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers.  For any given facility this global level
+# can be overridden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= FINEST
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to WARNING and above.
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#com.xyz.foo.level = SEVERE
+#org.apache.cxf.fediz.level = FINEST

Added: cxf/fediz/trunk/systests/spring/src/test/resources/rp-server.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/resources/rp-server.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/spring/src/test/resources/rp-server.xml (added)
+++ cxf/fediz/trunk/systests/spring/src/test/resources/rp-server.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+ 
+<Configure id="RPServer" class="org.eclipse.jetty.server.Server">
+ 
+    <Call class="org.eclipse.jetty.util.log.Log" name="getRootLogger">
+      <Call name="setDebugEnabled">
+        <Arg type="boolean">true</Arg>
+      </Call>
+    </Call>
+
+    <Call name="addConnector">
+     <Arg>
+       <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
+         <Arg>
+           <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
+             <Set name="keyStore">./target/test-classes/server.jks</Set>
+             <Set name="keyStorePassword">tompass</Set>
+             <Set name="keyManagerPassword">tompass</Set>
+           </New>
+         </Arg>
+         <Set name="port">${rp.https.port}</Set>
+         <Set name="maxIdleTime">30000</Set>
+       </New>
+     </Arg>
+   </Call>
+ 
+    <Set name="handler">
+      <New class="org.eclipse.jetty.server.handler.HandlerList">
+        <Set name="handlers">
+          <Array type="org.eclipse.jetty.server.Handler">
+            <Item>
+              <New class="org.eclipse.jetty.webapp.WebAppContext">
+                <Set name="contextPath">/fedizhelloworld</Set>
+                <Set name="war">./target/systests-springWebapp.war</Set>
+                <Set name="throwUnavailableOnStartupException">true</Set>
+              </New>
+            </Item>		    
+          </Array>
+        </Set>
+      </New>
+    </Set>  
+    
+</Configure>

Added: cxf/fediz/trunk/systests/spring/src/test/resources/server.jks
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/spring/src/test/resources/server.jks?rev=1454493&view=auto
==============================================================================
Files cxf/fediz/trunk/systests/spring/src/test/resources/server.jks (added) and cxf/fediz/trunk/systests/spring/src/test/resources/server.jks Fri Mar  8 18:43:14 2013 differ

Added: cxf/fediz/trunk/systests/springWebapp/pom.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/pom.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/pom.xml (added)
+++ cxf/fediz/trunk/systests/springWebapp/pom.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,108 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.cxf.fediz</groupId>
+		<artifactId>systests</artifactId>
+		<version>1.1.0-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+
+    <groupId>org.apache.cxf.fediz.systests</groupId>
+    <artifactId>systests-springWebapp</artifactId>
+    <name>Apache Fediz Systests SpringWebapp</name>
+    <packaging>war</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>${servlet.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.fediz</groupId>
+            <artifactId>fediz-cxf</artifactId>
+            <version>${project.version}</version>          
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.fediz</groupId>
+            <artifactId>fediz-spring</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>${commons.lang.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>${log4j.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.mail</groupId>
+                    <artifactId>mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.jms</groupId>
+                    <artifactId>jms</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jdmk</groupId>
+                    <artifactId>jmxtools</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jmx</groupId>
+                    <artifactId>jmxri</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>				
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin><!--for mvn tomcat:deploy/:undeploy/:redeploy -->
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>tomcat-maven-plugin</artifactId>
+                <version>1.1</version>
+                <configuration>
+                    <server>myTomcat</server>
+                    <url>http://localhost:8080/manager/text</url>
+                    <path>/${project.build.finalName}</path>
+                </configuration>
+            </plugin>
+        </plugins>
+        <!-- Name of the generated WAR file -->
+        <finalName>fedizhelloworld</finalName>
+    </build>
+
+</project>

Added: cxf/fediz/trunk/systests/springWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java Fri Mar  8 18:43:14 2013
@@ -0,0 +1,108 @@
+/**
+ * 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.example;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.fediz.core.Claim;
+import org.apache.cxf.fediz.core.ClaimCollection;
+import org.apache.cxf.fediz.cxf.web.SecurityTokenThreadLocal;
+import org.apache.cxf.fediz.spring.authentication.FederationAuthenticationToken;
+
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+public class FederationServlet extends HttpServlet {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -9019993850246851112L;
+
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+        IOException {
+
+        response.setContentType("text/html");
+        PrintWriter out = response.getWriter();
+
+        out.println("<html>");
+        out.println("<head><title>WS Federation Systests Spring Examples</title></head>");
+        out.println("<body>");
+        out.println("<p>Request url: " + request.getRequestURL().toString() + "</p>");
+
+        out.print("<p>userPrincipal=");
+        Principal p = request.getUserPrincipal();
+        if (p != null) {
+            out.print(p.getName());
+        }
+        out.println("</p>");
+
+        // Access Spring security context
+        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+        
+        if (auth instanceof FederationAuthenticationToken) {
+            FederationAuthenticationToken fedToken = (FederationAuthenticationToken)auth;
+            List<String> roleListToCheck = Arrays.asList("Admin", "Manager", "User", "Authenticated");
+            
+            for (String item : roleListToCheck) {
+                boolean found = false;
+                for (GrantedAuthority ga : fedToken.getAuthorities()) {
+                    if (ga.getAuthority().toLowerCase().indexOf(item.toLowerCase()) > -1) {
+                        found = true;
+                        break;
+                    }
+                }
+                out.println("<p>role:" + item + "=" + (found ? "true" : "false") + "</p>");
+            }
+            
+            ClaimCollection claims = fedToken.getClaims();
+            for (Claim c : claims) {
+                out.println("<p>" + c.getClaimType().toString() + "=" + c.getValue() + "</p>");
+            }
+            
+            Element el = fedToken.getLoginToken();
+            if (el != null) {
+                out.println("loginToken=FOUND{FederationPrincipal}<p>");
+            }
+            
+            el = SecurityTokenThreadLocal.getToken();
+            if (el != null) {
+                out.println("loginToken=FOUND{SecurityTokenThreadLocal}<p>");
+            }
+            
+        }
+                
+        out.println("</body>");
+        
+    }
+
+}

Added: cxf/fediz/trunk/systests/springWebapp/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/resources/log4j.properties?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/resources/log4j.properties (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/resources/log4j.properties Fri Mar  8 18:43:14 2013
@@ -0,0 +1,16 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootLogger=INFO, CONSOLE
+log4j.logger.org.springframework=INFO, CONSOLE
+log4j.additivity.org.springframework=false
+log4j.logger.org.springframework.security=DEBUG, CONSOLE
+log4j.additivity.org.springframework.security=false
+log4j.logger.org.apache.cxf.fediz=DEBUG, CONSOLE
+log4j.additivity.org.apache.cxf.fediz=false
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
+
+

Added: cxf/fediz/trunk/systests/springWebapp/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/resources/logging.properties?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/resources/logging.properties (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/resources/logging.properties Fri Mar  8 18:43:14 2013
@@ -0,0 +1,53 @@
+############################################################
+#  	Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.  
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+#  	Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler 
+# classes.  These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the WARNING and above levels.
+handlers= java.util.logging.ConsoleHandler
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers.  For any given facility this global level
+# can be overridden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= FINEST
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to WARNING and above.
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#com.xyz.foo.level = SEVERE
+#org.apache.cxf.fediz.level = FINEST

Added: cxf/fediz/trunk/systests/springWebapp/src/main/resources/stsstore.jks
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/resources/stsstore.jks?rev=1454493&view=auto
==============================================================================
Files cxf/fediz/trunk/systests/springWebapp/src/main/resources/stsstore.jks (added) and cxf/fediz/trunk/systests/springWebapp/src/main/resources/stsstore.jks Fri Mar  8 18:43:14 2013 differ

Propchange: cxf/fediz/trunk/systests/springWebapp/src/main/resources/stsstore.jks
------------------------------------------------------------------------------
    svn:executable = *

Added: cxf/fediz/trunk/systests/springWebapp/src/main/webapp/META-INF/context.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/webapp/META-INF/context.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/webapp/META-INF/context.xml (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/webapp/META-INF/context.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,3 @@
+<Context>
+        <Valve className="org.apache.cxf.fediz.tomcat.FederationAuthenticator" configFile="conf/fediz_config.xml" />        
+</Context>

Added: cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/applicationContext-security.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/applicationContext-security.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/applicationContext-security.xml (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/applicationContext-security.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:sec="http://www.springframework.org/schema/security"
+    xmlns:p="http://www.springframework.org/schema/p"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:context="http://www.springframework.org/schema/context"
+    xmlns:util="http://www.springframework.org/schema/util"
+    xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
+http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <!-- DIABLE in production as it might log confidential information about the user -->
+    <sec:debug />
+
+    <sec:http entry-point-ref="federationEntryPoint" use-expressions="true">
+        <sec:intercept-url pattern="/" access="permitAll"/>
+        <sec:intercept-url pattern="/fediz" access="permitAll"/>
+        <sec:intercept-url pattern="/index.html" access="permitAll"/>
+        <sec:intercept-url pattern="/secure/fedservlet" access="isAuthenticated()"/>
+        <sec:intercept-url pattern="/secure/manager/**" access="hasRole('ROLE_MANAGER')"/>
+        <sec:intercept-url pattern="/secure/admin/**" access="hasRole('ROLE_ADMIN')"/>
+        <sec:intercept-url pattern="/secure/user/**" access="hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_MANAGER')"/>
+        <sec:custom-filter ref="federationFilter" after="BASIC_AUTH_FILTER" />
+        <sec:session-management session-authentication-strategy-ref="sas"/>
+    </sec:http>
+
+
+    <sec:authentication-manager alias="authManager">
+        <sec:authentication-provider ref="federationAuthProvider" />
+    </sec:authentication-manager>
+
+    <bean id="fedizConfig" class="org.apache.cxf.fediz.spring.FederationConfigImpl" init-method="init"
+        p:configFile="file:./target/test-classes/fediz_config.xml" />
+
+    <bean id="federationEntryPoint"
+        class="org.apache.cxf.fediz.spring.web.FederationAuthenticationEntryPoint"
+        p:federationConfig-ref="fedizConfig" />
+
+<!-- Works without org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy as well -->
+<!-- 
+    <bean id="federationFilter"
+        class="org.apache.cxf.fediz.spring.web.FederationAuthenticationFilter"
+        p:authenticationManager-ref="authManager" p:sessionAuthenticationStrategy-ref="sas">
+
+        <property name="authenticationFailureHandler">
+            <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler" />
+        </property>
+    </bean>
+ -->
+ 
+    <bean id="federationFilter"
+        class="org.apache.cxf.fediz.spring.web.FederationAuthenticationFilter"
+        p:authenticationManager-ref="authManager">
+
+        <property name="authenticationFailureHandler">
+            <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler" />
+        </property>
+    </bean>
+    
+    <bean id="federationAuthProvider" class="org.apache.cxf.fediz.spring.authentication.FederationAuthenticationProvider"
+        p:federationConfig-ref="fedizConfig">
+        <property name="authenticationUserDetailsService">
+            <bean class="org.apache.cxf.fediz.spring.authentication.GrantedAuthoritiesUserDetailsFederationService"/>
+        </property>
+    </bean>
+
+    <bean id="sas" class="org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy" />
+</beans>
+

Added: cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/web.xml?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/web.xml (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/webapp/WEB-INF/web.xml Fri Mar  8 18:43:14 2013
@@ -0,0 +1,79 @@
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+	version="3.0" metadata-complete="true">
+
+	<description>
+    WS Federation Spring Example
+    </description>
+	<display-name>WS Federation Spring Example</display-name>
+	
+
+
+    <!--
+      - Location of the XML file that defines the root application context
+      - Applied by ContextLoaderListener.
+      -->
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            /WEB-INF/applicationContext-security.xml
+        </param-value>
+    </context-param>
+
+    <filter>
+        <filter-name>springSecurityFilterChain</filter-name>
+        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+    </filter>
+    
+    <!-- Optional: Cache the security token in Thread Local Storage -->
+	<filter>
+		<filter-name>FederationFilter</filter-name>
+		<filter-class>org.apache.cxf.fediz.cxf.web.FederationFilter</filter-class>
+	</filter>
+
+    <filter-mapping>
+      <filter-name>springSecurityFilterChain</filter-name>
+      <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    
+    <filter-mapping>
+		<filter-name>FederationFilter</filter-name>
+		<url-pattern>/secure/*</url-pattern>
+	</filter-mapping>
+
+    <!--
+      - Loads the root application context of this web app at startup.
+      - The application context is then available via
+      - WebApplicationContextUtils.getWebApplicationContext(servletContext).
+    -->
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+     
+	<servlet>
+		<servlet-name>FederationServlet</servlet-name>
+		<servlet-class>org.apache.cxf.fediz.example.FederationServlet</servlet-class>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>FederationServlet</servlet-name>
+		<url-pattern>/secure/fedservlet</url-pattern>
+	</servlet-mapping>
+
+	<servlet-mapping>
+		<servlet-name>FederationServlet</servlet-name>
+		<url-pattern>/secure/admin/fedservlet</url-pattern>
+	</servlet-mapping>
+	
+	<servlet-mapping>
+		<servlet-name>FederationServlet</servlet-name>
+		<url-pattern>/secure/user/fedservlet</url-pattern>
+	</servlet-mapping>
+	
+	<servlet-mapping>
+		<servlet-name>FederationServlet</servlet-name>
+		<url-pattern>/secure/manager/fedservlet</url-pattern>
+	</servlet-mapping>
+
+</web-app>

Added: cxf/fediz/trunk/systests/springWebapp/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/webapp/index.html?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/webapp/index.html (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/webapp/index.html Fri Mar  8 18:43:14 2013
@@ -0,0 +1,25 @@
+<!--
+  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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD><TITLE>WS Federation Tomcat Examples</TITLE>
+<META http-equiv=Content-Type content="text/html">
+</HEAD>
+<BODY>
+<P>
+<H3>Hello World</H3>
+<P></P>
+</BODY></HTML>

Added: cxf/fediz/trunk/systests/springWebapp/src/main/webapp/secure/test.html
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springWebapp/src/main/webapp/secure/test.html?rev=1454493&view=auto
==============================================================================
--- cxf/fediz/trunk/systests/springWebapp/src/main/webapp/secure/test.html (added)
+++ cxf/fediz/trunk/systests/springWebapp/src/main/webapp/secure/test.html Fri Mar  8 18:43:14 2013
@@ -0,0 +1,25 @@
+<!--
+  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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD><TITLE>WS Federation Tomcat Examples</TITLE>
+<META http-equiv=Content-Type content="text/html">
+</HEAD>
+<BODY>
+<P>
+<H3>Secure Test</H3>
+<P></P>
+</BODY></HTML>

Modified: cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java?rev=1454493&r1=1454492&r2=1454493&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java (original)
+++ cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java Fri Mar  8 18:43:14 2013
@@ -25,8 +25,10 @@ import java.security.KeyStore;
 import java.util.ArrayList;
 import java.util.List;
 
+import net.htmlparser.jericho.Element;
 import net.htmlparser.jericho.FormField;
 import net.htmlparser.jericho.FormFields;
+import net.htmlparser.jericho.HTMLElementName;
 import net.htmlparser.jericho.Source;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.http.Consts;
@@ -210,7 +212,7 @@ public abstract class AbstractTests {
 
             HttpResponse response = httpclient.execute(httpget);
             HttpEntity entity = response.getEntity();
-
+            
             System.out.println(response.getStatusLine());
             if (entity != null) {
                 System.out.println("Response content length: " + entity.getContentLength());
@@ -231,16 +233,25 @@ public abstract class AbstractTests {
             //            change the conditions under which the request was issued.
 
             httpclient.setRedirectStrategy(new LaxRedirectStrategy());
-            HttpPost httppost = new HttpPost(url);
+            
 
             Source source = new Source(EntityUtils.toString(entity));
             List <NameValuePair> nvps = new ArrayList <NameValuePair>();
             FormFields formFields = source.getFormFields();
+            System.out.println(formFields.getDebugInfo());
+            System.out.println(source.getFormControls().toString());
+            
+            List<Element> forms = source.getAllElements(HTMLElementName.FORM);
+            Assert.assertEquals("Only one form expected but got " + forms.size(), 1, forms.size());
+            String postUrl = forms.get(0).getAttributeValue("action");
+            
             Assert.assertNotNull("Form field 'wa' not found", formFields.get("wa"));
             Assert.assertNotNull("Form field 'wresult' not found", formFields.get("wresult"));
             for (FormField formField : formFields) {
                 nvps.add(new BasicNameValuePair(formField.getName(), formField.getValues().get(0)));
             }
+            
+            HttpPost httppost = new HttpPost(postUrl);
             httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));
 
             response = httpclient.execute(httppost);



Mime
View raw message