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 <[email protected]> Authored: Tue Jul 11 17:19:29 2017 +0100 Committer: Colm O hEigeartaigh <[email protected]> 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"); - } - - - } - -}
