You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/07/11 16:19:56 UTC
[1/7] cxf-fediz git commit: Updating jdk version
Repository: cxf-fediz
Updated Branches:
refs/heads/master 7263bb9ea -> e392e637f
Updating jdk version
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/41bed79e
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/41bed79e
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/41bed79e
Branch: refs/heads/master
Commit: 41bed79e17b69590109b32c52172c79fa2ab221b
Parents: 7263bb9
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Jul 11 15:30:14 2017 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Jul 11 15:30:14 2017 +0100
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/41bed79e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8d09215..861c947 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,7 +73,7 @@
<tomcat.url>http://localhost:8080/manager/text</tomcat.url>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <jdk.version>1.7</jdk.version>
+ <jdk.version>1.8</jdk.version>
<compiler.fork>false</compiler.fork>
<fediz.protect-xmlschema-collections>false</fediz.protect-xmlschema-collections>
[4/7] cxf-fediz git commit: FEDIZ-204 - Drop Tomcat7, Jetty8,
Spring Sec 2 containers
Posted by co...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/fediz_config_client_cert.xml
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/resources/fediz_config_client_cert.xml b/systests/jetty8/src/test/resources/fediz_config_client_cert.xml
deleted file mode 100644
index e8bd2d1..0000000
--- a/systests/jetty8/src/test/resources/fediz_config_client_cert.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="clienttrust.jks" password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- <authenticationType>http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/Ssl</authenticationType>
- <request type="Class">org.apache.cxf.fediz.integrationtests.HOKCallbackHandler</request>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
- <contextConfig name="/fedizspringhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="clienttrust.jks" password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- <authenticationType>http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/Ssl</authenticationType>
- <request type="Class">org.apache.cxf.fediz.integrationtests.HOKCallbackHandler</request>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/idp-server.xml
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/resources/idp-server.xml b/systests/jetty8/src/test/resources/idp-server.xml
deleted file mode 100644
index 1a246e2..0000000
--- a/systests/jetty8/src/test/resources/idp-server.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?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.
--->
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-
-<Configure id="IdpServer" class="org.eclipse.jetty.server.Server">
-
-
- <Call class="java.lang.System" name="setProperty">
- <Arg>org.apache.jasper.compiler.disablejsr199</Arg>
- <Arg>true</Arg>
- </Call>
-
-
- <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>
- <Set name="trustStore">./target/test-classes/server.jks</Set>
- <Set name="trustStorePassword">tompass</Set>
- <Set name="wantClientAuth">true</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/idp/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/idp/fediz-idp-sts.war</Set>
- <Set name="throwUnavailableOnStartupException">true</Set>
- </New>
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
-
-</Configure>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/resources/logging.properties b/systests/jetty8/src/test/resources/logging.properties
deleted file mode 100644
index 0d8d902..0000000
--- a/systests/jetty8/src/test/resources/logging.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-############################################################
-# 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= INFO
-
-############################################################
-# 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 = WARNING
-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.ws.security.level = FINEST
-org.apache.cxf.fediz.level = FINEST
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/rp-client-cert-server.xml
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/resources/rp-client-cert-server.xml b/systests/jetty8/src/test/resources/rp-client-cert-server.xml
deleted file mode 100644
index eb74fe2..0000000
--- a/systests/jetty8/src/test/resources/rp-client-cert-server.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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.
--->
-<!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>
- <Set name="trustStore">./target/test-classes/server.jks</Set>
- <Set name="trustStorePassword">tompass</Set>
- <Set name="wantClientAuth">true</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/rp/fediz-systests-webapps-simple.war</Set>
- <!--Set name="war">./target/jetty/rp/webapps/simpleWebapp</Set>-->
- <Set name="throwUnavailableOnStartupException">true</Set>
-
- <Get name="securityHandler">
- <Set name="authenticator">
- <New class="org.apache.cxf.fediz.jetty8.FederationAuthenticator">
- <Set name="configFile">./target/test-classes/fediz_config_client_cert.xml</Set>
- </New>
- </Set>
- </Get>
- </New>
- </Item>
- <Item>
- <New class="org.eclipse.jetty.webapp.WebAppContext">
- <Set name="contextPath">/fedizspringhelloworld</Set>
- <Set name="war">./target/rp/fediz-systests-webapps-springPreauth.war</Set>
- <Set name="throwUnavailableOnStartupException">true</Set>
-
- <Get name="securityHandler">
- <Set name="authenticator">
- <New class="org.apache.cxf.fediz.jetty8.FederationAuthenticator">
- <Set name="configFile">./target/test-classes/fediz_config_client_cert.xml</Set>
- </New>
- </Set>
- </Get>
- </New>
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
-
- <Call name="addBean">
- <Arg>
- <New class="org.apache.cxf.fediz.jetty8.FederationLoginService">
- <Set name="name">WSFED</Set>
- </New>
- </Arg>
- </Call>
-
-</Configure>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/rp-server.xml
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/resources/rp-server.xml b/systests/jetty8/src/test/resources/rp-server.xml
deleted file mode 100644
index a3b95d1..0000000
--- a/systests/jetty8/src/test/resources/rp-server.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?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.
--->
-<!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/rp/fediz-systests-webapps-simple.war</Set>
- <!--Set name="war">./target/jetty/rp/webapps/simpleWebapp</Set>-->
- <Set name="throwUnavailableOnStartupException">true</Set>
-
- <Get name="securityHandler">
- <Set name="authenticator">
- <New class="org.apache.cxf.fediz.jetty8.FederationAuthenticator">
- <Set name="configFile">./target/test-classes/fediz_config.xml</Set>
- </New>
- </Set>
- </Get>
- </New>
- </Item>
- <Item>
- <New class="org.eclipse.jetty.webapp.WebAppContext">
- <Set name="contextPath">/fedizspringhelloworld</Set>
- <Set name="war">./target/rp/fediz-systests-webapps-springPreauth.war</Set>
- <Set name="throwUnavailableOnStartupException">true</Set>
-
- <Get name="securityHandler">
- <Set name="authenticator">
- <New class="org.apache.cxf.fediz.jetty8.FederationAuthenticator">
- <Set name="configFile">./target/test-classes/fediz_config.xml</Set>
- </New>
- </Set>
- </Get>
- </New>
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
-
- <Call name="addBean">
- <Arg>
- <New class="org.apache.cxf.fediz.jetty8.FederationLoginService">
- <Set name="name">WSFED</Set>
- </New>
- </Arg>
- </Call>
-
-</Configure>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty9/pom.xml
----------------------------------------------------------------------
diff --git a/systests/jetty9/pom.xml b/systests/jetty9/pom.xml
index a3384fd..0358402 100644
--- a/systests/jetty9/pom.xml
+++ b/systests/jetty9/pom.xml
@@ -95,12 +95,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>${tomcat8.version}</version>
@@ -279,15 +273,4 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>jdk17</id>
- <activation>
- <jdk>1.7</jdk>
- </activation>
- <properties>
- <maven.test.skip>true</maven.test.skip>
- </properties>
- </profile>
- </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/kerberos/pom.xml
----------------------------------------------------------------------
diff --git a/systests/kerberos/pom.xml b/systests/kerberos/pom.xml
index e47c1fe..61e871a 100644
--- a/systests/kerberos/pom.xml
+++ b/systests/kerberos/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java b/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
index 1a20ae7..93092ce 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
@@ -39,7 +39,7 @@ import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
import org.apache.cxf.fediz.core.ClaimTypes;
-import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
import org.apache.wss4j.dom.engine.WSSConfig;
import org.apache.xml.security.utils.Base64;
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/ldap/pom.xml
----------------------------------------------------------------------
diff --git a/systests/ldap/pom.xml b/systests/ldap/pom.xml
index 5c47160..ccf66f4 100644
--- a/systests/ldap/pom.xml
+++ b/systests/ldap/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
----------------------------------------------------------------------
diff --git a/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java b/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
index f090590..c6de652 100644
--- a/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
+++ b/systests/ldap/src/test/java/org/apache/cxf/fediz/integrationtests/LDAPTest.java
@@ -34,7 +34,7 @@ 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.tomcat7.FederationAuthenticator;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifFiles;
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/oidc/pom.xml
----------------------------------------------------------------------
diff --git a/systests/oidc/pom.xml b/systests/oidc/pom.xml
index e5280d9..0a755be 100644
--- a/systests/oidc/pom.xml
+++ b/systests/oidc/pom.xml
@@ -46,12 +46,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>${tomcat8.version}</version>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index ba42b32..d5ffba0 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -35,9 +35,7 @@
<module>idp</module>
<module>webapps</module>
<module>custom</module>
- <module>jetty8</module>
<module>jetty9</module>
- <module>tomcat7</module>
<module>tomcat8</module>
<module>spring</module>
<module>cxf</module>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/samlsso/pom.xml
----------------------------------------------------------------------
diff --git a/systests/samlsso/pom.xml b/systests/samlsso/pom.xml
index 2ba80d1..4d8bae3 100644
--- a/systests/samlsso/pom.xml
+++ b/systests/samlsso/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/spring/pom.xml
----------------------------------------------------------------------
diff --git a/systests/spring/pom.xml b/systests/spring/pom.xml
index 3bab4b4..5e6623f 100644
--- a/systests/spring/pom.xml
+++ b/systests/spring/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -158,14 +146,6 @@
</artifactItem>
<artifactItem>
<groupId>org.apache.cxf.fediz.systests.webapps</groupId>
- <artifactId>fediz-systests-webapps-spring2</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/tomcat/rp/webapps/fediz-systests-webapps-spring2</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz.systests.webapps</groupId>
<artifactId>fediz-systests-webapps-spring3</artifactId>
<version>${project.version}</version>
<type>war</type>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
----------------------------------------------------------------------
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
deleted file mode 100644
index f358924..0000000
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
+++ /dev/null
@@ -1,261 +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.IOException;
-
-import javax.servlet.ServletException;
-
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.DomElement;
-import com.gargoylesoftware.htmlunit.html.DomNodeList;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
-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.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class Spring2Test 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", "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);
-
- idpServer = startServer(true, idpHttpsPort);
- rpServer = startServer(false, rpHttpsPort);
- }
-
- @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();
- }
- }
-
- 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(),
- "fediz-systests-webapps-spring2");
- server.addWebapp("/fedizhelloworld_spring2", rpWebapp.getAbsolutePath());
- }
-
- server.start();
-
- return server;
- }
-
- @Override
- public String getIdpHttpsPort() {
- return idpHttpsPort;
- }
-
- @Override
- public String getRpHttpsPort() {
- return rpHttpsPort;
- }
-
- @Override
- public String getServletContextName() {
- return "fedizhelloworld_spring2";
- }
-
- @Ignore("This tests is currently failing on Spring")
- @Override
- public void testConcurrentRequests() throws Exception {
- // super.testConcurrentRequests();
- }
-
- @Test
- @Ignore("Logout not supported with Spring2")
- @Override
- public void testIdPLogout() throws Exception {
-
- }
-
- @Test
- @Ignore("Logout not supported with Spring2")
- @Override
- public void testIdPLogoutCleanup() throws Exception {
-
- }
-
- @Test
- @Ignore("Logout not supported with Spring2")
- @Override
- public void testRPLogout() throws Exception {
-
- }
-
- @Test
- @Ignore("Logout not supported with Spring2")
- @Override
- public void testRPLogoutViaAction() throws Exception {
-
- }
-
- @Override
- @Test
- public void testAliceModifiedSignature() throws Exception {
- String url = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
- + "/secure/fedservlet";
- String user = "alice";
- String password = "ecila";
-
- // Get the initial token
- CookieManager cookieManager = new CookieManager();
- final WebClient webClient = new WebClient();
- webClient.setCookieManager(cookieManager);
- 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());
-
- // Parse the form to get the token (wresult)
- DomNodeList<DomElement> results = idpPage.getElementsByTagName("input");
-
- for (DomElement result : results) {
- if ("wresult".equals(result.getAttributeNS(null, "name"))) {
- // Now modify the Signature
- String value = result.getAttributeNS(null, "value");
- value = value.replace("alice", "bob");
- result.setAttributeNS(null, "value", value);
- }
- }
-
- // Invoke back on the RP
-
- final HtmlForm form = idpPage.getFormByName("signinresponseform");
- final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
-
- try {
- button.click();
- Assert.fail("Failure expected on a modified signature");
- } catch (FailingHttpStatusCodeException ex) {
- // expected
- //Assert.assertTrue(ex.getMessage().contains("401 Unauthorized")
- // || ex.getMessage().contains("401 Authentication Failed")
- // || ex.getMessage().contains("403 Forbidden"));
- }
-
- webClient.close();
- }
-
- @Override
- @Test
- @Ignore
- public void testEntityExpansionAttack() throws Exception {
-
- }
-
- @Override
- @org.junit.Test
- public void testCSRFAttack() throws Exception {
- String url = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
- + "/j_spring_fediz_security_check";
- csrfAttackTest(url);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/pom.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/pom.xml b/systests/tomcat7/pom.xml
deleted file mode 100644
index 275dadf..0000000
--- a/systests/tomcat7/pom.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-<?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>fediz-systests</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <groupId>org.apache.cxf.fediz.systests</groupId>
- <artifactId>fediz-systests-tomcat7</artifactId>
- <name>Apache Fediz Systests Tomcat 7</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.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.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</groupId>
- <artifactId>fediz-tomcat7</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz.systests</groupId>
- <artifactId>fediz-systests-tests</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/fediz_config*.xml</include>
- </includes>
- </testResource>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/fediz_config*.xml</exclude>
- </excludes>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <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>
- <executions>
- <execution>
- <id>copy-idp-sts</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</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>
- <outputDirectory>target/tomcat/idp/webapps/fediz-idp</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-idp-sts</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/tomcat/idp/webapps/fediz-idp-sts</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz.systests.webapps</groupId>
- <artifactId>fediz-systests-webapps-simple</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/tomcat/rp/webapps/simpleWebapp</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz.systests</groupId>
- <artifactId>fediz-systests-tests</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/test-classes</outputDirectory>
- <includes>**/*.jks</includes>
- </artifactItem>
- </artifactItems>
- <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <stripVersion>true</stripVersion>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.7</version>
- <executions>
- <execution>
- <id>copy-entities-to-idp</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/target/tomcat/idp/webapps/fediz-idp/WEB-INF/classes</outputDirectory>
- <resources>
- <resource>
- <directory>${basedir}/src/test/resources/realma</directory>
- <includes>
- <include>entities-realma.xml</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>integration-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>integration-test</goal>
- </goals>
- <configuration>
- <skip>${skipTests}</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>
- <java.util.logging.config.file>${basedir}/target/test-classes/logging.properties</java.util.logging.config.file>
- </systemPropertyVariables>
- <includes>
- <include>**/integrationtests/**</include>
- </includes>
- <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=256m </argLine>
- <!--argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=256m -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y</argLine-->
- </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>
- <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/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/AudienceRestrictionTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/AudienceRestrictionTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/AudienceRestrictionTest.java
deleted file mode 100644
index 929e6f6..0000000
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/AudienceRestrictionTest.java
+++ /dev/null
@@ -1,210 +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.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.tomcat7.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/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
deleted file mode 100644
index 4ecacf0..0000000
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ /dev/null
@@ -1,172 +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 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.tomcat7.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/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java
deleted file mode 100644
index a323696..0000000
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java
+++ /dev/null
@@ -1,48 +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.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");
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
deleted file mode 100644
index c67ba64..0000000
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
+++ /dev/null
@@ -1,244 +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.tomcat7.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 'alice@realma.org'",
- bodyTextContent.contains(claim + "=alice@realma.org"));
-
- webClient.close();
- }
-
-}
[7/7] cxf-fediz git commit: FEDIZ-204 - Drop Tomcat7, Jetty8,
Spring Sec 2 containers
Posted by co...@apache.org.
FEDIZ-204 - Drop Tomcat7, Jetty8, Spring Sec 2 containers
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/e392e637
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/e392e637
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/e392e637
Branch: refs/heads/master
Commit: e392e637f2528cb363b882a55d1ac8b7e8f8b293
Parents: 41bed79
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Jul 11 17:19:29 2017 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Jul 11 17:19:29 2017 +0100
----------------------------------------------------------------------
apache-fediz/pom.xml | 15 -
apache-fediz/src/assembly/bin.xml | 69 ---
examples/pom.xml | 1 -
examples/spring2Webapp/README.txt | 81 ---
examples/spring2Webapp/pom.xml | 134 -----
.../cxf/fediz/example/FederationServlet.java | 125 ----
.../src/main/resources/log4j.properties | 22 -
.../src/main/resources/ststrust.jks | Bin 4052 -> 0 bytes
.../WEB-INF/applicationContext-security.xml | 67 ---
.../src/main/webapp/WEB-INF/fediz_config.xml | 55 --
.../src/main/webapp/WEB-INF/web.xml | 77 ---
.../spring2Webapp/src/main/webapp/index.html | 25 -
.../src/main/webapp/secure/test.html | 25 -
examples/wsclientWebapp/webapp/pom.xml | 2 +-
plugins/jetty8/README.txt | 10 -
plugins/jetty8/pom.xml | 147 -----
plugins/jetty8/src/main/assembly/assembly.xml | 37 --
.../fediz/jetty8/FederationAuthenticator.java | 594 -------------------
.../fediz/jetty8/FederationIdentityService.java | 92 ---
.../fediz/jetty8/FederationLoginService.java | 174 ------
.../fediz/jetty8/FederationUserIdentity.java | 94 ---
.../fediz/jetty8/FederationUserPrincipal.java | 71 ---
plugins/pom.xml | 3 -
plugins/spring2/README.txt | 20 -
plugins/spring2/pom.xml | 119 ----
plugins/spring2/src/main/assembly/assembly.xml | 37 --
.../cxf/fediz/spring/FederationConfig.java | 33 --
.../cxf/fediz/spring/FederationConfigImpl.java | 106 ----
.../apache/cxf/fediz/spring/FederationUser.java | 53 --
.../fediz/spring/SpringFedizMessageSource.java | 45 --
.../AbstractFederationUserDetailsService.java | 55 --
.../authentication/ExpiredTokenException.java | 35 --
.../FederationAuthenticationProvider.java | 169 ------
.../FederationAuthenticationToken.java | 107 ----
.../FederationResponseAuthenticationToken.java | 50 --
...AuthoritiesUserDetailsFederationService.java | 67 ---
...erationPreAuthenticatedProcessingFilter.java | 80 ---
...AuthoritiesUserDetailsFederationService.java | 91 ---
.../web/FederationAuthenticationEntryPoint.java | 155 -----
.../web/FederationAuthenticationFilter.java | 227 -------
.../apache/cxf/fediz/spring/messages.properties | 2 -
plugins/tomcat7/README.txt | 10 -
plugins/tomcat7/pom.xml | 77 ---
plugins/tomcat7/src/main/assembly/assembly.xml | 37 --
.../fediz/tomcat7/FederationAuthenticator.java | 435 --------------
.../fediz/tomcat7/FederationPrincipalImpl.java | 60 --
.../tomcat7/handler/TomcatLogoutHandler.java | 58 --
.../tomcat7/handler/TomcatSigninHandler.java | 89 ---
.../src/test/resources/logging.properties | 52 --
pom.xml | 3 -
systests/custom/pom.xml | 18 +-
.../systests/custom/CustomParametersTest.java | 2 +-
systests/cxf/pom.xml | 16 +-
systests/federation/samlsso/pom.xml | 18 +-
systests/federation/wsfed/pom.xml | 18 +-
.../cxf/fediz/integrationtests/WSFedTest.java | 2 +-
systests/idp/pom.xml | 18 +-
systests/jetty8/pom.xml | 300 ----------
.../ClientCertificatePreAuthSpringTest.java | 98 ---
.../integrationtests/ClientCertificateTest.java | 98 ---
.../integrationtests/HOKCallbackHandler.java | 48 --
.../JettyPreAuthSpringTest.java | 83 ---
.../cxf/fediz/integrationtests/JettyTest.java | 82 ---
.../cxf/fediz/integrationtests/JettyUtils.java | 105 ----
.../jetty8/src/test/resources/fediz_config.xml | 95 ---
.../test/resources/fediz_config_client_cert.xml | 99 ----
.../jetty8/src/test/resources/idp-server.xml | 79 ---
.../src/test/resources/logging.properties | 54 --
.../test/resources/rp-client-cert-server.xml | 99 ----
.../jetty8/src/test/resources/rp-server.xml | 96 ---
systests/jetty9/pom.xml | 17 -
systests/kerberos/pom.xml | 18 +-
.../fediz/integrationtests/KerberosTest.java | 2 +-
systests/ldap/pom.xml | 18 +-
.../cxf/fediz/integrationtests/LDAPTest.java | 2 +-
systests/oidc/pom.xml | 6 -
systests/pom.xml | 2 -
systests/samlsso/pom.xml | 18 +-
systests/spring/pom.xml | 24 +-
.../cxf/fediz/integrationtests/Spring2Test.java | 261 --------
systests/tomcat7/pom.xml | 257 --------
.../AudienceRestrictionTest.java | 210 -------
.../integrationtests/ClientCertificateTest.java | 172 ------
.../integrationtests/HOKCallbackHandler.java | 48 --
.../fediz/integrationtests/HolderOfKeyTest.java | 244 --------
.../integrationtests/TestCallbackHandler.java | 48 --
.../cxf/fediz/integrationtests/TomcatTest.java | 172 ------
.../cxf/fediz/integrationtests/WReqTest.java | 246 --------
systests/tomcat7/src/test/resources/alice.cer | Bin 873 -> 0 bytes
.../tomcat7/src/test/resources/fediz_config.xml | 61 --
.../test/resources/fediz_config_aud_restr.xml | 61 --
.../test/resources/fediz_config_client_cert.xml | 63 --
.../src/test/resources/fediz_config_hok.xml | 57 --
.../src/test/resources/fediz_config_wreq.xml | 57 --
.../src/test/resources/logging.properties | 54 --
.../test/resources/realma/entities-realma.xml | 474 ---------------
systests/tomcat8/pom.xml | 6 -
systests/webapps/pom.xml | 1 -
systests/webapps/spring2Webapp/pom.xml | 135 -----
.../cxf/fediz/example/FederationServlet.java | 108 ----
.../src/main/resources/clienttrust.jks | Bin 1512 -> 0 bytes
.../src/main/resources/log4j.properties | 16 -
.../src/main/resources/logging.properties | 53 --
.../WEB-INF/applicationContext-security.xml | 88 ---
.../src/main/webapp/WEB-INF/web.xml | 95 ---
.../spring2Webapp/src/main/webapp/index.html | 25 -
.../src/main/webapp/secure/test.html | 25 -
systests/websphere/pom.xml | 18 +-
108 files changed, 33 insertions(+), 8749 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/apache-fediz/pom.xml
----------------------------------------------------------------------
diff --git a/apache-fediz/pom.xml b/apache-fediz/pom.xml
index 45283d2..f2ee772 100644
--- a/apache-fediz/pom.xml
+++ b/apache-fediz/pom.xml
@@ -59,21 +59,11 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
<artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-jetty8</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
<artifactId>fediz-jetty9</artifactId>
<version>${project.version}</version>
</dependency>
@@ -84,11 +74,6 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-spring2</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
<artifactId>fediz-spring3</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/apache-fediz/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/apache-fediz/src/assembly/bin.xml b/apache-fediz/src/assembly/bin.xml
index d1d0647..2f5f40c 100644
--- a/apache-fediz/src/assembly/bin.xml
+++ b/apache-fediz/src/assembly/bin.xml
@@ -124,24 +124,6 @@
<scope>runtime</scope>
</dependencySet>
<dependencySet>
- <outputDirectory>apache-fediz-${project.version}/plugins/tomcat7/lib</outputDirectory>
- <unpack>false</unpack>
- <useTransitiveFiltering>true</useTransitiveFiltering>
- <excludes>
- <exclude>org.apache.cxf.fediz:fediz-idp</exclude>
- <exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
- <exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
- <exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring3</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- </excludes>
- <scope>runtime</scope>
- </dependencySet>
- <dependencySet>
<outputDirectory>apache-fediz-${project.version}/plugins/tomcat8/lib</outputDirectory>
<unpack>false</unpack>
<useTransitiveFiltering>true</useTransitiveFiltering>
@@ -149,30 +131,9 @@
<exclude>org.apache.cxf.fediz:fediz-idp</exclude>
<exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
<exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
<exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
<exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring3</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
- </excludes>
- <scope>runtime</scope>
- </dependencySet>
- <dependencySet>
- <outputDirectory>apache-fediz-${project.version}/plugins/jetty8/lib</outputDirectory>
- <unpack>false</unpack>
- <useTransitiveFiltering>true</useTransitiveFiltering>
- <excludes>
- <exclude>org.apache.cxf.fediz:fediz-idp</exclude>
- <exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
- <exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
- <exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring3</exclude>
</excludes>
<scope>runtime</scope>
@@ -185,12 +146,9 @@
<exclude>org.apache.cxf.fediz:fediz-idp</exclude>
<exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
<exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
<exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
<exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring3</exclude>
</excludes>
<scope>runtime</scope>
@@ -203,12 +161,9 @@
<exclude>org.apache.cxf.fediz:fediz-idp</exclude>
<exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
<exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
<exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
<exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
<exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2:jar</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring3:jar</exclude>
</excludes>
<scope>runtime</scope>
@@ -221,31 +176,10 @@
<exclude>org.apache.cxf.fediz:fediz-idp</exclude>
<exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
<exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
- <exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring:jar</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2:jar</exclude>
- </excludes>
- <scope>runtime</scope>
- </dependencySet>
- <dependencySet>
- <outputDirectory>apache-fediz-${project.version}/plugins/spring2/lib</outputDirectory>
- <unpack>false</unpack>
- <useTransitiveFiltering>true</useTransitiveFiltering>
- <excludes>
- <exclude>org.apache.cxf.fediz:fediz-idp</exclude>
- <exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
- <exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
<exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
<exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
<exclude>org.apache.cxf.fediz:fediz-cxf</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring:jar</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring3:jar</exclude>
</excludes>
<scope>runtime</scope>
</dependencySet>
@@ -257,12 +191,9 @@
<exclude>org.apache.cxf.fediz:fediz-idp</exclude>
<exclude>org.apache.cxf.fediz:fediz-idp-sts</exclude>
<exclude>org.apache.cxf.fediz:fediz-oidc</exclude>
- <exclude>org.apache.cxf.fediz:fediz-tomcat7</exclude>
<exclude>org.apache.cxf.fediz:fediz-tomcat8</exclude>
- <exclude>org.apache.cxf.fediz:fediz-jetty8</exclude>
<exclude>org.apache.cxf.fediz:fediz-jetty9</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring</exclude>
- <exclude>org.apache.cxf.fediz:fediz-spring2</exclude>
<exclude>org.apache.cxf.fediz:fediz-spring3</exclude>
</excludes>
<scope>runtime</scope>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 8ea1b08..bae8a08 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -35,7 +35,6 @@
<module>simpleWebapp</module>
<module>wsclientWebapp</module>
<module>springWebapp</module>
- <module>spring2Webapp</module>
<module>springPreauthWebapp</module>
<module>jaxrsSimpleWebapp</module>
<module>jaxrsSpringSecurityWebapp</module>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/README.txt
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/README.txt b/examples/spring2Webapp/README.txt
deleted file mode 100644
index 5b25fc0..0000000
--- a/examples/spring2Webapp/README.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-Simple Spring Web Application Demo
-==================================
-
-This demo shows how to build and deploy an SSO protected web application
-using Apache CXF Fediz. The web application uses spring security 2 for
-authentication and authorization natively which provides a richer security
-API and configuration than the Java Servlet API.
-
-If you still want to enforce security on the container level but want to use
-spring security's features the demo 'springPreAuthWebapp' illustrates that.
-
-Running this sample consists of four steps:
-
-- Configure the Tomcat-IDP and Servlet Container for RP instances
-- Building the demo using Maven
-- Deploying the demo to the RP instance
-- Testing the demo
-
-Please review the README in the samples main directory before continuing.
-
-Configure the Tomcat-IDP and Servlet Container for RP instances
----------------------------------------------------------------
-First, make sure the separate Tomcat instance hosting the Fediz IDP and IDP
-STS has been configured and is running as described here:
-http://cxf.apache.org/fediz-idp.html. Confirm the STS is active by
-checking that the WSDL is viewable from the browser using the URL given
-on that page--don't proceed further unless it is.
-
-The benefit of using Spring Security 2 which is packaged with the demo application
-there are no plugin deployments required for the RP Servlet Container.
-See this wiki page for instructions:
-http://cxf.apache.org/fediz-spring-2.html -- the "HTTPS Configuration" sections
-are the only parts that need configuration for this sample.
-
-
-Demo Web Application
---------------------
-The main code lives in the class FederationServlet. This Servlet is protected
-and can be accessed only if the browser user is authenticated. The purpose of
-the FederationServlet is to illustrate the usage of the Spring Security 2 API and
-Configuration to get the authenticated user and to check the roles he has. Further,
-the FederationServlet shows how to access claims data (user data) which were
-stored in the SAML token by using the Fediz interface FedizPrincipal.
-Beyond that, the FederationServlet illustrates how to access the SAML token
-if required. The classes SecurityTokenThreadLocal.java and FederationFilter.java
-can be used to achieve that. You could get this information directly from the
-HTTP session.
-
-
-Building the demo using Maven
------------------------------
-From the base directory of this sample (i.e., where this README file is
-located), the pom.xml file is used to build and run the demo. From a
-command prompt, enter:
-
- mvn clean install (builds the demo and creates a WAR file for Servlet deployment)
-
-
-Deploying the demo to Tomcat
-----------------------------
-Either manually copy this sample's generated WAR file to the Tomcat-RP's
-webapps folder, or use the Tomcat Maven Plugin as described in the README file
-in the example folder root.
-It's recommended to not deploy this WAR into Servlet Container where Fediz is
-integrated into the Security Layer of the Container itself.
-
-
-Test the demo
--------------
-Enter the following URL into the browser (TCP port depends on your HTTP settings):
-
-https://localhost:10443/fedizhelloworld/secure/fedservlet
-
-The browser is redirected to the IDP and prompts for username and password. As described
-in the IDP installation, the following users are already set up:
-
-User: alice Password: ecila
-User: bob Password: bob
-User: ted Password: det
-
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/pom.xml b/examples/spring2Webapp/pom.xml
deleted file mode 100644
index 128138c..0000000
--- a/examples/spring2Webapp/pom.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?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>examples</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.cxf.fediz.examples</groupId>
- <artifactId>spring2Webapp</artifactId>
- <name>Fediz Example: Spring2Webapp</name>
- <packaging>war</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <spring.security.version>2.0.8.RELEASE</spring.security.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>${servlet.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-spring2</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>${spring.security.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons.lang.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.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:10080/manager/text</url>
- <path>/${project.build.finalName}</path>
- </configuration>
- </plugin>
- </plugins>
- <!-- Name of the generated WAR file -->
- <finalName>fedizhelloworld</finalName>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java b/examples/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
deleted file mode 100644
index 2c6054d..0000000
--- a/examples/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
+++ /dev/null
@@ -1,125 +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.example;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.security.Principal;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.Element;
-
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.cxf.fediz.core.Claim;
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.apache.cxf.fediz.core.SecurityTokenThreadLocal;
-import org.apache.cxf.fediz.spring.FederationUser;
-import org.apache.cxf.fediz.spring.authentication.FederationAuthenticationToken;
-
-import org.springframework.security.Authentication;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.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 Spring Security Example</title></head>");
- out.println("<body>");
- out.println("<h1>Hello World</h1>");
- out.println("Hello world<br>");
- out.println("Request url: " + request.getRequestURL().toString() + "<p>");
-
-
- out.println("<br><b>User</b><p>");
- Principal p = request.getUserPrincipal();
- if (p != null) {
- out.println("Principal: " + p.getName() + "<p>");
- }
-
- // Access Spring security context
- Authentication auth = SecurityContextHolder.getContext().getAuthentication();
- if (auth instanceof FederationAuthenticationToken) {
- out.println("Roles of user:<p><ul>");
- FederationAuthenticationToken fedAuthToken = (FederationAuthenticationToken)auth;
- for (GrantedAuthority item : fedAuthToken.getAuthorities()) {
- out.println("<li>" + item.getAuthority() + "</li>");
- }
- out.println("</ul>");
-
- if (fedAuthToken.getUserDetails() instanceof FederationUser) {
- out.println("<br><b>Claims</b><p>");
- ClaimCollection claims = ((FederationUser)fedAuthToken.getUserDetails()).getClaims();
- for (Claim c: claims) {
- out.println(c.getClaimType().toString() + ": " + c.getValue() + "<p>");
- }
- } else {
- out.println("FederationAuthenticationToken found but not FederationUser");
- }
-
- } else {
- out.println("No FederationAuthenticationToken found in Spring Security Context.");
- }
-
- Element el = SecurityTokenThreadLocal.getToken();
- if (el != null) {
- out.println("<p>Bootstrap token...");
- String token = null;
- try {
- TransformerFactory transFactory = TransformerFactory.newInstance();
- Transformer transformer = transFactory.newTransformer();
- StringWriter buffer = new StringWriter();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.transform(new DOMSource(el),
- new StreamResult(buffer));
- token = buffer.toString();
- out.println("<p>" + StringEscapeUtils.escapeXml(token));
- } catch (Exception ex) {
- out.println("<p>Failed to transform cached element to string: " + ex.toString());
- }
- } else {
- out.println("<p>Bootstrap token not cached in thread local storage");
- }
-
- out.println("</body>");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/resources/log4j.properties b/examples/spring2Webapp/src/main/resources/log4j.properties
deleted file mode 100644
index e16244a..0000000
--- a/examples/spring2Webapp/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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=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
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/resources/ststrust.jks
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/resources/ststrust.jks b/examples/spring2Webapp/src/main/resources/ststrust.jks
deleted file mode 100644
index 8cf20a5..0000000
Binary files a/examples/spring2Webapp/src/main/resources/ststrust.jks and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml b/examples/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml
deleted file mode 100644
index 94b0c6a..0000000
--- a/examples/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?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.
--->
-<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"
- xsi:schemaLocation="
- http://www.springframework.org/schema/security
- http://www.springframework.org/schema/security/spring-security-2.0.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
-
- <sec:http entry-point-ref="federationEntryPoint">
- <sec:intercept-url pattern="/secure/fedservlet"
- access="IS_AUTHENTICATED_FULLY" />
- <sec:intercept-url pattern="/secure/manager/**"
- access="ROLE_MANAGER" />
- <sec:intercept-url pattern="/secure/admin/**"
- access="ROLE_ADMIN" />
- <sec:intercept-url pattern="/secure/user/**"
- access="ROLE_USER,ROLE_ADMIN,ROLE_MANAGER" />
- </sec:http>
-
- <sec:authentication-manager alias="authManager" />
-
- <bean id="fedizConfig" class="org.apache.cxf.fediz.spring.FederationConfigImpl"
- init-method="init" p:configFile="WEB-INF/fediz_config.xml"
- p:contextName="/fedizhelloworld" />
-
- <bean id="federationEntryPoint"
- class="org.apache.cxf.fediz.spring.web.FederationAuthenticationEntryPoint"
- p:federationConfig-ref="fedizConfig" />
-
- <bean id="federationFilter"
- class="org.apache.cxf.fediz.spring.web.FederationAuthenticationFilter"
- p:authenticationManager-ref="authManager" p:defaultTargetUrl="/whatever">
- <sec:custom-filter after="BASIC_PROCESSING_FILTER" />
- </bean>
-
- <bean id="federationAuthProvider"
- class="org.apache.cxf.fediz.spring.authentication.FederationAuthenticationProvider"
- p:federationConfig-ref="fedizConfig">
- <sec:custom-authentication-provider />
- <property name="authenticationUserDetailsService">
- <bean
- class="org.apache.cxf.fediz.spring.authentication.GrantedAuthoritiesUserDetailsFederationService" />
- </property>
- </bean>
-</beans>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/webapp/WEB-INF/fediz_config.xml
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/webapp/WEB-INF/fediz_config.xml b/examples/spring2Webapp/src/main/webapp/WEB-INF/fediz_config.xml
deleted file mode 100644
index b6d4a19..0000000
--- a/examples/spring2Webapp/src/main/webapp/WEB-INF/fediz_config.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's file.
- Keystore referenced below must have IDP STS' public cert included in it. This example uses the
- ststrust Truststore (ststrust.jks) for this task.
- In Fediz 1.0, one keystore was used for SSL and the STS public certificate.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="ststrust.jks" password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </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:9443/fediz-idp/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <reply>/j_spring_fediz_security_check</reply>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- </protocol>
- </contextConfig>
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/webapp/WEB-INF/web.xml b/examples/spring2Webapp/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 91b71d0..0000000
--- a/examples/spring2Webapp/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?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.
--->
-<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>
-
- <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.core.servlet.FederationFilter</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/applicationContext-security.xml</param-value>
- </context-param>
-
- <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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/webapp/index.html b/examples/spring2Webapp/src/main/webapp/index.html
deleted file mode 100644
index a9dbdaa..0000000
--- a/examples/spring2Webapp/src/main/webapp/index.html
+++ /dev/null
@@ -1,25 +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.
--->
-<!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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/spring2Webapp/src/main/webapp/secure/test.html
----------------------------------------------------------------------
diff --git a/examples/spring2Webapp/src/main/webapp/secure/test.html b/examples/spring2Webapp/src/main/webapp/secure/test.html
deleted file mode 100644
index 9cf7366..0000000
--- a/examples/spring2Webapp/src/main/webapp/secure/test.html
+++ /dev/null
@@ -1,25 +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.
--->
-<!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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/examples/wsclientWebapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/wsclientWebapp/webapp/pom.xml b/examples/wsclientWebapp/webapp/pom.xml
index 9ad9800..598e035 100644
--- a/examples/wsclientWebapp/webapp/pom.xml
+++ b/examples/wsclientWebapp/webapp/pom.xml
@@ -48,7 +48,7 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>provided</scope>
</dependency>
<!-- Required to cast Principal to FedizPrincipal -->
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/README.txt
----------------------------------------------------------------------
diff --git a/plugins/jetty8/README.txt b/plugins/jetty8/README.txt
deleted file mode 100644
index 266a6f8..0000000
--- a/plugins/jetty8/README.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Fediz configuration in Jetty
-----------------------------
-
-The Jetty installation must be updated before a Web Application can be deployed.
-
-The following wiki page gives instructions how to do that:
-http://cxf.apache.org/fediz-jetty.html
-
-The following wiki page explains the fediz configuration which is Container independent:
-http://cxf.apache.org/fediz-configuration.html
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/jetty8/pom.xml b/plugins/jetty8/pom.xml
deleted file mode 100644
index db5acdb..0000000
--- a/plugins/jetty8/pom.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-<?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>plugin</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>fediz-jetty8</artifactId>
- <name>Apache Fediz Plugin for Jetty 8</name>
- <packaging>bundle</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty8.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- <version>${jetty8.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty8.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-core</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>zip-file</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Implementation-Title>Apache CXF Fediz</Implementation-Title>
- <Implementation-Vendor>The Apache Software
- Foundation</Implementation-Vendor>
- <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
- <Implementation-Version>${project.version}</Implementation-Version>
- <Specification-Title>Apache CXF Fediz</Specification-Title>
- <Specification-Vendor>The Apache Software
- Foundation</Specification-Vendor>
- <Specification-Version>${project.version}</Specification-Version>
- <Export-Package>
- org.apache.cxf.fediz.jetty.*;version="${project.version}"
- </Export-Package>
- <Import-Package>
- !org.apache.cxf.fediz.jetty*,
- org.eclipse.jetty.*;version="[7.6,9)",
- org.apache.cxf.fediz.core.*,
- *;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
-<!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <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>
- </artifactItems>
- <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
- <outputDirectory>target</outputDirectory>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </execution>
- </executions>
- </plugin>
--->
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/plugins/jetty8/src/main/assembly/assembly.xml b/plugins/jetty8/src/main/assembly/assembly.xml
deleted file mode 100644
index 99a74db..0000000
--- a/plugins/jetty8/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
-http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>zip-with-dependencies</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- <unpack>false</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationAuthenticator.java b/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationAuthenticator.java
deleted file mode 100644
index e3ff3c7..0000000
--- a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationAuthenticator.java
+++ /dev/null
@@ -1,594 +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.jetty8;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import javax.xml.bind.JAXBException;
-
-import org.apache.cxf.fediz.core.FederationConstants;
-import org.apache.cxf.fediz.core.SAMLSSOConstants;
-import org.apache.cxf.fediz.core.config.FederationProtocol;
-import org.apache.cxf.fediz.core.config.FedizConfigurator;
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.config.SAMLProtocol;
-import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.metadata.MetadataDocumentHandler;
-import org.apache.cxf.fediz.core.processor.FedizProcessor;
-import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
-import org.apache.cxf.fediz.core.processor.FedizRequest;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.apache.cxf.fediz.core.processor.RedirectionResponse;
-import org.eclipse.jetty.http.HttpMethods;
-import org.eclipse.jetty.http.MimeTypes;
-import org.eclipse.jetty.security.ServerAuthException;
-import org.eclipse.jetty.security.UserAuthentication;
-import org.eclipse.jetty.security.authentication.DeferredAuthentication;
-import org.eclipse.jetty.security.authentication.LoginAuthenticator;
-import org.eclipse.jetty.security.authentication.SessionAuthentication;
-import org.eclipse.jetty.server.AbstractHttpConnection;
-import org.eclipse.jetty.server.Authentication;
-import org.eclipse.jetty.server.Authentication.User;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.UserIdentity;
-import org.eclipse.jetty.util.MultiMap;
-import org.eclipse.jetty.util.URIUtil;
-import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.Logger;
-
-/**
- * Federation Authenticator.
- * <p>
- * This authenticator implements form authentication will redirect to the Identity Provider
- * by sending a WS-Federation SignIn request.
- * </p>
- * <p>
- * The federation authenticator redirects unauthenticated requests to an Identity Provider which use any kind of
- * mechanism to authenticate the user.
- * FederationAuthentication uses {@link SessionAuthentication} to wrap Authentication results so that they are
- * associated with the session.
- * </p>
- */
-public class FederationAuthenticator extends LoginAuthenticator {
-
- public static final String J_URI = "org.eclipse.jetty.security.form_URI";
- public static final String J_POST = "org.eclipse.jetty.security.form_POST";
- public static final String J_CONTEXT = "org.eclipse.jetty.security.form_CONTEXT";
-
- private static final Logger LOG = Log.getLogger(FederationAuthenticator.class);
-
- private static final String SECURITY_TOKEN_ATTR = "org.apache.fediz.SECURITY_TOKEN";
-
- private String configFile;
- private FedizConfigurator configurator;
- private String encoding = "UTF-8";
-
- public FederationAuthenticator() {
- }
-
-
- /**
- *
- */
- @Override
- public void setConfiguration(AuthConfiguration configuration) {
- super.setConfiguration(configuration);
- // is called after the bean setting -> do initialization here
- LOG.debug(configuration.getInitParameterNames().toString());
- try {
- File f = new File(getConfigFile());
- if (!f.exists()) {
- String jettyHome = System.getProperty("jetty.home");
- if (jettyHome != null && jettyHome.length() > 0) {
- f = new File(jettyHome.concat(File.separator + getConfigFile()));
- }
- }
- configurator = new FedizConfigurator();
- configurator.loadConfig(f);
- LOG.debug("Fediz configuration read from " + f.getAbsolutePath());
- } catch (JAXBException | IOException e) {
- //[TODO] use other exception
- throw new RuntimeException("Failed to load Fediz configuration",
- e);
- //throw new ServerAuthException("Failed to load Fediz configuration",
- // e);
- }
-
- }
-
- /* ------------------------------------------------------------ */
- public String getAuthMethod() {
- return "WSFED";
- }
-
- public String getConfigFile() {
- return configFile;
- }
-
- public void setConfigFile(String configFile) {
- this.configFile = configFile;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- /* ------------------------------------------------------------ */
- public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory)
- throws ServerAuthException {
-
- HttpServletRequest request = (HttpServletRequest)req;
- HttpServletResponse response = (HttpServletResponse)res;
-
- HttpSession session = request.getSession(true);
-
- String contextName = request.getSession().getServletContext().getContextPath();
- if (contextName == null || contextName.isEmpty()) {
- contextName = "/";
- }
- FedizContext fedConfig = getContextConfiguration(contextName);
-
- // Check to see if it is a metadata request
- MetadataDocumentHandler mdHandler = new MetadataDocumentHandler(fedConfig);
- if (mdHandler.canHandleRequest(request)) {
- Authentication authentication = Authentication.SEND_FAILURE;
- if (mdHandler.handleRequest(request, response)) {
- authentication = Authentication.SEND_CONTINUE;
- }
- return authentication;
- }
-
- if (!mandatory) {
- return new DeferredAuthentication(this);
- }
-
- try {
- req.setCharacterEncoding(this.encoding);
- } catch (UnsupportedEncodingException ex) {
- LOG.warn("Unsupported encoding '" + this.encoding + "'", ex);
- }
-
- try {
- String action = request.getParameter(FederationConstants.PARAM_ACTION);
- Authentication authentication = null;
-
- // Handle a request for authentication.
- if (isSignInRequest(request, fedConfig)) {
- authentication = handleSignInRequest(request, response, session, fedConfig);
- } else if (FederationConstants.ACTION_SIGNOUT_CLEANUP.equals(action)) {
- authentication = handleSignOutCleanup(response, session);
- } else if (!FederationConstants.ACTION_SIGNOUT.equals(action) && action != null) {
- LOG.warn("Not supported action found in parameter wa: " + action);
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- authentication = Authentication.UNAUTHENTICATED;
- }
-
- if (authentication != null) {
- return authentication;
- }
-
- // Look for cached authentication
- authentication = handleCachedAuthentication(request, response, session, fedConfig);
- if (authentication != null) {
- return authentication;
- }
-
-
- // if we can't send challenge
- if (DeferredAuthentication.isDeferred(response)) {
- LOG.debug("auth deferred {}", session.getId());
- return Authentication.UNAUTHENTICATED;
- }
-
- // remember the current URI
- synchronized (session) {
- // But only if it is not set already, or we save every uri that leads to a login form redirect
- if (session.getAttribute(J_URI) == null) { // || alwaysSaveUri)
- StringBuffer buf = request.getRequestURL();
- if (request.getQueryString() != null) {
- buf.append("?").append(request.getQueryString());
- }
- session.setAttribute(J_URI, buf.toString());
-
- if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(req.getContentType())
- && HttpMethods.POST.equals(request.getMethod())) {
- Request baseRequest = (req instanceof Request) ? (Request)req
- : AbstractHttpConnection.getCurrentConnection().getRequest();
- baseRequest.extractParameters();
- session.setAttribute(J_POST, new MultiMap<String>(baseRequest.getParameters()));
- }
- }
- }
-
- FedizProcessor wfProc =
- FedizProcessorFactory.newFedizProcessor(fedConfig.getProtocol());
- signInRedirectToIssuer(request, response, wfProc, session);
-
- return Authentication.SEND_CONTINUE;
-
- } catch (IOException e) {
- throw new ServerAuthException(e);
- }
- /*
- * catch (ServletException e) { throw new ServerAuthException(e); }
- */
- }
-
- private Authentication handleSignInRequest(HttpServletRequest request, HttpServletResponse response,
- HttpSession session, FedizContext fedConfig) throws IOException {
- FedizResponse wfRes = null;
- if (LOG.isDebugEnabled()) {
- LOG.debug("SignIn request found");
- }
-
- String action = request.getParameter(FederationConstants.PARAM_ACTION);
- String responseToken = getResponseToken(request, fedConfig);
- if (responseToken == null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("SignIn request must contain a response token from the IdP");
- }
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return Authentication.SEND_FAILURE;
- } else {
-
- FedizRequest wfReq = new FedizRequest();
- wfReq.setAction(action);
- wfReq.setResponseToken(responseToken);
- wfReq.setState(request.getParameter("RelayState"));
- wfReq.setRequest(request);
-
- X509Certificate[] certs =
- (X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
- wfReq.setCerts(certs);
-
- FederationLoginService fedLoginService = (FederationLoginService)this._loginService;
- UserIdentity user = fedLoginService.login(null, wfReq, fedConfig);
- if (user != null) {
- session = renewSession(request, response);
-
- // Redirect to original request
- String nuri;
- synchronized (session) {
- // Check the context
- String savedContext = (String) session.getAttribute(J_CONTEXT);
- String receivedContext = request.getParameter(FederationConstants.PARAM_CONTEXT);
- if (savedContext == null || !savedContext.equals(receivedContext)) {
- LOG.warn("The received wctx parameter does not match the saved value");
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
- return Authentication.UNAUTHENTICATED;
- }
-
- nuri = (String) session.getAttribute(J_URI);
-
- if (nuri == null || nuri.length() == 0) {
- nuri = request.getContextPath();
- if (nuri.length() == 0) {
- nuri = URIUtil.SLASH;
- }
- }
- Authentication cached = new SessionAuthentication(getAuthMethod(), user, wfRes);
- session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, cached);
- }
-
- FederationUserIdentity fui = (FederationUserIdentity)user;
- session.setAttribute(SECURITY_TOKEN_ATTR, fui.getToken());
-
- response.setContentLength(0);
- response.sendRedirect(response.encodeRedirectURL(nuri));
-
- return new FederationAuthentication(getAuthMethod(), user);
- }
-
- // not authenticated
- if (LOG.isDebugEnabled()) {
- LOG.debug("WSFED authentication FAILED");
- }
- if (response != null) {
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
- }
- return Authentication.UNAUTHENTICATED;
- }
- }
-
- private Authentication handleSignOutCleanup(HttpServletResponse response, HttpSession session) throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("SignOutCleanup request found");
- LOG.debug("SignOutCleanup action...");
- }
- session.invalidate();
-
- final ServletOutputStream responseOutputStream = response.getOutputStream();
- InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("logout.jpg");
- if (inputStream == null) {
- LOG.warn("Could not write logout.jpg");
- return Authentication.SEND_FAILURE;
- }
- int read = 0;
- byte[] buf = new byte[1024];
- while ((read = inputStream.read(buf)) != -1) {
- responseOutputStream.write(buf, 0, read);
- }
- inputStream.close();
- responseOutputStream.flush();
- return Authentication.SEND_SUCCESS;
- }
-
- private Authentication handleCachedAuthentication(HttpServletRequest request, HttpServletResponse response,
- HttpSession session, FedizContext fedConfig) throws IOException {
- Authentication authentication =
- (Authentication) session.getAttribute(SessionAuthentication.__J_AUTHENTICATED);
- if (authentication != null) {
- // Has authentication been revoked?
- if (authentication instanceof Authentication.User
- && isTokenExpired(fedConfig, ((Authentication.User)authentication).getUserIdentity())) {
- session.removeAttribute(SessionAuthentication.__J_AUTHENTICATED);
- } else {
- //logout
- String action = request.getParameter(FederationConstants.PARAM_ACTION);
- boolean logout = FederationConstants.ACTION_SIGNOUT.equals(action);
- String logoutUrl = fedConfig.getLogoutURL();
-
- String uri = request.getRequestURI();
- if (uri == null) {
- uri = URIUtil.SLASH;
- }
-
- String contextName = request.getSession().getServletContext().getContextPath();
- if (contextName == null || contextName.isEmpty()) {
- contextName = "/";
- }
-
- if (logout || logoutUrl != null && !logoutUrl.isEmpty() && uri.equals(contextName + logoutUrl)) {
- session.invalidate();
-
- FedizProcessor wfProc =
- FedizProcessorFactory.newFedizProcessor(fedConfig.getProtocol());
- signOutRedirectToIssuer(request, response, wfProc);
-
- return Authentication.SEND_CONTINUE;
- }
-
- String jUri = (String)session.getAttribute(J_URI);
- @SuppressWarnings("unchecked")
- MultiMap<String> jPost = (MultiMap<String>)session.getAttribute(J_POST);
- if (jUri != null && jPost != null) {
- StringBuffer buf = request.getRequestURL();
- if (request.getQueryString() != null) {
- buf.append("?").append(request.getQueryString());
- }
-
- if (jUri.equals(buf.toString())) {
- // This is a retry of an original POST request
- // so restore method and parameters
-
- session.removeAttribute(J_POST);
- Request baseRequest = (Request)request;
- // (req instanceof Request)?(Request)
- // req:HttpConnection.getCurrentConnection().getRequest();
- baseRequest.setMethod(HttpMethods.POST);
- baseRequest.setParameters(jPost);
- }
- } else if (jUri != null) {
- session.removeAttribute(J_URI);
- }
-
- return authentication;
- }
- }
- return null;
- }
-
- private boolean isTokenExpired(FedizContext fedConfig, UserIdentity userIdentity) {
- if (fedConfig.isDetectExpiredTokens()) {
- try {
- FederationUserIdentity fui = (FederationUserIdentity)userIdentity;
- Date tokenExpires = fui.getExpiryDate();
- if (tokenExpires == null) {
- LOG.debug("Token doesn't expire");
- return false;
- }
-
- Date currentTime = new Date();
- if (!currentTime.after(tokenExpires)) {
- return false;
- } else {
- LOG.warn("Token already expired. Clean up and redirect");
-
- return true;
- }
- } catch (ClassCastException ex) {
- LOG.warn("UserIdentity must be instance of FederationUserIdentity");
- throw new IllegalStateException("UserIdentity must be instance of FederationUserIdentity");
- }
- }
-
- return false;
- }
-
- private boolean isSignInRequest(ServletRequest request, FedizContext fedConfig) {
- if (fedConfig.getProtocol() instanceof FederationProtocol
- && FederationConstants.ACTION_SIGNIN.equals(
- request.getParameter(FederationConstants.PARAM_ACTION))) {
- return true;
- } else if (fedConfig.getProtocol() instanceof SAMLProtocol
- && request.getParameter(SAMLSSOConstants.RELAY_STATE) != null) {
- return true;
- }
-
- return false;
- }
-
- private String getResponseToken(ServletRequest request, FedizContext fedConfig) {
- if (fedConfig.getProtocol() instanceof FederationProtocol) {
- return request.getParameter(FederationConstants.PARAM_RESULT);
- } else if (fedConfig.getProtocol() instanceof SAMLProtocol) {
- return request.getParameter(SAMLSSOConstants.SAML_RESPONSE);
- }
- return null;
- }
-
- /* ------------------------------------------------------------ */
- public boolean secureResponse(ServletRequest req, ServletResponse res, boolean mandatory,
- User validatedUser) throws ServerAuthException {
- return true;
- }
-
- /**
- * Called to redirect sign-in to the IDP/Issuer
- *
- * @param request
- * Request we are processing
- * @param response
- * Response we are populating
- * @param processor
- * FederationProcessor
- * @param session The HTTPSession
- * @throws IOException
- * If the forward to the login page fails and the call to
- * {@link HttpServletResponse#sendError(int, String)} throws an
- * {@link IOException}
- */
- protected void signInRedirectToIssuer(HttpServletRequest request, HttpServletResponse response,
- FedizProcessor processor, HttpSession session)
- throws IOException {
-
- //Not supported in jetty 7.6
- //String contextName = request.getServletContext().getContextPath();
- String contextName = request.getSession().getServletContext().getContextPath();
- if (contextName == null || contextName.isEmpty()) {
- contextName = "/";
- }
- FedizContext fedCtx = this.configurator.getFedizContext(contextName);
- try {
- RedirectionResponse redirectionResponse = processor.createSignInRequest(request, fedCtx);
- String redirectURL = redirectionResponse.getRedirectionURL();
- if (redirectURL != null) {
- Map<String, String> headers = redirectionResponse.getHeaders();
- if (!headers.isEmpty()) {
- for (Entry<String, String> entry : headers.entrySet()) {
- response.addHeader(entry.getKey(), entry.getValue());
- }
- }
-
- synchronized (session) {
- session.setAttribute(J_CONTEXT, redirectionResponse.getRequestState().getState());
- }
-
- response.sendRedirect(redirectURL);
- } else {
- LOG.warn("Failed to create SignInRequest.");
- response.sendError(
- HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest.");
- }
- } catch (ProcessingException ex) {
- LOG.warn("Failed to create SignInRequest: " + ex.getMessage());
- response.sendError(
- HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest.");
- }
-
- }
-
- protected void signOutRedirectToIssuer(HttpServletRequest request, HttpServletResponse response,
- FedizProcessor processor)
- throws IOException {
-
- //Not supported in jetty 7.6
- //String contextName = request.getServletContext().getContextPath();
- String contextName = request.getSession().getServletContext().getContextPath();
- if (contextName == null || contextName.isEmpty()) {
- contextName = "/";
- }
- FedizContext fedCtx = this.configurator.getFedizContext(contextName);
- try {
- RedirectionResponse redirectionResponse =
- processor.createSignOutRequest(request, null, fedCtx); //TODO
- String redirectURL = redirectionResponse.getRedirectionURL();
- if (redirectURL != null) {
- Map<String, String> headers = redirectionResponse.getHeaders();
- if (!headers.isEmpty()) {
- for (Entry<String, String> entry : headers.entrySet()) {
- response.addHeader(entry.getKey(), entry.getValue());
- }
- }
-
- response.sendRedirect(redirectURL);
- } else {
- LOG.warn("Failed to create SignOutRequest.");
- response.sendError(
- HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignOutRequest.");
- }
- } catch (ProcessingException ex) {
- LOG.warn("Failed to create SignOutRequest: " + ex.getMessage());
- response.sendError(
- HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignOutRequest.");
- }
- }
-
- private FedizContext getContextConfiguration(String contextName) {
- if (configurator == null) {
- throw new IllegalStateException("No Fediz configuration available");
- }
- FedizContext config = configurator.getFedizContext(contextName);
- if (config == null) {
- throw new IllegalStateException("No Fediz configuration for context :" + contextName);
- }
-
- String jettyHome = System.getProperty("jetty.home");
- if (jettyHome != null && jettyHome.length() > 0) {
- config.setRelativePath(jettyHome);
- }
- return config;
- }
-
- /* ------------------------------------------------------------ */
- /**
- * This Authentication represents a just completed Federation authentication. Subsequent requests from the same
- * user are authenticated by the presents of a {@link SessionAuthentication} instance in their session.
- */
- public static class FederationAuthentication extends UserAuthentication implements
- Authentication.ResponseSent {
-
- public FederationAuthentication(String method, UserIdentity userIdentity) {
- super(method, userIdentity);
- }
-
- @Override
- public String toString() {
- return "WSFED" + super.toString();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationIdentityService.java
----------------------------------------------------------------------
diff --git a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationIdentityService.java b/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationIdentityService.java
deleted file mode 100644
index 9979789..0000000
--- a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationIdentityService.java
+++ /dev/null
@@ -1,92 +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.jetty8;
-
-import java.security.Principal;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.jetty.security.IdentityService;
-import org.eclipse.jetty.security.RoleRunAsToken;
-import org.eclipse.jetty.security.RunAsToken;
-import org.eclipse.jetty.server.UserIdentity;
-import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.Logger;
-
-
-/**
- * Federation Identity Service implementation.
- * This service handles only role reference maps passed in an
- * associated {@link org.eclipse.jetty.server.UserIdentity.Scope}. If there are roles
- * refs present, then associate will wrap the UserIdentity with one
- * that uses the role references in the
- * {@link org.eclipse.jetty.server.UserIdentity#isUserInRole(String, org.eclipse.jetty.server.UserIdentity.Scope)}
- * implementation. All other operations are effectively noops.
- *
- */
-public class FederationIdentityService implements IdentityService {
- private static final Logger LOG = Log.getLogger(FederationIdentityService.class);
-
- public FederationIdentityService() {
- }
-
-
- /**
- * If there are roles refs present in the scope, then wrap the UserIdentity
- * with one that uses the role references in the
- * {@link UserIdentity#isUserInRole(String, org.eclipse.jetty.server.UserIdentity.Scope)}
- */
- public Object associate(UserIdentity user) {
- return null;
- }
-
- public void disassociate(Object previous) {
- }
-
- public Object setRunAs(UserIdentity user, RunAsToken token) {
- return token;
- }
-
- public void unsetRunAs(Object lastToken) {
- }
-
- public RunAsToken newRunAsToken(String runAsName) {
- return new RoleRunAsToken(runAsName);
- }
-
- public UserIdentity getSystemUserIdentity() {
- return null;
- }
-
- public UserIdentity newUserIdentity(
- final Subject subject, final Principal userPrincipal, final String[] roles) {
-
- try {
- FederationUserPrincipal fup = (FederationUserPrincipal)userPrincipal;
- return new FederationUserIdentity(subject, userPrincipal, roles, fup.getFedizResponse());
- } catch (ClassCastException ex) {
- LOG.warn("Principal must be instance of FederationUserPrincipal");
- throw new IllegalStateException("Principal must be instance of FederationUserPrincipal");
- }
-
-
- }
-
-}
[2/7] cxf-fediz git commit: FEDIZ-204 - Drop Tomcat7, Jetty8,
Spring Sec 2 containers
Posted by co...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/web.xml b/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 4d3bbc4..0000000
--- a/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?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.
--->
-<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>
-
- <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.core.servlet.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>
-
-
- <!--
- - 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>
-
- <!--
- - 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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/webapp/index.html b/systests/webapps/spring2Webapp/src/main/webapp/index.html
deleted file mode 100644
index a9dbdaa..0000000
--- a/systests/webapps/spring2Webapp/src/main/webapp/index.html
+++ /dev/null
@@ -1,25 +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.
--->
-<!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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/webapp/secure/test.html
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/webapp/secure/test.html b/systests/webapps/spring2Webapp/src/main/webapp/secure/test.html
deleted file mode 100644
index 9cf7366..0000000
--- a/systests/webapps/spring2Webapp/src/main/webapp/secure/test.html
+++ /dev/null
@@ -1,25 +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.
--->
-<!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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/websphere/pom.xml
----------------------------------------------------------------------
diff --git a/systests/websphere/pom.xml b/systests/websphere/pom.xml
index d579975..c3e31c2 100644
--- a/systests/websphere/pom.xml
+++ b/systests/websphere/pom.xml
@@ -40,25 +40,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -69,7 +57,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
[5/7] cxf-fediz git commit: FEDIZ-204 - Drop Tomcat7, Jetty8,
Spring Sec 2 containers
Posted by co...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java
deleted file mode 100644
index 6b39c13..0000000
--- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java
+++ /dev/null
@@ -1,435 +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.tomcat7;
-
-import java.io.File;
-import java.io.IOException;
-import java.security.Principal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.JAXBException;
-
-import org.w3c.dom.Element;
-
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.Session;
-import org.apache.catalina.authenticator.Constants;
-import org.apache.catalina.authenticator.FormAuthenticator;
-import org.apache.catalina.authenticator.SavedRequest;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-import org.apache.catalina.deploy.LoginConfig;
-import org.apache.cxf.fediz.core.FederationConstants;
-import org.apache.cxf.fediz.core.FedizPrincipal;
-import org.apache.cxf.fediz.core.config.FedizConfigurator;
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.handler.LogoutHandler;
-import org.apache.cxf.fediz.core.metadata.MetadataDocumentHandler;
-import org.apache.cxf.fediz.core.processor.FedizProcessor;
-import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.apache.cxf.fediz.core.processor.RedirectionResponse;
-import org.apache.cxf.fediz.tomcat7.handler.TomcatLogoutHandler;
-import org.apache.cxf.fediz.tomcat7.handler.TomcatSigninHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FederationAuthenticator extends FormAuthenticator {
-
- public static final String SESSION_SAVED_REQUEST_PREFIX = "SAVED_REQUEST_";
- public static final String SESSION_SAVED_URI_PREFIX = "SAVED_URI_";
- public static final String FEDERATION_NOTE = "org.apache.cxf.fediz.tomcat.FEDERATION";
- public static final String REQUEST_STATE = "org.apache.cxf.fediz.REQUEST_STATE";
- public static final String SECURITY_TOKEN = "org.apache.fediz.SECURITY_TOKEN";
-
- /**
- * Descriptive information about this implementation.
- */
- protected static final String INFO = "org.apache.cxf.fediz.tomcat.WsFedAuthenticator/1.0";
- protected static final String TRUSTED_ISSUER = "org.apache.cxf.fediz.tomcat.TRUSTED_ISSUER";
-
- private static final Logger LOG = LoggerFactory.getLogger(FormAuthenticator.class);
-
- /**
- * Fediz Configuration file
- */
- protected String configFile;
- protected String encoding = "UTF-8";
-
- private FedizConfigurator configurator;
-
- public FederationAuthenticator() {
- LOG.debug("WsFedAuthenticator()");
- }
-
- /**
- * Return descriptive information about this Valve implementation.
- */
- @Override
- public String getInfo() {
- return INFO;
- }
-
- public String getConfigFile() {
- return configFile;
- }
-
- public void setConfigFile(String configFile) {
- this.configFile = configFile;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- @Override
- protected synchronized void startInternal() throws LifecycleException {
-
- try {
- File f = new File(getConfigFile());
- if (!f.exists()) {
- String catalinaBase = System.getProperty("catalina.base");
- if (catalinaBase != null && catalinaBase.length() > 0) {
- f = new File(catalinaBase.concat(File.separator + getConfigFile()));
- }
- }
- configurator = new FedizConfigurator();
- configurator.loadConfig(f);
- LOG.debug("Fediz configuration read from " + f.getAbsolutePath());
- } catch (JAXBException | IOException e) {
- throw new LifecycleException("Failed to load Fediz configuration", e);
- }
- super.startInternal();
-
- }
-
- @Override
- protected synchronized void stopInternal() throws LifecycleException {
- if (configurator != null) {
- List<FedizContext> fedContextList = configurator.getFedizContextList();
- if (fedContextList != null) {
- for (FedizContext fedContext : fedContextList) {
- try {
- fedContext.close();
- } catch (IOException ex) {
- //
- }
- }
- }
- }
- super.stopInternal();
- }
-
- protected synchronized FedizContext getContextConfiguration(String contextName) {
- if (configurator == null) {
- throw new IllegalStateException("No Fediz configuration available");
- }
- FedizContext config = configurator.getFedizContext(contextName);
- if (config == null) {
- throw new IllegalStateException("No Fediz configuration for context :" + contextName);
- }
- String catalinaBase = System.getProperty("catalina.base");
- if (catalinaBase != null && catalinaBase.length() > 0) {
- config.setRelativePath(catalinaBase);
- }
- return config;
- }
-
- @Override
- public void invoke(final Request request, final Response response) throws IOException, ServletException {
-
- LOG.debug("WsFedAuthenticator:invoke()");
- request.setCharacterEncoding(this.encoding);
-
- String contextName = request.getServletContext().getContextPath();
- if (contextName == null || contextName.isEmpty()) {
- contextName = "/";
- }
- FedizContext fedConfig = getContextConfiguration(contextName);
-
- MetadataDocumentHandler mdHandler = new MetadataDocumentHandler(fedConfig);
- if (mdHandler.canHandleRequest(request)) {
- mdHandler.handleRequest(request, response);
- return;
- }
-
- LogoutHandler logoutHandler = new TomcatLogoutHandler(fedConfig, contextName, request);
- if (logoutHandler.canHandleRequest(request)) {
- Element token = (Element)request.getSession().getAttribute(SECURITY_TOKEN);
- logoutHandler.setToken(token);
- logoutHandler.handleRequest(request, response);
- return;
- }
-
- super.invoke(request, response);
- }
-
- @Override
- public boolean authenticate(Request request, HttpServletResponse response,
- LoginConfig config) throws IOException {
-
- LOG.debug("authenticate invoked");
-
- String contextName = request.getServletContext().getContextPath();
- if (contextName == null || contextName.isEmpty()) {
- contextName = "/";
- }
- LOG.debug("reading configuration for context path: {}", contextName);
- FedizContext fedCtx = getContextConfiguration(contextName);
-
- // Handle Signin requests
- TomcatSigninHandler signinHandler = new TomcatSigninHandler(fedCtx);
- signinHandler.setLandingPage(landingPage);
- if (signinHandler.canHandleRequest(request)) {
- FedizPrincipal principal = signinHandler.handleRequest(request, response);
- if (principal != null) {
- LOG.debug("Authentication of '{}' was successful", principal);
- resumeRequest(request, response);
- } else {
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
- // The actual login will take place after redirect
- return false;
- }
-
- // Is this the re-submit of the original request URI after successful
- // authentication? If so, forward the *original* request instead.
- if (matchRequest(request)) {
- return restoreRequest(request, response);
- }
-
- // Check if user was authenticated previously and token is still valid
- if (checkUserAuthentication(request, response, fedCtx)) {
- return true;
- }
-
- LOG.info("No valid principal found in existing session. Redirecting to IDP");
- redirectToIdp(request, response, fedCtx);
- return false;
- }
-
- protected void resumeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
- String contextId = request.getParameter(FederationConstants.PARAM_CONTEXT);
- if (contextId == null) {
- LOG.warn("The 'wctx' parameter has not been provided back with signin request.");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-
- } else {
- Session session = ((Request)request).getSessionInternal();
- String originalURL = (String)session.getNote(FederationAuthenticator.SESSION_SAVED_URI_PREFIX + contextId);
- session.removeNote(FederationAuthenticator.SESSION_SAVED_URI_PREFIX + contextId); // Cleanup session
-
- try {
- if (originalURL != null) {
- LOG.debug("Restore request to {}", originalURL);
- response.sendRedirect(response.encodeRedirectURL(originalURL));
- } else {
- LOG.debug("User took so long to log on the session expired");
- if (landingPage == null) {
- response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT, sm
- .getString("authenticator.sessionExpired"));
- } else {
- // Redirect to landing page
- String uri = request.getContextPath() + landingPage;
- response.sendRedirect(response.encodeRedirectURL(uri));
- }
- }
- } catch (IOException e) {
- LOG.error("Cannot resume with request.", e.getMessage());
- }
- }
- }
-
- protected boolean restoreRequest(Request request, HttpServletResponse response) throws IOException {
-
- Session session = request.getSessionInternal();
- LOG.debug("Restore request from session '{}'", session.getIdInternal());
-
- // Get principal from session, register, and then remove it
- Principal principal = (Principal)session.getNote(Constants.FORM_PRINCIPAL_NOTE);
- register(request, response, principal, FederationConstants.WSFED_METHOD, null, null);
- request.removeNote(Constants.FORM_PRINCIPAL_NOTE);
-
- if (restoreRequest(request)) {
- LOG.debug("Proceed to restored request");
- return true;
- } else {
- LOG.warn("Restore of original request failed");
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return false;
- }
- }
-
- protected void redirectToIdp(Request request, HttpServletResponse response, FedizContext fedCtx)
- throws IOException {
-
- FedizProcessor processor = FedizProcessorFactory.newFedizProcessor(fedCtx.getProtocol());
- try {
- RedirectionResponse redirectionResponse = processor.createSignInRequest(request, fedCtx);
- String redirectURL = redirectionResponse.getRedirectionURL();
- if (redirectURL != null) {
- Map<String, String> headers = redirectionResponse.getHeaders();
- if (!headers.isEmpty()) {
- for (Entry<String, String> entry : headers.entrySet()) {
- response.addHeader(entry.getKey(), entry.getValue());
- }
- }
-
- // Save original request in our session
- try {
- saveRequest(request, redirectionResponse.getRequestState().getState());
- } catch (IOException ioe) {
- LOG.debug("Request body too big to save during authentication");
- response.sendError(HttpServletResponse.SC_FORBIDDEN, sm
- .getString("authenticator.requestBodyTooBig"));
- }
-
- response.sendRedirect(redirectURL);
- } else {
- LOG.warn("Failed to create SignInRequest.");
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest.");
- }
- } catch (ProcessingException ex) {
- LOG.warn("Failed to create SignInRequest: {}", ex.getMessage());
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest.");
- }
- }
-
- @Override
- protected boolean matchRequest(Request request) {
- Session session = request.getSessionInternal(false);
- String uri = request.getDecodedRequestURI();
- if (session != null && uri != null) {
- SavedRequest saved = (SavedRequest) session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri);
- if (saved != null) {
- synchronized (session) {
- session.setNote(Constants.FORM_REQUEST_NOTE, saved);
- return super.matchRequest(request);
- }
- }
- }
- return false;
- }
-
- protected void saveRequest(Request request, String contextId) throws IOException {
- String uri = request.getDecodedRequestURI();
- Session session = request.getSessionInternal(true);
- if (session != null) {
- LOG.debug("Save request in session '{}'", session.getIdInternal());
- }
- if (session != null && uri != null) {
- SavedRequest saved;
- synchronized (session) {
- super.saveRequest(request, session);
- saved = (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
- }
- session.setNote(SESSION_SAVED_REQUEST_PREFIX + uri, saved);
- StringBuilder sb = new StringBuilder(saved.getRequestURI());
- if (saved.getQueryString() != null) {
- sb.append('?');
- sb.append(saved.getQueryString());
- }
- session.setNote(SESSION_SAVED_URI_PREFIX + contextId, sb.toString());
- }
- }
-
- protected boolean restoreRequest(Request request) throws IOException {
- Session session = request.getSessionInternal(false);
- String uri = request.getDecodedRequestURI();
- if (session != null && uri != null) {
- SavedRequest saved = (SavedRequest)session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri);
- if (saved != null) {
- session.removeNote(SESSION_SAVED_REQUEST_PREFIX + uri); // cleanup session
- synchronized (session) {
- session.setNote(Constants.FORM_REQUEST_NOTE, saved);
- return super.restoreRequest(request, session);
- }
- }
- }
- return false;
- }
-
- protected boolean checkUserAuthentication(Request request, HttpServletResponse response, FedizContext fedCtx) {
- // Have we already authenticated someone?
- Principal principal = request.getUserPrincipal();
- // String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
- if (principal != null) {
- LOG.debug("Already authenticated '{}'", principal.getName());
-
- // Associate the session with any existing SSO session
- /*
- * if (ssoId != null) associate(ssoId, request.getSessionInternal(true));
- */
-
- if (fedCtx.isDetectExpiredTokens()) {
- // Check whether security token still valid
- return validateToken(request, response, fedCtx);
- } else {
- LOG.debug("Token expiration not validated.");
- return true;
- }
- }
- return false;
- }
-
- protected boolean validateToken(Request request, HttpServletResponse response, FedizContext fedConfig) {
- Session session = request.getSessionInternal();
- if (session != null) {
-
- FedizResponse wfRes = (FedizResponse)session.getNote(FEDERATION_NOTE);
- Date tokenExpires = wfRes.getTokenExpires();
- if (tokenExpires == null) {
- LOG.debug("Token doesn't expire");
- return true;
- }
-
- Date currentTime = new Date();
- if (!currentTime.after(tokenExpires)) {
- return true;
- } else {
- LOG.warn("Token already expired. Clean up and redirect");
-
- session.removeNote(FEDERATION_NOTE);
- session.setPrincipal(null);
- request.getSession().removeAttribute(SECURITY_TOKEN);
- }
- } else {
- LOG.debug("Session should not be null after authentication");
- }
- return false;
- }
-
- @Override
- protected String getAuthMethod() {
- return FederationConstants.WSFED_METHOD;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java
deleted file mode 100644
index 4beee9f..0000000
--- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java
+++ /dev/null
@@ -1,60 +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.tomcat7;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.w3c.dom.Element;
-import org.apache.catalina.realm.GenericPrincipal;
-import org.apache.cxf.fediz.core.Claim;
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.apache.cxf.fediz.core.FedizPrincipal;
-
-public class FederationPrincipalImpl extends GenericPrincipal implements FedizPrincipal {
-
- protected ClaimCollection claims;
- protected Element loginToken;
- private List<String> roles = Collections.emptyList();
-
- public FederationPrincipalImpl(String username, List<String> roles,
- List<Claim> claims, Element loginToken) {
- super(username, null, roles);
- this.claims = new ClaimCollection(claims);
- this.loginToken = loginToken;
- if (roles != null) {
- this.roles = roles;
- }
- }
-
- public ClaimCollection getClaims() {
- return this.claims;
- }
-
- @Override
- public Element getLoginToken() {
- return loginToken;
- }
-
- public List<String> getRoleClaims() {
- return Collections.unmodifiableList(roles);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java
deleted file mode 100644
index 69da3df..0000000
--- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java
+++ /dev/null
@@ -1,58 +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.tomcat7.handler;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.catalina.Session;
-import org.apache.catalina.connector.Request;
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.handler.LogoutHandler;
-import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
-
-public class TomcatLogoutHandler extends LogoutHandler {
- private final Request request;
-
- public TomcatLogoutHandler(FedizContext fedConfig, String servletContextPath, Request request) {
- super(fedConfig, servletContextPath);
- this.request = request;
- }
-
- @Override
- protected boolean signoutCleanup(HttpServletRequest req, HttpServletResponse resp) {
- // Cleanup session internal
- Session session = request.getSessionInternal();
- session.removeNote(FederationAuthenticator.FEDERATION_NOTE);
- session.setPrincipal(null);
- super.signoutCleanup(req, resp);
- request.clearCookies();
- return true;
- }
-
- @Override
- protected boolean signout(HttpServletRequest req, HttpServletResponse resp) {
- // Direct Logout
- Session session = request.getSessionInternal();
- session.removeNote(FederationAuthenticator.FEDERATION_NOTE);
- session.setPrincipal(null);
- return super.signout(req, resp);
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java
deleted file mode 100644
index b073624..0000000
--- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java
+++ /dev/null
@@ -1,89 +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.tomcat7.handler;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.catalina.Session;
-import org.apache.catalina.authenticator.Constants;
-import org.apache.catalina.connector.Request;
-import org.apache.cxf.fediz.core.FedizPrincipal;
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.handler.SigninHandler;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
-import org.apache.cxf.fediz.tomcat7.FederationPrincipalImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TomcatSigninHandler extends SigninHandler<FedizPrincipal> {
-
- private static final Logger LOG = LoggerFactory.getLogger(TomcatSigninHandler.class);
- private Object landingPage;
-
- public TomcatSigninHandler(FedizContext fedizContext) {
- super(fedizContext);
- }
-
- @Override
- protected FedizPrincipal createPrincipal(HttpServletRequest request, HttpServletResponse response,
- FedizResponse wfRes) {
- // Add "Authenticated" role
- List<String> roles = wfRes.getRoles();
- if (roles == null || roles.isEmpty()) {
- roles = Collections.singletonList("Authenticated");
- } else if (getFedizContext().isAddAuthenticatedRole()) {
- roles = new ArrayList<>(roles);
- roles.add("Authenticated");
- }
-
- // proceed creating the JAAS Subject
- FedizPrincipal principal = new FederationPrincipalImpl(wfRes.getUsername(), roles,
- wfRes.getClaims(), wfRes.getToken());
-
- Session session = ((Request)request).getSessionInternal();
-
- // Save the authenticated Principal in our session
- session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal);
-
- // Save Federation response in our session
- session.setNote(FederationAuthenticator.FEDERATION_NOTE, wfRes);
-
- // Save Federation response in public session
- request.getSession(true).setAttribute(FederationAuthenticator.SECURITY_TOKEN, wfRes.getToken());
-
- LOG.debug("UserPrincipal was created successfully for {}", principal);
- return principal;
- }
-
- public Object getLandingPage() {
- return landingPage;
- }
-
- public void setLandingPage(Object landingPage) {
- this.landingPage = landingPage;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/src/test/resources/logging.properties b/plugins/tomcat7/src/test/resources/logging.properties
deleted file mode 100644
index 992a78d..0000000
--- a/plugins/tomcat7/src/test/resources/logging.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-############################################################
-# 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= INFO
-
-############################################################
-# 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 = WARNING
-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
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 861c947..6fad40d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,6 @@
<cxf.build-utils.version>3.2.0</cxf.build-utils.version>
<dbcp.version>2.1.1</dbcp.version>
<easymock.version>3.4</easymock.version>
- <ecj.version>4.6.1</ecj.version>
<ehcache.version>2.10.3</ehcache.version>
<hsqldb.version>2.3.4</hsqldb.version>
<htmlunit.version>2.24</htmlunit.version>
@@ -56,7 +55,6 @@
<javax.el.version>2.2</javax.el.version>
<javax.validation.version>1.1.0.Final</javax.validation.version>
<jericho.version>3.3</jericho.version>
- <jetty8.version>8.1.22.v20160922</jetty8.version>
<jetty9.version>9.3.9.v20160517</jetty9.version>
<junit.version>4.12</junit.version>
<kerby.version>1.0.0</kerby.version>
@@ -66,7 +64,6 @@
<slf4j.version>1.7.22</slf4j.version>
<spring.version>4.3.5.RELEASE</spring.version>
<spring.security.version>4.2.2.RELEASE</spring.security.version>
- <tomcat7.version>7.0.75</tomcat7.version>
<tomcat8.version>8.5.12</tomcat8.version>
<wss4j.version>2.1.9</wss4j.version>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/custom/pom.xml
----------------------------------------------------------------------
diff --git a/systests/custom/pom.xml b/systests/custom/pom.xml
index 1ab92ca..c7dbd30 100644
--- a/systests/custom/pom.xml
+++ b/systests/custom/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
----------------------------------------------------------------------
diff --git a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
index af18315..e428425 100644
--- a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
+++ b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
@@ -41,7 +41,7 @@ import org.apache.catalina.startup.Tomcat;
import org.apache.commons.io.IOUtils;
import org.apache.cxf.fediz.core.ClaimTypes;
import org.apache.cxf.fediz.integrationtests.HTTPTestUtils;
-import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.wss4j.dom.engine.WSSConfig;
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/cxf/pom.xml
----------------------------------------------------------------------
diff --git a/systests/cxf/pom.xml b/systests/cxf/pom.xml
index 3a33d59..d2611ad 100644
--- a/systests/cxf/pom.xml
+++ b/systests/cxf/pom.xml
@@ -91,25 +91,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/federation/samlsso/pom.xml
----------------------------------------------------------------------
diff --git a/systests/federation/samlsso/pom.xml b/systests/federation/samlsso/pom.xml
index 2cb0167..9848029 100644
--- a/systests/federation/samlsso/pom.xml
+++ b/systests/federation/samlsso/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/federation/wsfed/pom.xml
----------------------------------------------------------------------
diff --git a/systests/federation/wsfed/pom.xml b/systests/federation/wsfed/pom.xml
index ebd35c4..955eec4 100644
--- a/systests/federation/wsfed/pom.xml
+++ b/systests/federation/wsfed/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
----------------------------------------------------------------------
diff --git a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
index ad5a097..c16bb01 100644
--- a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
+++ b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
@@ -45,7 +45,7 @@ import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
import org.apache.cxf.fediz.core.ClaimTypes;
-import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
+import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.junit.AfterClass;
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/idp/pom.xml
----------------------------------------------------------------------
diff --git a/systests/idp/pom.xml b/systests/idp/pom.xml
index 4ec377e..1b7adb5 100644
--- a/systests/idp/pom.xml
+++ b/systests/idp/pom.xml
@@ -37,25 +37,13 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat7.version}</version>
+ <version>${tomcat8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -66,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-tomcat7</artifactId>
+ <artifactId>fediz-tomcat8</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/pom.xml
----------------------------------------------------------------------
diff --git a/systests/jetty8/pom.xml b/systests/jetty8/pom.xml
deleted file mode 100644
index edd7f80..0000000
--- a/systests/jetty8/pom.xml
+++ /dev/null
@@ -1,300 +0,0 @@
-<?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>fediz-systests</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <groupId>org.apache.cxf.fediz.systests</groupId>
- <artifactId>fediz-systests-jetty8</artifactId>
- <name>Apache Fediz Systests for Jetty 8</name>
- <packaging>jar</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <htmlunit.jetty8.version>2.15</htmlunit.jetty8.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty8.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- <version>${jetty8.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-xml</artifactId>
- <version>${jetty8.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty8.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-jsp</artifactId>
- <version>${jetty8.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</groupId>
- <artifactId>fediz-jetty8</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz.systests</groupId>
- <artifactId>fediz-systests-tests</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <classifier>tests</classifier>
- <exclusions>
- <exclusion>
- <groupId>net.sourceforge.htmlunit</groupId>
- <artifactId>htmlunit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.htmlunit</groupId>
- <artifactId>htmlunit</artifactId>
- <version>${htmlunit.jetty8.version}</version>
- </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>
- <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>
- <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>
- <outputDirectory>target/idp/</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-idp-sts</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/idp/</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz.systests.webapps</groupId>
- <artifactId>fediz-systests-webapps-simple</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/rp/</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.cxf.fediz.systests.webapps</groupId>
- <artifactId>fediz-systests-webapps-springPreauth</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/rp/</outputDirectory>
- </artifactItem>
- </artifactItems>
- <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <stripVersion>true</stripVersion>
- </configuration>
- </execution>
- <execution>
- <id>copy-keys</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.cxf.fediz.systests</groupId>
- <artifactId>fediz-systests-tests</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/test-classes</outputDirectory>
- <includes>**/*.jks</includes>
- </artifactItem>
- </artifactItems>
- <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <stripVersion>true</stripVersion>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>integration-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>integration-test</goal>
- </goals>
- <configuration>
- <skip>${skipTests}</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>
- <java.util.logging.config.file>${basedir}/target/test-classes/logging.properties</java.util.logging.config.file>
- </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>
- <inherited>true</inherited>
- <configuration>
- <excludes>
- <exclude>**/integrationtests/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <!-- Skip Jetty8 tests if we are using JDK8 -->
- <profile>
- <id>jdk18</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <excludes>
- <exclude>**/integrationtests/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
deleted file mode 100644
index d5e6aa0..0000000
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
+++ /dev/null
@@ -1,98 +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 org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.xml.XmlConfiguration;
-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 ClientCertificatePreAuthSpringTest extends AbstractClientCertTests {
-
- static String idpHttpsPort;
- static String rpHttpsPort;
-
- private static Server 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.springframework.security", "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);
-
- JettyUtils.initIdpServer();
- JettyUtils.startIdpServer();
-
- try {
- Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml");
- XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
- rpServer = (Server)configuration.configure();
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void cleanup() {
- JettyUtils.stopIdpServer();
-
- if (rpServer != null && rpServer.isStarted()) {
- try {
- rpServer.stop();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- @Override
- public String getIdpHttpsPort() {
- return idpHttpsPort;
- }
-
- @Override
- public String getRpHttpsPort() {
- return rpHttpsPort;
- }
-
- @Override
- public String getServletContextName() {
- return "fedizspringhelloworld";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
deleted file mode 100644
index 0211c7c..0000000
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ /dev/null
@@ -1,98 +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 org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.xml.XmlConfiguration;
-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 Server 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.springframework.security", "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);
-
- JettyUtils.initIdpServer();
- JettyUtils.startIdpServer();
-
- try {
- Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml");
- XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
- rpServer = (Server)configuration.configure();
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void cleanup() {
- JettyUtils.stopIdpServer();
-
- if (rpServer != null && rpServer.isStarted()) {
- try {
- rpServer.stop();
- } 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/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java
deleted file mode 100644
index a323696..0000000
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java
+++ /dev/null
@@ -1,48 +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.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");
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
deleted file mode 100644
index 961dceb..0000000
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
+++ /dev/null
@@ -1,83 +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 org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-
-public class JettyPreAuthSpringTest 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", "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");
-
- 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 "fedizspringhelloworld";
- }
-
- @Ignore("This tests is currently failing on Jetty")
- @Override
- public void testConcurrentRequests() throws Exception {
- // super.testConcurrentRequests();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
deleted file mode 100644
index 5fe32ba..0000000
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
+++ /dev/null
@@ -1,82 +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 org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-
-public class JettyTest 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", "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.springframework.security", "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);
-
- 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";
- }
-
- @Ignore("This tests is currently failing on Jetty")
- @Override
- public void testConcurrentRequests() throws Exception {
- // super.testConcurrentRequests();
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
deleted file mode 100644
index f4cb9fe..0000000
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
+++ /dev/null
@@ -1,105 +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 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() {
- initRpServer("rp-server.xml");
- }
-
- public static void initRpServer(String configurationFile) {
- if (rpServer == null) {
- try {
- Resource testServerConfig = Resource.newSystemResource(configurationFile);
- 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();
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/fediz_config.xml
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/resources/fediz_config.xml b/systests/jetty8/src/test/resources/fediz_config.xml
deleted file mode 100644
index e1ef26b..0000000
--- a/systests/jetty8/src/test/resources/fediz_config.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="clienttrust.jks" password="storepass"
- type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
- <contextConfig name="/fedizspringhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="clienttrust.jks" password="storepass"
- type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-</FedizConfig>
-
[3/7] cxf-fediz git commit: FEDIZ-204 - Drop Tomcat7, Jetty8,
Spring Sec 2 containers
Posted by co...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TestCallbackHandler.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TestCallbackHandler.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TestCallbackHandler.java
deleted file mode 100644
index 776b458..0000000
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TestCallbackHandler.java
+++ /dev/null
@@ -1,48 +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.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");
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
deleted file mode 100644
index b5e10c9..0000000
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
+++ /dev/null
@@ -1,172 +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 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.tomcat7.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/e392e637/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
deleted file mode 100644
index 95bd271..0000000
--- a/systests/tomcat7/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.tomcat7.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 'alice@realma.org'",
- bodyTextContent.contains(claim + "=alice@realma.org"));
-
- }
-
- 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/e392e637/systests/tomcat7/src/test/resources/alice.cer
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/alice.cer b/systests/tomcat7/src/test/resources/alice.cer
deleted file mode 100644
index 9644a0e..0000000
Binary files a/systests/tomcat7/src/test/resources/alice.cer and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/fediz_config.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/fediz_config.xml b/systests/tomcat7/src/test/resources/fediz_config.xml
deleted file mode 100644
index dc30ea6..0000000
--- a/systests/tomcat7/src/test/resources/fediz_config.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="test-classes/clienttrust.jks"
- password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/fediz_config_aud_restr.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/fediz_config_aud_restr.xml b/systests/tomcat7/src/test/resources/fediz_config_aud_restr.xml
deleted file mode 100644
index 8a663bf..0000000
--- a/systests/tomcat7/src/test/resources/fediz_config_aud_restr.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld2</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="test-classes/clienttrust.jks"
- password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/fediz_config_client_cert.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/fediz_config_client_cert.xml b/systests/tomcat7/src/test/resources/fediz_config_client_cert.xml
deleted file mode 100644
index 365836a..0000000
--- a/systests/tomcat7/src/test/resources/fediz_config_client_cert.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="test-classes/clienttrust.jks"
- password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
- <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
- </signingKey>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" />
- <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" />
- </claimTypesRequested>
- <authenticationType>http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/Ssl</authenticationType>
- <request type="Class">org.apache.cxf.fediz.integrationtests.HOKCallbackHandler</request>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/fediz_config_hok.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/fediz_config_hok.xml b/systests/tomcat7/src/test/resources/fediz_config_hok.xml
deleted file mode 100644
index cd4ad95..0000000
--- a/systests/tomcat7/src/test/resources/fediz_config_hok.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="test-classes/clienttrust.jks"
- password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="a particular claim type"
- optional="true" />
- </claimTypesRequested>
- <request type="Class">org.apache.cxf.fediz.integrationtests.HOKCallbackHandler</request>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/fediz_config_wreq.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/fediz_config_wreq.xml b/systests/tomcat7/src/test/resources/fediz_config_wreq.xml
deleted file mode 100644
index 2612d98..0000000
--- a/systests/tomcat7/src/test/resources/fediz_config_wreq.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file.
- Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL
- keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead.
--->
-<FedizConfig>
- <contextConfig name="/fedizhelloworld">
- <audienceUris>
- <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem>
- </audienceUris>
- <certificateStores>
- <trustManager>
- <keyStore file="test-classes/clienttrust.jks"
- password="storepass" type="JKS" />
- </trustManager>
- </certificateStores>
- <trustedIssuers>
- <issuer certificateValidation="PeerTrust" />
- </trustedIssuers>
- <maximumClockSkew>1000</maximumClockSkew>
- <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/federation</issuer>
- <roleDelimiter>,</roleDelimiter>
- <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
- <freshness>10</freshness>
- <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm>
- <claimTypesRequested>
- <claimType type="a particular claim type"
- optional="true" />
- </claimTypesRequested>
- <request type="Class">org.apache.cxf.fediz.integrationtests.TestCallbackHandler</request>
- </protocol>
- <logoutURL>/secure/logout</logoutURL>
- <logoutRedirectTo>/index.html</logoutRedirectTo>
- </contextConfig>
-</FedizConfig>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/logging.properties b/systests/tomcat7/src/test/resources/logging.properties
deleted file mode 100644
index 0d8d902..0000000
--- a/systests/tomcat7/src/test/resources/logging.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-############################################################
-# 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= INFO
-
-############################################################
-# 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 = WARNING
-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.ws.security.level = FINEST
-org.apache.cxf.fediz.level = FINEST
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat7/src/test/resources/realma/entities-realma.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/resources/realma/entities-realma.xml b/systests/tomcat7/src/test/resources/realma/entities-realma.xml
deleted file mode 100644
index 10565ab..0000000
--- a/systests/tomcat7/src/test/resources/realma/entities-realma.xml
+++ /dev/null
@@ -1,474 +0,0 @@
-<?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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util-4.3.xsd">
-
- <bean id="idp-realmA" class="org.apache.cxf.fediz.service.idp.service.jpa.IdpEntity">
- <property name="realm" value="urn:org:apache:cxf:fediz:idp:realm-A" />
- <property name="uri" value="realma" />
- <property name="provideIdpList" value="true" />
- <property name="useCurrentIdp" value="true" />
- <property name="certificate" value="stsKeystoreA.properties" />
- <property name="certificatePassword" value="realma" />
- <property name="stsUrl" value="https://localhost:${idp.https.port}/fediz-idp-sts/REALMA" />
- <property name="idpUrl" value="https://localhost:${idp.https.port}/fediz-idp/federation" />
- <property name="rpSingleSignOutConfirmation" value="true"/>
- <property name="supportedProtocols">
- <util:list>
- <value>http://docs.oasis-open.org/wsfed/federation/200706
- </value>
- <value>http://docs.oasis-open.org/ws-sx/ws-trust/200512
- </value>
- </util:list>
- </property>
- <property name="tokenTypesOffered">
- <util:list>
- <value>urn:oasis:names:tc:SAML:1.0:assertion</value>
- <value>urn:oasis:names:tc:SAML:2.0:assertion</value>
- </util:list>
- </property>
- <property name="authenticationURIs">
- <util:map>
- <entry key="default" value="federation/up" />
- <entry key="http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/SslAndKey"
- value="federation/krb" />
- <entry key="http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/default"
- value="federation/up" />
- <entry key="http://docs.oasis-open.org/wsfed/authorization/200706/authntypes/Ssl"
- value="federation/clientcert" />
- </util:map>
- </property>
- <property name="serviceDisplayName" value="REALM A" />
- <property name="serviceDescription" value="IDP of Realm A" />
- <property name="applications">
- <util:list>
- <ref bean="srv-fedizhelloworld" />
- </util:list>
- </property>
- <property name="trustedIdps">
- <util:list>
- <ref bean="trusted-idp-realmB" />
- </util:list>
- </property>
- <property name="claimTypesOffered">
- <util:list>
- <ref bean="claim_role" />
- <ref bean="claim_surname" />
- <ref bean="claim_givenname" />
- <ref bean="claim_email" />
- </util:list>
- </property>
- </bean>
-
- <bean id="trusted-idp-realmB"
- class="org.apache.cxf.fediz.service.idp.service.jpa.TrustedIdpEntity">
- <property name="realm" value="urn:org:apache:cxf:fediz:idp:realm-B" />
- <property name="cacheTokens" value="true" />
- <property name="url" value="https://localhost:12443/fediz-idp-remote/federation" />
- <property name="certificate" value="realmb.cert" />
- <property name="trustType" value="PEER_TRUST" />
- <property name="protocol" value="http://docs.oasis-open.org/wsfed/federation/200706" />
- <property name="federationType" value="FEDERATE_IDENTITY" />
- <property name="name" value="Realm B" />
- <property name="description" value="Realm B description" />
- </bean>
-
- <bean id="srv-fedizhelloworld" class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationEntity">
- <property name="realm" value="urn:org:apache:cxf:fediz:fedizhelloworld" />
- <property name="protocol" value="http://docs.oasis-open.org/wsfed/federation/200706" />
- <property name="serviceDisplayName" value="Fedizhelloworld" />
- <property name="serviceDescription" value="Web Application to illustrate WS-Federation" />
- <property name="role" value="ApplicationServiceType" />
- <property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0" />
- <property name="lifeTime" value="3600" />
- <property name="passiveRequestorEndpointConstraint"
- value="https://localhost:(\d)*/(\w)*helloworld(\w)*/secure/.*" />
- <property name="logoutEndpointConstraint" value="https://localhost:?(\d)*/.*" />
- </bean>
-
- <bean class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationClaimEntity">
- <property name="application" ref="srv-fedizhelloworld" />
- <property name="claim" ref="claim_role" />
- <property name="optional" value="false" />
- </bean>
- <bean class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationClaimEntity">
- <property name="application" ref="srv-fedizhelloworld" />
- <property name="claim" ref="claim_givenname" />
- <property name="optional" value="false" />
- </bean>
- <bean class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationClaimEntity">
- <property name="application" ref="srv-fedizhelloworld" />
- <property name="claim" ref="claim_surname" />
- <property name="optional" value="false" />
- </bean>
- <bean class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationClaimEntity">
- <property name="application" ref="srv-fedizhelloworld" />
- <property name="claim" ref="claim_email" />
- <property name="optional" value="false" />
- </bean>
-
- <bean id="claim_role"
- class="org.apache.cxf.fediz.service.idp.service.jpa.ClaimEntity">
- <property name="claimType"
- value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" />
- <property name="displayName"
- value="role" />
- <property name="description"
- value="Description for role" />
- </bean>
- <bean id="claim_givenname"
- class="org.apache.cxf.fediz.service.idp.service.jpa.ClaimEntity">
- <property name="claimType"
- value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
- <property name="displayName"
- value="firstname" />
- <property name="description"
- value="Description for firstname" />
- </bean>
- <bean id="claim_surname"
- class="org.apache.cxf.fediz.service.idp.service.jpa.ClaimEntity">
- <property name="claimType"
- value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" />
- <property name="displayName"
- value="lastname" />
- <property name="description"
- value="Description for lastname" />
- </bean>
- <bean id="claim_email"
- class="org.apache.cxf.fediz.service.idp.service.jpa.ClaimEntity">
- <property name="claimType"
- value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" />
- <property name="displayName"
- value="email" />
- <property name="description"
- value="Description for email" />
- </bean>
-
-
- <bean id="entitlement_claim_list"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="CLAIM_LIST" />
- <property name="description"
- value="Description for CLAIM_LIST" />
- </bean>
- <bean id="entitlement_claim_create"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="CLAIM_CREATE" />
- <property name="description"
- value="Description for CLAIM_CREATE" />
- </bean>
- <bean id="entitlement_claim_read"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="CLAIM_READ" />
- <property name="description"
- value="Description for CLAIM_READ" />
- </bean>
- <bean id="entitlement_claim_update"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="CLAIM_UPDATE" />
- <property name="description"
- value="Description for CLAIM_UPDATE" />
- </bean>
- <bean id="entitlement_claim_delete"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="CLAIM_DELETE" />
- <property name="description"
- value="Description for CLAIM_DELETE" />
- </bean>
-
- <bean id="entitlement_application_list"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="APPLICATION_LIST" />
- <property name="description"
- value="Description for APPLICATION_LIST" />
- </bean>
- <bean id="entitlement_application_create"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="APPLICATION_CREATE" />
- <property name="description"
- value="Description for APPLICATION_CREATE" />
- </bean>
- <bean id="entitlement_application_read"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="APPLICATION_READ" />
- <property name="description"
- value="Description for APPLICATION_READ" />
- </bean>
- <bean id="entitlement_application_update"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="APPLICATION_UPDATE" />
- <property name="description"
- value="Description for APPLICATION_UPDATE" />
- </bean>
- <bean id="entitlement_application_delete"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="APPLICATION_DELETE" />
- <property name="description"
- value="Description for APPLICATION_DELETE" />
- </bean>
-
- <bean id="entitlement_trustedidp_list"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="TRUSTEDIDP_LIST" />
- <property name="description"
- value="Description for TRUSTEDIDP_LIST" />
- </bean>
- <bean id="entitlement_trustedidp_create"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="TRUSTEDIDP_CREATE" />
- <property name="description"
- value="Description for TRUSTEDIDP_CREATE" />
- </bean>
- <bean id="entitlement_trustedidp_read"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="TRUSTEDIDP_READ" />
- <property name="description"
- value="Description for TRUSTEDIDP_READ" />
- </bean>
- <bean id="entitlement_trustedidp_update"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="TRUSTEDIDP_UPDATE" />
- <property name="description"
- value="Description for TRUSTEDIDP_UPDATE" />
- </bean>
- <bean id="entitlement_trustedidp_delete"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="TRUSTEDIDP_DELETE" />
- <property name="description"
- value="Description for TRUSTEDIDP_DELETE" />
- </bean>
-
- <bean id="entitlement_idp_list"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="IDP_LIST" />
- <property name="description"
- value="Description for IDP_LIST" />
- </bean>
- <bean id="entitlement_idp_create"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="IDP_CREATE" />
- <property name="description"
- value="Description for IDP_CREATE" />
- </bean>
- <bean id="entitlement_idp_read"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="IDP_READ" />
- <property name="description"
- value="Description for IDP_READ" />
- </bean>
- <bean id="entitlement_idp_update"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="IDP_UPDATE" />
- <property name="description"
- value="Description for IDP_UPDATE" />
- </bean>
- <bean id="entitlement_idp_delete"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="IDP_DELETE" />
- <property name="description"
- value="Description for IDP_DELETE" />
- </bean>
-
- <bean id="entitlement_role_list"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ROLE_LIST" />
- <property name="description"
- value="Description for ROLE_LIST" />
- </bean>
- <bean id="entitlement_role_create"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ROLE_CREATE" />
- <property name="description"
- value="Description for ROLE_CREATE" />
- </bean>
- <bean id="entitlement_role_read"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ROLE_READ" />
- <property name="description"
- value="Description for ROLE_READ" />
- </bean>
- <bean id="entitlement_role_update"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ROLE_UPDATE" />
- <property name="description"
- value="Description for ROLE_UPDATE" />
- </bean>
- <bean id="entitlement_role_delete"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ROLE_DELETE" />
- <property name="description"
- value="Description for ROLE_DELETE" />
- </bean>
-
- <bean id="entitlement_entitlement_list"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ENTITLEMENT_LIST" />
- <property name="description"
- value="Description for ENTITLEMENT_LIST" />
- </bean>
- <bean id="entitlement_entitlement_create"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ENTITLEMENT_CREATE" />
- <property name="description"
- value="Description for ENTITLEMENT_CREATE" />
- </bean>
- <bean id="entitlement_entitlement_read"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ENTITLEMENT_READ" />
- <property name="description"
- value="Description for ENTITLEMENT_READ" />
- </bean>
- <bean id="entitlement_entitlement_update"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ENTITLEMENT_UPDATE" />
- <property name="description"
- value="Description for ENTITLEMENT_UPDATE" />
- </bean>
- <bean id="entitlement_entitlement_delete"
- class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
- <property name="name"
- value="ENTITLEMENT_DELETE" />
- <property name="description"
- value="Description for ENTITLEMENT_DELETE" />
- </bean>
-
- <bean id="role_admin"
- class="org.apache.cxf.fediz.service.idp.service.jpa.RoleEntity">
- <property name="name"
- value="ADMIN" />
- <property name="description"
- value="This is the administrator role with full access" />
- <property name="entitlements">
- <util:list>
- <ref bean="entitlement_claim_list" />
- <ref bean="entitlement_claim_create" />
- <ref bean="entitlement_claim_read" />
- <ref bean="entitlement_claim_update" />
- <ref bean="entitlement_claim_delete" />
- <ref bean="entitlement_idp_list" />
- <ref bean="entitlement_idp_create" />
- <ref bean="entitlement_idp_read" />
- <ref bean="entitlement_idp_update" />
- <ref bean="entitlement_idp_delete" />
- <ref bean="entitlement_trustedidp_list" />
- <ref bean="entitlement_trustedidp_create" />
- <ref bean="entitlement_trustedidp_read" />
- <ref bean="entitlement_trustedidp_update" />
- <ref bean="entitlement_trustedidp_delete" />
- <ref bean="entitlement_application_list" />
- <ref bean="entitlement_application_create" />
- <ref bean="entitlement_application_read" />
- <ref bean="entitlement_application_update" />
- <ref bean="entitlement_application_delete" />
- <ref bean="entitlement_role_list" />
- <ref bean="entitlement_role_create" />
- <ref bean="entitlement_role_read" />
- <ref bean="entitlement_role_update" />
- <ref bean="entitlement_role_delete" />
- <ref bean="entitlement_entitlement_list" />
- <ref bean="entitlement_entitlement_create" />
- <ref bean="entitlement_entitlement_read" />
- <ref bean="entitlement_entitlement_update" />
- <ref bean="entitlement_entitlement_delete" />
- </util:list>
- </property>
- </bean>
- <bean id="role_user"
- class="org.apache.cxf.fediz.service.idp.service.jpa.RoleEntity">
- <property name="name"
- value="USER" />
- <property name="description"
- value="This is the user role with read access" />
- <property name="entitlements">
- <util:list>
- <ref bean="entitlement_claim_list" />
- <ref bean="entitlement_claim_read" />
- <ref bean="entitlement_idp_list" />
- <ref bean="entitlement_idp_read" />
- <ref bean="entitlement_trustedidp_list" />
- <ref bean="entitlement_trustedidp_read" />
- <ref bean="entitlement_application_list" />
- <ref bean="entitlement_application_read" />
- <ref bean="entitlement_role_list" />
- <ref bean="entitlement_role_read" />
- <ref bean="entitlement_entitlement_list" />
- <ref bean="entitlement_entitlement_read" />
- </util:list>
- </property>
- </bean>
- <bean id="role_idp_login"
- class="org.apache.cxf.fediz.service.idp.service.jpa.RoleEntity">
- <property name="name"
- value="IDP_LOGIN" />
- <property name="description"
- value="This is the IDP login role which is applied to Users during the IDP SSO" />
- <property name="entitlements">
- <util:list>
- <ref bean="entitlement_claim_list" />
- <ref bean="entitlement_claim_read" />
- <ref bean="entitlement_idp_list" />
- <ref bean="entitlement_idp_read" />
- <ref bean="entitlement_trustedidp_list" />
- <ref bean="entitlement_trustedidp_read" />
- <ref bean="entitlement_application_list" />
- <ref bean="entitlement_application_read" />
- </util:list>
- </property>
- </bean>
-
-
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/tomcat8/pom.xml
----------------------------------------------------------------------
diff --git a/systests/tomcat8/pom.xml b/systests/tomcat8/pom.xml
index fe08dbf..c824443 100644
--- a/systests/tomcat8/pom.xml
+++ b/systests/tomcat8/pom.xml
@@ -41,12 +41,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>${ecj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>${tomcat8.version}</version>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/pom.xml
----------------------------------------------------------------------
diff --git a/systests/webapps/pom.xml b/systests/webapps/pom.xml
index b3bd89e..437e788 100644
--- a/systests/webapps/pom.xml
+++ b/systests/webapps/pom.xml
@@ -34,7 +34,6 @@
<module>simpleWebapp</module>
<module>springPreauthWebapp</module>
<module>springWebapp</module>
- <module>spring2Webapp</module>
<module>spring3Webapp</module>
<module>cxfWebapp</module>
</modules>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/pom.xml
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/pom.xml b/systests/webapps/spring2Webapp/pom.xml
deleted file mode 100644
index 536b045..0000000
--- a/systests/webapps/spring2Webapp/pom.xml
+++ /dev/null
@@ -1,135 +0,0 @@
-<?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.systests</groupId>
- <artifactId>fediz-systests-webapps</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <groupId>org.apache.cxf.fediz.systests.webapps</groupId>
- <artifactId>fediz-systests-webapps-spring2</artifactId>
- <name>Apache Fediz Systests Spring2 Webapp</name>
- <packaging>war</packaging>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <spring.security.version>2.0.8.RELEASE</spring.security.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>${servlet.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-spring2</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>${spring.security.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.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>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java b/systests/webapps/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
deleted file mode 100644
index 3746936..0000000
--- a/systests/webapps/spring2Webapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
+++ /dev/null
@@ -1,108 +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.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.core.SecurityTokenThreadLocal;
-import org.apache.cxf.fediz.spring.authentication.FederationAuthenticationToken;
-
-import org.springframework.security.Authentication;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.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{FedizPrincipal}<p>");
- }
-
- el = SecurityTokenThreadLocal.getToken();
- if (el != null) {
- out.println("loginToken=FOUND{SecurityTokenThreadLocal}<p>");
- }
-
- }
-
- out.println("</body>");
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/resources/clienttrust.jks
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/resources/clienttrust.jks b/systests/webapps/spring2Webapp/src/main/resources/clienttrust.jks
deleted file mode 100644
index c3ad459..0000000
Binary files a/systests/webapps/spring2Webapp/src/main/resources/clienttrust.jks and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/resources/log4j.properties b/systests/webapps/spring2Webapp/src/main/resources/log4j.properties
deleted file mode 100644
index 32d28b6..0000000
--- a/systests/webapps/spring2Webapp/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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
-
-
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/resources/logging.properties b/systests/webapps/spring2Webapp/src/main/resources/logging.properties
deleted file mode 100644
index f4974a3..0000000
--- a/systests/webapps/spring2Webapp/src/main/resources/logging.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-############################################################
-# 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= INFO
-
-############################################################
-# 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 = WARNING
-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
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml
----------------------------------------------------------------------
diff --git a/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml b/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml
deleted file mode 100644
index 66c133c..0000000
--- a/systests/webapps/spring2Webapp/src/main/webapp/WEB-INF/applicationContext-security.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?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.
--->
-<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"
- xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
-
-
- <sec:http entry-point-ref="federationEntryPoint">
-<!--
- <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="/FederationMetadata/**" access="IS_AUTHENTICATED_FULLY"/>
- <sec:intercept-url pattern="/secure/fedservlet" access="IS_AUTHENTICATED_FULLY"/>
- <sec:intercept-url pattern="/secure/manager/**" access="ROLE_MANAGER"/>
- <sec:intercept-url pattern="/secure/admin/**" access="ROLE_ADMIN"/>
- <sec:intercept-url pattern="/secure/user/**" access="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"/>
-
- <bean id="fedizConfig" class="org.apache.cxf.fediz.spring.FederationConfigImpl" init-method="init"
- p:configFile="file:./target/test-classes/fediz_config.xml" p:contextName="/fedizhelloworld_spring2" />
-
- <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" p:defaultTargetUrl="/whatever">
- <sec:custom-filter after="BASIC_PROCESSING_FILTER"/>
- <!--
- <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">
- <sec:custom-authentication-provider />
- <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>
-
[6/7] cxf-fediz git commit: FEDIZ-204 - Drop Tomcat7, Jetty8,
Spring Sec 2 containers
Posted by co...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationLoginService.java
----------------------------------------------------------------------
diff --git a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationLoginService.java b/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationLoginService.java
deleted file mode 100644
index 353d946..0000000
--- a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationLoginService.java
+++ /dev/null
@@ -1,174 +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.jetty8;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.security.auth.Subject;
-
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FedizProcessor;
-import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
-import org.apache.cxf.fediz.core.processor.FedizRequest;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.eclipse.jetty.security.IdentityService;
-import org.eclipse.jetty.security.LoginService;
-import org.eclipse.jetty.server.UserIdentity;
-import org.eclipse.jetty.util.component.AbstractLifeCycle;
-import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.Logger;
-
-public class FederationLoginService extends AbstractLifeCycle implements LoginService {
- private static final Logger LOG = Log.getLogger(FederationLoginService.class);
-
- protected IdentityService identityService = new FederationIdentityService();
- protected String name;
-
-
- public FederationLoginService() {
- }
-
- public FederationLoginService(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- if (isRunning()) {
- throw new IllegalStateException("Running");
- }
-
- this.name = name;
- }
-
- @Override
- protected void doStart() throws Exception {
- LOG.debug("doStart");
- super.doStart();
- }
-
- /**
- * username will be null since the credentials will contain all the relevant info
- */
- public UserIdentity login(String username, Object credentials, FedizContext config) {
-
- try {
- FedizResponse wfRes = null;
- FedizRequest wfReq = (FedizRequest)credentials;
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Process SignIn request");
- LOG.debug("token=\n" + wfReq.getResponseToken());
- }
-
- FedizProcessor wfProc =
- FedizProcessorFactory.newFedizProcessor(config.getProtocol());
- try {
- wfRes = wfProc.processRequest(wfReq, config);
- } catch (ProcessingException ex) {
- LOG.warn("Federation processing failed: " + ex.getMessage());
- return null;
- }
-
-
- // Validate the AudienceRestriction in Security Token (e.g. SAML)
- // against the configured list of audienceURIs
- if (wfRes.getAudience() != null) {
- List<String> audienceURIs = config.getAudienceUris();
- boolean validAudience = false;
- for (String a : audienceURIs) {
- if (wfRes.getAudience().startsWith(a)) {
- validAudience = true;
- break;
- }
- }
-
- if (!validAudience) {
- LOG.warn("Token AudienceRestriction [" + wfRes.getAudience()
- + "] doesn't match with specified list of URIs.");
- return null;
- }
- }
-
- // Add "Authenticated" role
- List<String> roles = wfRes.getRoles();
- if (roles == null || roles.isEmpty()) {
- roles = Collections.singletonList("Authenticated");
- } else if (config.isAddAuthenticatedRole()) {
- roles = new ArrayList<>(roles);
- roles.add("Authenticated");
- }
-
- FederationUserPrincipal user = new FederationUserPrincipal(wfRes.getUsername(), wfRes);
-
- Subject subject = new Subject();
- subject.getPrincipals().add(user);
-
- String[] aRoles = new String[roles.size()];
- roles.toArray(aRoles);
-
- return identityService.newUserIdentity(subject, user, aRoles);
-
- } catch (Exception ex) {
- LOG.warn(ex);
- }
-
- return null;
- }
-
- public boolean validate(UserIdentity user) {
- try {
- FederationUserIdentity fui = (FederationUserIdentity)user;
- return fui.getExpiryDate().after(new Date());
- } catch (ClassCastException ex) {
- LOG.warn("UserIdentity must be instance of FederationUserIdentity");
- throw new IllegalStateException("UserIdentity must be instance of FederationUserIdentity");
- }
- }
-
- @Override
- public IdentityService getIdentityService() {
- return identityService;
- }
-
- @Override
- public void setIdentityService(IdentityService service) {
- identityService = service;
- }
-
- public void logout(UserIdentity user) {
-
- }
-
- @Override
- public UserIdentity login(String username, Object credentials) {
- return null;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserIdentity.java
----------------------------------------------------------------------
diff --git a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserIdentity.java b/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserIdentity.java
deleted file mode 100644
index 23a978b..0000000
--- a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserIdentity.java
+++ /dev/null
@@ -1,94 +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.jetty8;
-
-
-import java.security.Principal;
-import java.util.Arrays;
-import java.util.Date;
-
-import javax.security.auth.Subject;
-
-import org.w3c.dom.Element;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.eclipse.jetty.server.UserIdentity;
-
-public class FederationUserIdentity implements UserIdentity {
-
- private Subject subject;
- private Principal principal;
- private String[] roles;
- private FedizResponse fedResponse;
-
- public FederationUserIdentity(Subject subject, Principal principal,
- String[] roles, FedizResponse fedResponse) {
- this.subject = subject;
- this.principal = principal;
- if (roles != null) {
- this.roles = Arrays.copyOf(roles, roles.length);
- }
- this.fedResponse = fedResponse;
- }
-
-
- public Subject getSubject() {
- return subject;
- }
-
- public Principal getUserPrincipal() {
- return principal;
- }
-
- public boolean isUserInRole(String role, Scope scope) {
- if (scope != null && scope.getRoleRefMap() != null) {
- role = scope.getRoleRefMap().get(role);
- }
-
- if (this.roles != null) {
- for (String r : this.roles) {
- if (r.equals(role)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public Date getExpiryDate() {
- return fedResponse.getTokenExpires();
- }
-
- public String getIssuer() {
- return fedResponse.getIssuer();
- }
-
- public String getAudience() {
- return fedResponse.getAudience();
- }
-
- public String getId() {
- return fedResponse.getUniqueTokenId();
- }
-
- public Element getToken() {
- return fedResponse.getToken();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserPrincipal.java
----------------------------------------------------------------------
diff --git a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserPrincipal.java b/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserPrincipal.java
deleted file mode 100644
index 7122176..0000000
--- a/plugins/jetty8/src/main/java/org/apache/cxf/fediz/jetty8/FederationUserPrincipal.java
+++ /dev/null
@@ -1,71 +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.jetty8;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.apache.cxf.fediz.core.FedizPrincipal;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-
-public class FederationUserPrincipal implements FedizPrincipal {
- private String name;
- private ClaimCollection claims;
- private FedizResponse response;
- private List<String> roles = Collections.emptyList();
-
- public FederationUserPrincipal(String name, FedizResponse response) {
- this.name = name;
- this.response = response;
- this.claims = new ClaimCollection(response.getClaims());
- if (response.getRoles() != null) {
- this.roles = response.getRoles();
- }
- }
-
- @Override
- public String getName() {
- return name;
- }
-
-
- @Override
- public ClaimCollection getClaims() {
- return claims;
- }
-
- // not public available
- //[TODO] maybe find better approach, custom UserIdentity
- FedizResponse getFedizResponse() {
- return response;
- }
-
- @Override
- public Element getLoginToken() {
- return response.getToken();
- }
-
- public List<String> getRoleClaims() {
- return Collections.unmodifiableList(roles);
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 135542d..1e3e19b 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -32,12 +32,9 @@
<modules>
<module>core</module>
- <module>tomcat7</module>
<module>tomcat8</module>
- <module>jetty8</module>
<module>jetty9</module>
<module>spring</module>
- <module>spring2</module>
<module>spring3</module>
<module>cxf</module>
</modules>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/README.txt
----------------------------------------------------------------------
diff --git a/plugins/spring2/README.txt b/plugins/spring2/README.txt
deleted file mode 100644
index 652d9e3..0000000
--- a/plugins/spring2/README.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Fediz configuration for Spring Security 2.0
--------------------------------------------
-
-The Servlet Container installation doesn't have to be updated before a Web Application can be deployed.
-
-It's recommended to use HTTPS to avoid sending tokens/cookies in clear text on the network.
-Please check your Servlet Container documentation how to set it up.
-
-Please check the Spring Security 2 example to get more information how to deploy a web application
-using Spring Security.
-
-The following wiki page explains how to configure the Fediz Spring plugin in your application:
-http://cxf.apache.org/fediz-spring-2.html
-
-The following wiki page explains the fediz configuration which is Container independent:
-http://cxf.apache.org/fediz-configuration.html
-
-Note: The Fediz Spring plugin is packaged with your application.
-Thus it's recommended to package it with the application
-using Apache Maven.
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/spring2/pom.xml b/plugins/spring2/pom.xml
deleted file mode 100644
index 527d843..0000000
--- a/plugins/spring2/pom.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?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>plugin</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>fediz-spring2</artifactId>
- <name>Apache Fediz Plugin Spring2</name>
- <packaging>bundle</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <spring.security.version>2.0.8.RELEASE</spring.security.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>${spring.security.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-core</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>${servlet.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>zip-file</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Implementation-Title>Apache CXF Fediz</Implementation-Title>
- <Implementation-Vendor>The Apache Software Foundation</Implementation-Vendor>
- <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
- <Implementation-Version>${project.version}</Implementation-Version>
- <Specification-Title>Apache CXF Fediz</Specification-Title>
- <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
- <Specification-Version>${project.version}</Specification-Version>
- <Export-Package>
- org.apache.cxf.fediz.spring.*;version="${project.version}"
- </Export-Package>
- <Import-Package>
- !org.apache.cxf.fediz.spring*,
- org.apache.cxf.fediz.core.*,
- *;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/assembly/assembly.xml b/plugins/spring2/src/main/assembly/assembly.xml
deleted file mode 100644
index 99a74db..0000000
--- a/plugins/spring2/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
-http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>zip-with-dependencies</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- <unpack>false</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfig.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfig.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfig.java
deleted file mode 100644
index 4c5ba20..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfig.java
+++ /dev/null
@@ -1,33 +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.spring;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.core.config.FedizContext;
-
-public interface FederationConfig {
-
- List<FedizContext> getFedizContextList();
-
- FedizContext getFedizContext(String contextName);
-
- FedizContext getFedizContext();
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
deleted file mode 100644
index 706bb91..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
+++ /dev/null
@@ -1,106 +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.spring;
-
-import java.util.List;
-
-import org.apache.cxf.fediz.core.config.FedizConfigurator;
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.core.io.Resource;
-import org.springframework.util.Assert;
-//import org.springframework.web.context.ServletContextAware;
-
-//public class FederationConfigImpl implements FederationConfig, ServletContextAware {
-public class FederationConfigImpl implements FederationConfig {
-
- private static final Logger LOG = LoggerFactory.getLogger(FederationConfigImpl.class);
-
- private Resource configFile;
- private String contextName;
-
- //private ServletContext servletContext;
- private FedizConfigurator configurator = new FedizConfigurator();
-
-
- public Resource getConfigFile() {
- return configFile;
- }
-
- public void setConfigFile(Resource configFile) {
- this.configFile = configFile;
- }
-
- public String getContextName() {
- return contextName;
- }
-
- public void setContextName(String contextName) {
- this.contextName = contextName;
- }
-
- public void init() {
- Assert.notNull(this.configFile, "property 'configFile' mandatory");
- try {
- configurator.loadConfig(this.configFile.getFile());
- } catch (Exception e) {
- LOG.error("Failed to parse '" + configFile.getDescription() + "'", e);
- throw new BeanCreationException("Failed to parse '" + configFile.getDescription() + "'");
- }
- }
-
- @Override
- public List<FedizContext> getFedizContextList() {
- return configurator.getFedizContextList();
- }
-
- @Override
- public FedizContext getFedizContext(String context) {
- FedizContext ctx = configurator.getFedizContext(context);
- if (ctx == null) {
- LOG.error("Federation context '" + context + "' not found.");
- throw new IllegalStateException("Federation context '" + context + "' not found.");
- }
- return ctx;
- }
-
-
- @Override
- public FedizContext getFedizContext() {
- if (contextName != null) {
- LOG.debug("Reading federation configuration for context '{}'", contextName);
- return getFedizContext(contextName);
- } else {
- Assert.notNull(contextName, "Property 'contextName' must be configured because ServletContext null");
- return getFedizContext(contextName);
- }
- }
-
-
- /*
- @Override
- public void setServletContext(ServletContext servletContext) {
- this.servletContext = servletContext;
- }
- */
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationUser.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationUser.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationUser.java
deleted file mode 100644
index 5125be2..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationUser.java
+++ /dev/null
@@ -1,53 +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.spring;
-
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.userdetails.User;
-
-public class FederationUser extends User {
-
- private static final long serialVersionUID = -2231762973730849416L;
-
- private ClaimCollection claims;
-
- public FederationUser(String username, String password, boolean enabled, boolean accountNonExpired,
- boolean credentialsNonExpired, boolean accountNonLocked,
- //Collection<? extends GrantedAuthority> authorities) {
- GrantedAuthority[] authorities) {
- super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
- }
-
- public FederationUser(String username, String password,
-// Collection<? extends GrantedAuthority> authorities, ClaimCollection claims) {
- GrantedAuthority[] authorities, ClaimCollection claims) {
- super(username, password, true, true, true, true, authorities);
- this.claims = claims;
- }
-
- public ClaimCollection getClaims() {
- return this.claims;
- }
-
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/SpringFedizMessageSource.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/SpringFedizMessageSource.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/SpringFedizMessageSource.java
deleted file mode 100644
index 976641a..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/SpringFedizMessageSource.java
+++ /dev/null
@@ -1,45 +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.spring;
-
-import org.springframework.context.support.MessageSourceAccessor;
-import org.springframework.context.support.ResourceBundleMessageSource;
-
-
-/**
- * The default <code>MessageSource</code> used by Spring Security.
- * <p>All Spring Security classes requiring messge localization will by default use this class.
- * However, all such classes will also implement <code>MessageSourceAware</code> so that the application context can
- * inject an alternative message source. Therefore this class is only used when the deployment environment has not
- * specified an alternative message source.</p>
- *
- * @author Ben Alex
- */
-public class SpringFedizMessageSource extends ResourceBundleMessageSource {
-
- public SpringFedizMessageSource() {
- setBasename("org.apache.cxf.fediz.spring.messages");
- }
-
-
- public static MessageSourceAccessor getAccessor() {
- return new MessageSourceAccessor(new SpringFedizMessageSource());
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/AbstractFederationUserDetailsService.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/AbstractFederationUserDetailsService.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/AbstractFederationUserDetailsService.java
deleted file mode 100644
index d27af7b..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/AbstractFederationUserDetailsService.java
+++ /dev/null
@@ -1,55 +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.spring.authentication;
-
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.springframework.security.Authentication;
-import org.springframework.security.userdetails.AuthenticationUserDetailsService;
-import org.springframework.security.userdetails.UserDetails;
-import org.springframework.security.userdetails.UsernameNotFoundException;
-
-/**
- * Abstract class to construct a new User object based on the provided FederationResponseAuthenticationToken.
- */
-public abstract class AbstractFederationUserDetailsService
- implements AuthenticationUserDetailsService {
-
- /*
- public final UserDetails loadUserDetails(final Authentication token) {
-
- }*/
- @Override
- public final UserDetails loadUserDetails(Authentication token) throws UsernameNotFoundException {
- if (!(token instanceof FederationResponseAuthenticationToken)) {
- return null;
- }
- FederationResponseAuthenticationToken fedToken = (FederationResponseAuthenticationToken)token;
- return loadUserDetails(fedToken.getResponse());
- }
-
- /**
- * Protected template method for construct a {@link org.springframework.security.core.userdetails.UserDetails}
- * via the supplied FedizResponse
- *
- * @return the newly created UserDetails object.
- */
- protected abstract UserDetails loadUserDetails(FedizResponse response);
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/ExpiredTokenException.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/ExpiredTokenException.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/ExpiredTokenException.java
deleted file mode 100644
index 4f8691a..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/ExpiredTokenException.java
+++ /dev/null
@@ -1,35 +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.spring.authentication;
-
-import org.springframework.security.AuthenticationException;
-
-/**
- * To be called when a token has expired
- */
-public class ExpiredTokenException extends AuthenticationException {
-
- private static final long serialVersionUID = 7639463618762010981L;
-
- public ExpiredTokenException(String errorMessage) {
- super(errorMessage);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
deleted file mode 100644
index 42d1c92..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationProvider.java
+++ /dev/null
@@ -1,169 +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.spring.authentication;
-
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.processor.FedizProcessor;
-import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
-import org.apache.cxf.fediz.core.processor.FedizRequest;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.apache.cxf.fediz.spring.FederationConfig;
-import org.apache.cxf.fediz.spring.SpringFedizMessageSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.MessageSource;
-import org.springframework.context.MessageSourceAware;
-import org.springframework.context.support.MessageSourceAccessor;
-import org.springframework.security.Authentication;
-import org.springframework.security.AuthenticationException;
-import org.springframework.security.BadCredentialsException;
-//import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
-//import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
-import org.springframework.security.providers.AuthenticationProvider;
-import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
-import org.springframework.security.userdetails.AuthenticationUserDetailsService;
-import org.springframework.security.userdetails.UserDetails;
-import org.springframework.security.userdetails.UserDetailsChecker;
-import org.springframework.security.userdetails.checker.AccountStatusUserDetailsChecker;
-import org.springframework.util.Assert;
-
-
-/**
- * This {@link AuthenticationProvider} implements the integration with the Identity Provider
- * based on the WS-Federation Passive Requestor Profile.
- */
-public class FederationAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
- private static final Logger LOG = LoggerFactory.getLogger(FederationAuthenticationProvider.class);
-
- protected MessageSourceAccessor messages = SpringFedizMessageSource.getAccessor();
-
- private AuthenticationUserDetailsService authenticationUserDetailsService;
- private FederationConfig federationConfig;
-
- private final UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
- //private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
-
- public AuthenticationUserDetailsService getAuthenticationUserDetailsService() {
- return authenticationUserDetailsService;
- }
-
- public void setAuthenticationUserDetailsService(
- AuthenticationUserDetailsService authenticationUserDetailsService) {
- this.authenticationUserDetailsService = authenticationUserDetailsService;
- }
-
- public FederationConfig getFederationConfig() {
- return federationConfig;
- }
-
- public void setFederationConfig(FederationConfig federationConfig) {
- this.federationConfig = federationConfig;
- }
-
-
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(this.authenticationUserDetailsService, "An authenticationUserDetailsService must be set");
- Assert.notNull(this.messages, "A message source must be set");
- Assert.notNull(this.federationConfig, "FederationConfig cannot be null.");
- }
-
- public Authentication authenticate(Authentication authentication) throws AuthenticationException {
- if (!supports(authentication.getClass())) {
- return null;
- }
-
- if (!(authentication instanceof UsernamePasswordAuthenticationToken)) {
- return null;
- }
-
- // Ensure credentials are provided
- if ((authentication.getCredentials() == null) || "".equals(authentication.getCredentials())) {
- throw new BadCredentialsException(messages.getMessage("FederationAuthenticationProvider.noSignInRequest",
- "Failed to get SignIn request"));
- }
-
- FederationAuthenticationToken result = null;
-
- if (result == null) {
- result = this.authenticateNow(authentication);
- result.setDetails(authentication.getDetails());
- }
-
- return result;
- }
-
- private FederationAuthenticationToken authenticateNow(final Authentication authentication)
- throws AuthenticationException {
- try {
- FedizRequest wfReq = (FedizRequest)authentication.getCredentials();
- FedizContext context = federationConfig.getFedizContext();
- FedizProcessor wfProc =
- FedizProcessorFactory.newFedizProcessor(context.getProtocol());
- FedizResponse wfRes = wfProc.processRequest(wfReq, context);
-
- final UserDetails userDetails = loadUserByFederationResponse(wfRes);
- userDetailsChecker.check(userDetails);
- return new FederationAuthenticationToken(userDetails, authentication.getCredentials(),
- userDetails.getAuthorities(), userDetails, wfRes);
- } catch (Exception e) {
- LOG.error("Failed to validate SignIn request", e);
- throw new BadCredentialsException(e.getMessage(), e);
- }
- }
-
- /**
- * Template method for retrieving the UserDetails based on the federation response (wresult parameter).
- *
- * @param response The WS Federation response
- * @return the UserDetails.
- */
- protected UserDetails loadUserByFederationResponse(final FedizResponse response) {
- final FederationResponseAuthenticationToken token = new FederationResponseAuthenticationToken(response);
- return this.authenticationUserDetailsService.loadUserDetails(token);
- }
-
- public void setMessageSource(final MessageSource messageSource) {
- this.messages = new MessageSourceAccessor(messageSource);
- }
-
- @Override
- public boolean supports(Class authentication) {
- if (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication)) {
- return true;
- } else {
- return FederationAuthenticationToken.class.isAssignableFrom(authentication);
- }
- }
-
- /*
- public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) {
- this.authoritiesMapper = authoritiesMapper;
- }
- */
-
- /*
- public boolean supports(final Class<?> authentication) {
- return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication))
- || (FederationAuthenticationToken.class.isAssignableFrom(authentication));
- }
- */
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java
deleted file mode 100644
index 5e48e5c..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationAuthenticationToken.java
+++ /dev/null
@@ -1,107 +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.spring.authentication;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-
-import org.w3c.dom.Element;
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.apache.cxf.fediz.core.FedizPrincipal;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.providers.AbstractAuthenticationToken;
-import org.springframework.security.userdetails.UserDetails;
-
-/**
- * Represents a successful WS-Federation based authentication.
- */
-public class FederationAuthenticationToken extends AbstractAuthenticationToken
- implements Serializable, FedizPrincipal {
-
- private static final long serialVersionUID = 1L;
-
- private final Object credentials;
- private final Object principal;
- private final UserDetails userDetails;
- private final FedizResponse response;
- private List<String> roles = Collections.emptyList();
-
-
- public FederationAuthenticationToken(final Object principal, final Object credentials,
- final GrantedAuthority[] authorities, final UserDetails userDetails,
- final FedizResponse response) {
- super(authorities);
-
- if ((principal == null) || "".equals(principal) || (credentials == null)
- || "".equals(credentials) || (authorities == null) || (userDetails == null) || (response == null)) {
- throw new IllegalArgumentException("Cannot pass null or empty values to constructor");
- }
-
- this.principal = principal;
- this.credentials = credentials;
- this.userDetails = userDetails;
- this.response = response;
- setAuthenticated(true);
- if (response.getRoles() != null) {
- this.roles = response.getRoles();
- }
- }
-
- public Object getCredentials() {
- return this.credentials;
- }
-
- public Object getPrincipal() {
- return this.principal;
- }
-
- public FedizResponse getResponse() {
- return this.response;
- }
-
- public UserDetails getUserDetails() {
- return userDetails;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append(" Response: ").append(this.response);
- sb.append(" Credentials: ").append(this.credentials);
-
- return sb.toString();
- }
-
- @Override
- public ClaimCollection getClaims() {
- return new ClaimCollection(response.getClaims());
- }
-
- @Override
- public Element getLoginToken() {
- return response.getToken();
- }
-
- public List<String> getRoleClaims() {
- return Collections.unmodifiableList(roles);
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationResponseAuthenticationToken.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationResponseAuthenticationToken.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationResponseAuthenticationToken.java
deleted file mode 100644
index d7f380c..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/FederationResponseAuthenticationToken.java
+++ /dev/null
@@ -1,50 +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.spring.authentication;
-
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.springframework.security.providers.AbstractAuthenticationToken;
-
-public final class FederationResponseAuthenticationToken extends AbstractAuthenticationToken {
-
- private static final long serialVersionUID = 1L;
-
- private final FedizResponse response;
-
-
- public FederationResponseAuthenticationToken(final FedizResponse response) {
- super(null);
-
- this.response = response;
- }
-
- public Object getPrincipal() {
- return this.response.getUsername();
- }
-
- public Object getCredentials() {
- return this.response;
- }
-
- public FedizResponse getResponse() {
- return this.response;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/GrantedAuthoritiesUserDetailsFederationService.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/GrantedAuthoritiesUserDetailsFederationService.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/GrantedAuthoritiesUserDetailsFederationService.java
deleted file mode 100644
index c229dde..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/authentication/GrantedAuthoritiesUserDetailsFederationService.java
+++ /dev/null
@@ -1,67 +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.spring.authentication;
-
-import java.util.*;
-
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.apache.cxf.fediz.core.processor.FedizResponse;
-import org.apache.cxf.fediz.spring.FederationUser;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.GrantedAuthorityImpl;
-import org.springframework.security.userdetails.UserDetails;
-
-/**
- * This AuthenticationUserDetailsService implementation creates a FederationUser
- * object based on the data in the provided FederationResponseAuthenticationToken.
- */
-public class GrantedAuthoritiesUserDetailsFederationService
- extends AbstractFederationUserDetailsService {
-
- private boolean convertToUpperCase = true;
-
- @Override
- protected UserDetails loadUserDetails(FedizResponse response) {
-
- List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
-
- if (response.getRoles() != null) {
- for (final String role : response.getRoles()) {
-
- grantedAuthorities.add(new GrantedAuthorityImpl("ROLE_"
- + (this.convertToUpperCase ? role.toUpperCase() : role)));
- }
- }
- return new FederationUser(response.getUsername(), "N/A",
- (GrantedAuthority[]) grantedAuthorities.toArray(
- new GrantedAuthority[grantedAuthorities.size()]),
- new ClaimCollection(response.getClaims()));
-
- }
-
-
- /**
- * Converts the role value to uppercase value.
- *
- * @param convertToUpperCase true if it should convert, false otherwise.
- */
- public void setConvertToUpperCase(final boolean convertToUpperCase) {
- this.convertToUpperCase = convertToUpperCase;
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
deleted file mode 100644
index dde6d4a..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
+++ /dev/null
@@ -1,80 +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.spring.preauth;
-
-import java.security.Principal;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.cxf.fediz.core.FedizPrincipal;
-import org.springframework.security.ui.FilterChainOrder;
-import org.springframework.security.ui.preauth.AbstractPreAuthenticatedProcessingFilter;
-
-/**
- * This AbstractPreAuthenticatedProcessingFilter implementation is based on the
- * J2EE container-based authentication mechanism. It will use the J2EE user
- * principal name as the pre-authenticated principal and the WS-Federation signin request
- * as the credentials.
- */
-public class FederationPreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter {
-
- private static final String SECURITY_TOKEN_ATTR = "org.apache.fediz.SECURITY_TOKEN";
-
- /**
- * Return the J2EE user name.
- */
- protected Object getPreAuthenticatedPrincipal(HttpServletRequest httpRequest) {
- Principal principal = httpRequest.getUserPrincipal();
- if (logger.isDebugEnabled()) {
- logger.debug("PreAuthenticated J2EE principal: "
- + principal == null ? null : principal.getName());
- }
- return principal;
- }
-
- /**
- * For J2EE container-based authentication there is no generic way to
- * retrieve the credentials, as such this method returns a fixed dummy
- * value.
- */
- protected Object getPreAuthenticatedCredentials(HttpServletRequest httpRequest) {
- Principal principal = httpRequest.getUserPrincipal() == null ? null : httpRequest.getUserPrincipal();
- if (principal instanceof FedizPrincipal) {
- Object obj = httpRequest.getSession(false).getAttribute(SECURITY_TOKEN_ATTR);
- if (obj != null) {
- return obj;
- } else {
- logger.error("Session must contain Federation response");
- throw new IllegalStateException("Session must contain Federation response");
- }
- } else {
- logger.error("Principal must be instance of FedizPrincipal: " + principal);
- throw new IllegalStateException("Principal must be instance of FedizPrincipal");
- }
- //return "N/A";
- }
-
- @Override
- public int getOrder() {
- return FilterChainOrder.BASIC_PROCESSING_FILTER;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
deleted file mode 100644
index 1c75b5c..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService.java
+++ /dev/null
@@ -1,91 +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.spring.preauth;
-
-import org.apache.cxf.fediz.core.ClaimCollection;
-import org.apache.cxf.fediz.core.FedizPrincipal;
-import org.apache.cxf.fediz.spring.FederationUser;
-import org.springframework.security.Authentication;
-import org.springframework.security.AuthenticationException;
-import org.springframework.security.GrantedAuthoritiesContainer;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.providers.preauth.PreAuthenticatedAuthenticationToken;
-import org.springframework.security.userdetails.AuthenticationUserDetailsService;
-import org.springframework.security.userdetails.UserDetails;
-import org.springframework.security.userdetails.UsernameNotFoundException;
-
-import org.springframework.util.Assert;
-
-/**
- * <p>
- * This AuthenticationUserDetailsService implementation creates a UserDetails
- * object based solely on the information contained in the given
- * PreAuthenticatedAuthenticationToken. The user name is set to the name as
- * returned by PreAuthenticatedAuthenticationToken.getName(), the password is
- * set to a fixed dummy value (it will not be used by the
- * PreAuthenticatedAuthenticationProvider anyway), and the Granted Authorities
- * are retrieved from the details object as returned by
- * PreAuthenticatedAuthenticationToken.getDetails().
- *
- * <p>
- * The details object as returned by PreAuthenticatedAuthenticationToken.getDetails() must implement the
- * {@link GrantedAuthoritiesContainer} interface for this implementation to work.
- *l
- */
-public class PreAuthenticatedGrantedAuthoritiesUserDetailsFederationService
- implements AuthenticationUserDetailsService {
- /**
- * Get a UserDetails object based on the user name contained in the given
- * token, and the GrantedAuthorities as returned by the
- * GrantedAuthoritiesContainer implementation as returned by
- * the token.getDetails() method.
- */
- public final UserDetails loadUserDetails(PreAuthenticatedAuthenticationToken token) throws AuthenticationException {
- Assert.notNull(token.getDetails());
- Assert.isInstanceOf(GrantedAuthoritiesContainer.class, token.getDetails());
- Assert.isInstanceOf(FedizPrincipal.class, token.getPrincipal());
- GrantedAuthority[] authorities =
- ((GrantedAuthoritiesContainer) token.getDetails()).getGrantedAuthorities();
-
- return createuserDetails(token, authorities, ((FedizPrincipal)token.getPrincipal()).getClaims());
- }
-
- /**
- * Creates the final <tt>UserDetails</tt> object. Can be overridden to customize the contents.
- *
- * @param token the authentication request token
- * @param authorities the pre-authenticated authorities.
- */
- protected UserDetails createuserDetails(Authentication token,
- GrantedAuthority[] authorities, ClaimCollection claims) {
- return new FederationUser(token.getName(), "N/A", authorities, claims);
- }
-
- @Override
- public UserDetails loadUserDetails(Authentication token) throws UsernameNotFoundException {
- Assert.notNull(token.getDetails());
- Assert.isInstanceOf(PreAuthenticatedAuthenticationToken.class, token);
- Assert.isInstanceOf(GrantedAuthoritiesContainer.class, token.getDetails());
- Assert.isInstanceOf(FedizPrincipal.class, token.getPrincipal());
- GrantedAuthority[] authorities =
- ((GrantedAuthoritiesContainer) token.getDetails()).getGrantedAuthorities();
-
- return createuserDetails(token, authorities, ((FedizPrincipal)token.getPrincipal()).getClaims());
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
deleted file mode 100644
index 6786290..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationEntryPoint.java
+++ /dev/null
@@ -1,155 +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.spring.web;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.metadata.MetadataDocumentHandler;
-import org.apache.cxf.fediz.core.processor.FedizProcessor;
-import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
-import org.apache.cxf.fediz.core.processor.RedirectionResponse;
-import org.apache.cxf.fediz.spring.FederationConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.security.AuthenticationException;
-import org.springframework.security.ui.AuthenticationEntryPoint;
-import org.springframework.util.Assert;
-
-
-/**
- * Used by the <code>ExceptionTranslationFilter</code> to commence authentication via the
- * WS-Federation protocol.
- * <p>
- * The user's browser will be redirected to the IDP.
- *
- */
-public class FederationAuthenticationEntryPoint implements AuthenticationEntryPoint,
- InitializingBean, ApplicationContextAware {
-
- /**
- * The key used to save the context of the request
- */
- public static final String SAVED_CONTEXT = "SAVED_CONTEXT";
-
- private static final Logger LOG = LoggerFactory.getLogger(FederationAuthenticationEntryPoint.class);
-
- private ApplicationContext appContext;
- private FederationConfig federationConfig;
- //private String servletContext;
-
- public FederationConfig getFederationConfig() {
- return federationConfig;
- }
-
- public void setFederationConfig(FederationConfig federationConfig) {
- this.federationConfig = federationConfig;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(this.appContext, "ApplicationContext cannot be null.");
- Assert.notNull(this.federationConfig, "FederationConfig cannot be null.");
- }
-
- /**
- * Template method for you to do your own pre-processing before the redirect occurs.
- *
- * @param request the HttpServletRequest
- * @param response the HttpServletResponse
- */
- protected void preCommence(final HttpServletRequest request, final HttpServletResponse response) {
-
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.appContext = applicationContext;
- }
-
- @Override
- public void commence(ServletRequest request, ServletResponse response,
- AuthenticationException authException) throws IOException, ServletException {
-
- HttpServletRequest hrequest = (HttpServletRequest)request;
- HttpServletResponse hresponse = (HttpServletResponse)response;
- FedizContext fedContext = federationConfig.getFedizContext();
- LOG.debug("Federation context: {}", fedContext);
-
- // Check to see if it is a metadata request
- MetadataDocumentHandler mdHandler = new MetadataDocumentHandler(fedContext);
- if (mdHandler.canHandleRequest(hrequest)) {
- mdHandler.handleRequest(hrequest, hresponse);
- return;
- }
-
- String redirectUrl = null;
- try {
- FedizProcessor wfProc =
- FedizProcessorFactory.newFedizProcessor(fedContext.getProtocol());
-
- RedirectionResponse redirectionResponse =
- wfProc.createSignInRequest(hrequest, fedContext);
- redirectUrl = redirectionResponse.getRedirectionURL();
-
- if (redirectUrl == null) {
- LOG.warn("Failed to create SignInRequest.");
- hresponse.sendError(
- HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest.");
- }
-
- Map<String, String> headers = redirectionResponse.getHeaders();
- if (!headers.isEmpty()) {
- for (Entry<String, String> entry : headers.entrySet()) {
- hresponse.addHeader(entry.getKey(), entry.getValue());
- }
- }
-
- HttpSession session = ((HttpServletRequest)request).getSession(true);
- session.setAttribute(SAVED_CONTEXT, redirectionResponse.getRequestState().getState());
- } catch (ProcessingException ex) {
- System.err.println("Failed to create SignInRequest: " + ex.getMessage());
- LOG.warn("Failed to create SignInRequest: " + ex.getMessage());
- hresponse.sendError(
- HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest.");
- }
-
- preCommence(hrequest, hresponse);
- if (LOG.isInfoEnabled()) {
- LOG.info("Redirecting to IDP: " + redirectUrl);
- }
- hresponse.sendRedirect(redirectUrl);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java
deleted file mode 100644
index 4104e8f..0000000
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/web/FederationAuthenticationFilter.java
+++ /dev/null
@@ -1,227 +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.spring.web;
-
-import java.io.IOException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.cxf.fediz.core.FederationConstants;
-import org.apache.cxf.fediz.core.SAMLSSOConstants;
-import org.apache.cxf.fediz.core.config.FedizContext;
-import org.apache.cxf.fediz.core.exception.ProcessingException;
-import org.apache.cxf.fediz.core.processor.FedizProcessor;
-import org.apache.cxf.fediz.core.processor.FedizProcessorFactory;
-import org.apache.cxf.fediz.core.processor.FedizRequest;
-import org.apache.cxf.fediz.core.processor.RedirectionResponse;
-import org.apache.cxf.fediz.spring.FederationConfig;
-import org.apache.cxf.fediz.spring.authentication.ExpiredTokenException;
-import org.apache.cxf.fediz.spring.authentication.FederationAuthenticationToken;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.Authentication;
-import org.springframework.security.AuthenticationException;
-import org.springframework.security.BadCredentialsException;
-import org.springframework.security.context.SecurityContext;
-import org.springframework.security.context.SecurityContextHolder;
-import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
-import org.springframework.security.ui.AbstractProcessingFilter;
-import org.springframework.security.ui.FilterChainOrder;
-
-
-public class FederationAuthenticationFilter extends AbstractProcessingFilter {
-
- private static final Logger LOG = LoggerFactory.getLogger(FederationAuthenticationFilter.class);
-
- private FederationConfig federationConfig;
-
- public FederationAuthenticationFilter() {
- super();
- }
-
- /**
- *
- */
- @Override
- protected boolean requiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
- boolean result = request.getRequestURI().contains(getFilterProcessesUrl());
- result |= isTokenExpired();
- if (logger.isDebugEnabled()) {
- logger.debug("requiresAuthentication = " + result);
- }
- return result;
- }
-
- private boolean isTokenExpired() {
- SecurityContext context = SecurityContextHolder.getContext();
- boolean detectExpiredTokens =
- federationConfig != null && federationConfig.getFedizContext().isDetectExpiredTokens();
- if (context != null && detectExpiredTokens) {
- Authentication authentication = context.getAuthentication();
- if (authentication instanceof FederationAuthenticationToken) {
- Date tokenExpires =
- ((FederationAuthenticationToken)authentication).getResponse().getTokenExpires();
- if (tokenExpires == null) {
- return false;
- }
-
- Date currentTime = new Date();
- if (currentTime.after(tokenExpires)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- @Override
- public int getOrder() {
- return FilterChainOrder.BASIC_PROCESSING_FILTER;
- }
-
- @Override
- public Authentication attemptAuthentication(HttpServletRequest request) throws AuthenticationException {
-
- if (isTokenExpired()) {
- throw new ExpiredTokenException("Token is expired");
- }
-
- verifySavedState(request);
-
- String wa = request.getParameter(FederationConstants.PARAM_ACTION);
- String responseToken = getResponseToken(request);
- FedizRequest wfReq = new FedizRequest();
- wfReq.setAction(wa);
- wfReq.setResponseToken(responseToken);
- wfReq.setState(getState(request));
- wfReq.setRequest(request);
-
- X509Certificate certs[] =
- (X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
- wfReq.setCerts(certs);
-
- final UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(null, wfReq);
-
- authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
-
- return this.getAuthenticationManager().authenticate(authRequest);
- }
-
- private void verifySavedState(HttpServletRequest request) {
- HttpSession session = request.getSession(false);
- if (session != null) {
- String savedContext = (String)session.getAttribute(FederationAuthenticationEntryPoint.SAVED_CONTEXT);
- String state = getState(request);
- if (savedContext != null && !savedContext.equals(state)) {
- logger.warn("The received state does not match the state saved in the context");
- throw new BadCredentialsException("The received state does not match the state saved in the context");
- }
- }
- }
-
- private String getState(ServletRequest request) {
- if (request.getParameter(FederationConstants.PARAM_CONTEXT) != null) {
- return request.getParameter(FederationConstants.PARAM_CONTEXT);
- } else if (request.getParameter(SAMLSSOConstants.RELAY_STATE) != null) {
- return request.getParameter(SAMLSSOConstants.RELAY_STATE);
- }
-
- return null;
- }
-
- @Override
- public void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
- AuthenticationException authException) {
- if (authException instanceof ExpiredTokenException) {
- String redirectUrl = null;
- try {
- FedizContext fedContext = federationConfig.getFedizContext();
- FedizProcessor wfProc =
- FedizProcessorFactory.newFedizProcessor(fedContext.getProtocol());
- RedirectionResponse redirectionResponse =
- wfProc.createSignInRequest(request, fedContext);
- redirectUrl = redirectionResponse.getRedirectionURL();
-
- if (redirectUrl == null) {
- LOG.warn("Failed to create SignInRequest. Redirect URL null");
- throw new BadCredentialsException("Failed to create SignInRequest. Redirect URL null");
- }
-
- Map<String, String> headers = redirectionResponse.getHeaders();
- if (!headers.isEmpty()) {
- for (Entry<String, String> entry : headers.entrySet()) {
- response.addHeader(entry.getKey(), entry.getValue());
- }
- }
-
- } catch (ProcessingException ex) {
- LOG.warn("Failed to create SignInRequest", ex);
- throw new BadCredentialsException("Failed to create SignInRequest: " + ex.getMessage());
- }
-
- if (LOG.isInfoEnabled()) {
- LOG.info("Redirecting to IDP: " + redirectUrl);
- }
- try {
- response.sendRedirect(redirectUrl);
- } catch (IOException ex) {
- throw new BadCredentialsException(ex.getMessage(), ex);
- }
- }
-
- try {
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- } catch (IOException e) {
- throw authException;
- }
- }
-
- private String getResponseToken(ServletRequest request) {
- if (request.getParameter(FederationConstants.PARAM_RESULT) != null) {
- return request.getParameter(FederationConstants.PARAM_RESULT);
- } else if (request.getParameter(SAMLSSOConstants.SAML_RESPONSE) != null) {
- return request.getParameter(SAMLSSOConstants.SAML_RESPONSE);
- }
-
- return null;
- }
-
- @Override
- public String getDefaultFilterProcessesUrl() {
- return "/j_spring_fediz_security_check";
- }
-
- public FederationConfig getFederationConfig() {
- return federationConfig;
- }
-
- public void setFederationConfig(FederationConfig fedConfig) {
- this.federationConfig = fedConfig;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/spring2/src/main/resources/org/apache/cxf/fediz/spring/messages.properties
----------------------------------------------------------------------
diff --git a/plugins/spring2/src/main/resources/org/apache/cxf/fediz/spring/messages.properties b/plugins/spring2/src/main/resources/org/apache/cxf/fediz/spring/messages.properties
deleted file mode 100644
index 8d3d4bb..0000000
--- a/plugins/spring2/src/main/resources/org/apache/cxf/fediz/spring/messages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-FederationAuthenticationProvider.incorrectKey=The presented FederationAuthenticationToken does not contain the expected key
-FederationAuthenticationProvider.noSignInRequest=Failed to get SignIn request
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/README.txt
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/README.txt b/plugins/tomcat7/README.txt
deleted file mode 100644
index 94565bb..0000000
--- a/plugins/tomcat7/README.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Fediz configuration in Tomcat
------------------------------
-
-The Tomcat installation must be updated before a Web Application can be deployed.
-
-The following wiki page gives instructions how to do that:
-http://cxf.apache.org/fediz-tomcat.html
-
-The following wiki page explains the fediz configuration which is Container independent:
-http://cxf.apache.org/fediz-configuration.html
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/pom.xml b/plugins/tomcat7/pom.xml
deleted file mode 100644
index 958d108..0000000
--- a/plugins/tomcat7/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?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>plugin</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>fediz-tomcat7</artifactId>
- <name>Apache Fediz Plugin for Tomcat 7</name>
- <packaging>jar</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-catalina</artifactId>
- <version>${tomcat7.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.fediz</groupId>
- <artifactId>fediz-core</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>zip-file</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/plugins/tomcat7/src/main/assembly/assembly.xml b/plugins/tomcat7/src/main/assembly/assembly.xml
deleted file mode 100644
index 99a74db..0000000
--- a/plugins/tomcat7/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
-http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>zip-with-dependencies</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- <unpack>false</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>