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 '[email protected]'", - bodyTextContent.contains(claim + "[email protected]")); - - webClient.close(); - } - -}
