Modified: cxf/fediz/trunk/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java (original) +++ cxf/fediz/trunk/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/FedizConfigurationWriterTest.java Tue May 15 11:59:31 2012 @@ -5,15 +5,33 @@ import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import java.math.BigInteger; +import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; +import org.apache.cxf.fediz.core.config.jaxb.ArgumentType; +import org.apache.cxf.fediz.core.config.jaxb.AudienceUris; +import org.apache.cxf.fediz.core.config.jaxb.AuthenticationType; +import org.apache.cxf.fediz.core.config.jaxb.CertificateStores; +import org.apache.cxf.fediz.core.config.jaxb.ClaimType; +import org.apache.cxf.fediz.core.config.jaxb.ClaimTypesRequested; +import org.apache.cxf.fediz.core.config.jaxb.ContextConfig; +import org.apache.cxf.fediz.core.config.jaxb.FederationProtocolType; +import org.apache.cxf.fediz.core.config.jaxb.FedizConfig; +import org.apache.cxf.fediz.core.config.jaxb.HomeRealm; +import org.apache.cxf.fediz.core.config.jaxb.KeyStoreType; +import org.apache.cxf.fediz.core.config.jaxb.ProtocolType; +import org.apache.cxf.fediz.core.config.jaxb.TrustManagersType; +import org.apache.cxf.fediz.core.config.jaxb.TrustedIssuerType; +import org.apache.cxf.fediz.core.config.jaxb.TrustedIssuers; +import org.apache.cxf.fediz.core.config.jaxb.ValidationType; import org.junit.Assert; public class FedizConfigurationWriterTest { private static final String TRUST_ISSUER_CERT_CONSTRAINT = ".*CN=www.sts.com.*"; + private static final String TRUST_ISSUER_NAME = "Apache FEDIZ IDP"; private static final String ROLE_URI = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role"; private static final String ROLE_DELIMITER = ";"; @@ -28,7 +46,7 @@ public class FedizConfigurationWriterTes private static final String CLOCK_SKEW = "1000"; private static final String KEYSTORE_FILE = "stsstore.jks"; - private static final String FILE_TYPE = "file"; + private static final String JKS_TYPE = "JKS"; private static final String KEYSTORE_PASSWORD = "stsspass"; private static final String AUDIENCE_URI_1 = "http://host_one:port/url"; @@ -47,7 +65,7 @@ public class FedizConfigurationWriterTes config.setName(CONFIG_NAME); config.setMaximumClockSkew(new BigInteger(CLOCK_SKEW)); - config.setCertificateValidation(ValidationType.CHAIN_TRUST); + //config.setCertificateValidation(ValidationType.CHAIN_TRUST); // TrustManagersType tm0 = new TrustManagersType(); // @@ -63,24 +81,25 @@ public class FedizConfigurationWriterTes FederationProtocolType protocol = new FederationProtocolType(); config.setProtocol(protocol); - TrustedIssuers trustedIssuer = new TrustedIssuers(); - - TrustManagersType tm1 = new TrustManagersType(); - tm1.setProvider(TRUST_ISSUER_CERT_CONSTRAINT); - // CertStoreType cs1 = new CertStoreType(); - // cs1.setFile(CERT_STORE_FILE_1); - // tm1.setCertStore(cs1); - // tm1.setFactoryAlgorithm(FACTORY_ALGORITHM_2); - + TrustedIssuers trustedIssuers = new TrustedIssuers(); + + TrustedIssuerType trustedIssuer = new TrustedIssuerType(); + trustedIssuer.setCertificateValidation(ValidationType.CHAIN_TRUST); + trustedIssuer.setName(TRUST_ISSUER_NAME); + trustedIssuer.setSubject(TRUST_ISSUER_CERT_CONSTRAINT); + trustedIssuers.getIssuer().add(trustedIssuer); + config.setTrustedIssuers(trustedIssuers); + + CertificateStores certStores = new CertificateStores(); + TrustManagersType truststore = new TrustManagersType(); + KeyStoreType ks1 = new KeyStoreType(); - ks1.setType(FILE_TYPE); + ks1.setType(JKS_TYPE); ks1.setPassword(KEYSTORE_PASSWORD); ks1.setFile(KEYSTORE_FILE); - - tm1.setKeyStore(ks1); - trustedIssuer.getTrustedIssuerItem().add(tm1); - - config.setTrustedIssuers(trustedIssuer); + truststore.setKeyStore(ks1); + certStores.getTrustManager().add(truststore); + config.setCertificateStores(certStores); AuthenticationType authType = new AuthenticationType(); authType.setType(ArgumentType.STRING); @@ -163,6 +182,10 @@ public class FedizConfigurationWriterTes final JAXBContext jaxbContext = JAXBContext .newInstance(FedizConfig.class); + + /** + * Test JAXB part + */ FederationConfigurator configurator = new FederationConfigurator(); FedizConfig configOut = createConfiguration(); @@ -180,6 +203,38 @@ public class FedizConfigurationWriterTes .getProtocol(); Assert.assertEquals(HOME_REALM_CLASS, fp.getHomeRealm().getValue()); + //Assert.assertEquals(config.getCertificateValidation(),ValidationType.CHAIN_TRUST); + + /** + * Check Runtime configuration + */ + FederationContext fedContext = configurator.getFederationContext(CONFIG_NAME); + Protocol protocol = fedContext.getProtocol(); + Assert.assertTrue(protocol instanceof FederationProtocol); + FederationProtocol fedProtocol = (FederationProtocol) protocol; + Assert.assertEquals(TARGET_REALM,fedProtocol.getRealm()); + + Authentication auth = fedProtocol.getAuthenticationType(); + Assert.assertEquals(auth.getType(),PropertyType.STRING); + Assert.assertEquals(auth.getValue(),AUTH_TYPE_VALUE); + + //Assert.assertEquals(ValidationMethod.CHAIN_TRUST, fedContext.getCertificateValidation()); + List<String> audienceUris = fedContext.getAudienceUris(); + Assert.assertEquals(1,audienceUris.size()); + List<TrustedIssuer> trustedIssuers = fedContext.getTrustedIssuers(); + Assert.assertEquals(1,trustedIssuers.size()); + TrustedIssuer issuer = trustedIssuers.get(0); + Assert.assertEquals(TRUST_ISSUER_NAME, issuer.getName()); + Assert.assertEquals(CertificateValidationMethod.CHAIN_TRUST, issuer.getCertificateValidationMethod()); + Assert.assertEquals(TRUST_ISSUER_CERT_CONSTRAINT, issuer.getSubject()); + + List<TrustManager> trustManagers = fedContext.getCertificateStores(); + Assert.assertEquals(1,trustManagers.size()); + TrustManager manager = trustManagers.get(0); + KeyStore keyStore = manager.getKeyStore(); + Assert.assertEquals(JKS_TYPE, keyStore.getType()); + Assert.assertEquals(KEYSTORE_FILE, keyStore.getFile()); + Assert.assertEquals(KEYSTORE_PASSWORD, keyStore.getPassword()); }
Modified: cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config.xml (original) +++ cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config.xml Tue May 15 11:59:31 2012 @@ -4,15 +4,20 @@ <audienceUris> <audienceItem>http://host_one:port/url</audienceItem> </audienceUris> - <certificateValidation>ChainTrust</certificateValidation> + <certificateStores> + <trustManager> + <keyStore file="stsstore.jks" password="stsspass" + type="JKS" /> + </trustManager> + </certificateStores> <trustedIssuers> - <trustedIssuerItem provider=".*CN=www.sts.com.*"> - <keyStore file="stsstore.jks" password="stsspass" type="file" /> - </trustedIssuerItem> + <issuer subject=".*CN=www.sts.com.*" certificateValidation="ChainTrust" + name="DoubleItSTSIssuer" /> </trustedIssuers> + <maximumClockSkew>1000</maximumClockSkew> <protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="federationProtocolType" version="1.0.0"> + xsi:type="federationProtocolType" version="1.2"> <realm>target realm</realm> <issuer>http://url_to_the_issuer</issuer> <roleDelimiter>;</roleDelimiter> Modified: cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config2.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config2.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config2.xml (original) +++ cxf/fediz/trunk/plugins/core/src/test/resources/fediz_test_config2.xml Tue May 15 11:59:31 2012 @@ -4,15 +4,20 @@ <audienceUris> <audienceItem>http://host_one:port/url</audienceItem> </audienceUris> - <certificateValidation>ChainTrust</certificateValidation> + <certificateStores> + <trustManager> + <keyStore file="stsstore.jks" password="stsspass" + type="JKS" /> + </trustManager> + </certificateStores> <trustedIssuers> - <trustedIssuerItem provider="DoubleItSTSIssuer"> - <keyStore file="stsstore.jks" password="stsspass" type="file" /> - </trustedIssuerItem> - </trustedIssuers> + <issuer subject=".*CN=www.sts2.com.*" certificateValidation="ChainTrust" + name="DoubleItSTSIssuer" /> + </trustedIssuers> + <maximumClockSkew>1000</maximumClockSkew> <protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="federationProtocolType" version="1.0.0"> + xsi:type="federationProtocolType" version="1.2"> <realm>target realm</realm> <issuer>http://url_to_the_issuer</issuer> <roleDelimiter>;</roleDelimiter> Modified: cxf/fediz/trunk/plugins/pom.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/pom.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/plugins/pom.xml (original) +++ cxf/fediz/trunk/plugins/pom.xml Tue May 15 11:59:31 2012 @@ -24,16 +24,16 @@ <parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz</artifactId> - <version>0.6-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> </parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>plugin</artifactId> - <version>0.6-SNAPSHOT</version> <name>Apache Fediz Plugin</name> <packaging>pom</packaging> <modules> <module>core</module> <module>tomcat</module> + <module>jetty</module> </modules> </project> Modified: cxf/fediz/trunk/plugins/tomcat/pom.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/tomcat/pom.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/plugins/tomcat/pom.xml (original) +++ cxf/fediz/trunk/plugins/tomcat/pom.xml Tue May 15 11:59:31 2012 @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz</artifactId> - <version>0.6-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>fediz-tomcat</artifactId> @@ -39,6 +39,8 @@ <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-catalina</artifactId> <version>${tomcat.version}</version> + <!-- <artifactId>catalina</artifactId> + <version>6.0.35</version>--> <scope>provided</scope> </dependency> <dependency> @@ -50,7 +52,7 @@ <dependency> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz-core</artifactId> - <version>0.6-SNAPSHOT</version> + <version>${project.version}</version> <type>jar</type> <scope>compile</scope> </dependency> Modified: cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java (original) +++ cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java Tue May 15 11:59:31 2012 @@ -105,6 +105,10 @@ public class FederationAuthenticator ext if (config == null) { throw new IllegalStateException("No Fediz configuration for context :" + contextName); } + String catalinaHome = System.getProperty("catalina.home"); + if (catalinaHome != null && catalinaHome.length() > 0) { + config.setRelativePath(catalinaHome); + } return config; } Modified: cxf/fediz/trunk/pom.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/pom.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/pom.xml (original) +++ cxf/fediz/trunk/pom.xml Tue May 15 11:59:31 2012 @@ -23,7 +23,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz</artifactId> - <version>0.6-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <name>Apache Fediz</name> <packaging>pom</packaging> @@ -31,6 +31,7 @@ <slf4j.version>1.6.1</slf4j.version> <spring.version>3.0.7.RELEASE</spring.version> <tomcat.version>7.0.21</tomcat.version> + <jetty.version>8.1.3.v20120416</jetty.version> <junit.version>4.8.2</junit.version> <tomcat.url>http://localhost:8080/manager/text</tomcat.url> <cxf.version>2.6.1-SNAPSHOT</cxf.version> @@ -268,18 +269,13 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.12</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.1.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>2.3.2</version> + <version>2.4</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> @@ -389,6 +385,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> + <version>2.9</version> <configuration> <outputDirectory>${fediz.eclipse.outputDirectory}</outputDirectory> <buildcommands> @@ -452,6 +449,7 @@ <suppressionsLocation>${fediz.resources.base.path}cxf-checkstyle-suppressions.xml</suppressionsLocation> <sourceDirectory>${basedir}/src</sourceDirectory> <excludes>**/archetype-resources/**/*.java</excludes> + <excludes>**/jaxb/**/*.java</excludes> </configuration> <goals> <goal>checkstyle</goal> @@ -462,6 +460,11 @@ --> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>2.9.1</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>2.7.1</version> <dependencies> @@ -498,6 +501,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>2.12</version> <configuration> <includes> <include>**/*Test.java</include> @@ -611,7 +615,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>2.3.2</version> + <version>2.4</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> @@ -699,6 +703,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> + <version>2.4</version> <configuration> <showDeprecation>${fediz.compile.show.deprecation}</showDeprecation> <showWarnings>true</showWarnings> @@ -734,6 +739,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> + <version>2.4</version> <configuration> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> Modified: cxf/fediz/trunk/services/idp/pom.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/pom.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/services/idp/pom.xml (original) +++ cxf/fediz/trunk/services/idp/pom.xml Tue May 15 11:59:31 2012 @@ -24,7 +24,7 @@ <parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz</artifactId> - <version>0.6-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>fediz-idp</artifactId> Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/RPClaims.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/RPClaims.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/RPClaims.xml (original) +++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/RPClaims.xml Tue May 15 11:59:31 2012 @@ -13,6 +13,8 @@ value-ref="claimsWsfedhelloworld" /> <entry key="http://localhost:8080/fedizhelloworld/" value-ref="claimsWsfedhelloworld2" /> + <entry key="https://localhost:8443/fedizhelloworld/" + value-ref="claimsWsfedhelloworld2" /> </util:map> @@ -29,4 +31,4 @@ <value>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</value> </util:list> -</beans> \ No newline at end of file +</beans> Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/beans.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/beans.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/beans.xml (original) +++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/beans.xml Tue May 15 11:59:31 2012 @@ -27,7 +27,7 @@ </cxf:bus> - <http:conduit name="https://localhost:8443/.*"> + <http:conduit name="https://localhost:9443/.*"> <http:tlsClientParameters disableCNCheck="true"> <sec:trustManagers> <sec:keyStore type="jks" password="cspass" resource="clientstore.jks"/> Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml (original) +++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml Tue May 15 11:59:31 2012 @@ -13,7 +13,7 @@ <servlet-class>org.apache.cxf.fediz.service.idp.IdpServlet</servlet-class> <init-param> <param-name>sts.wsdl.url</param-name> - <param-value>https://localhost:8443/fedizidpsts/STSService?wsdl</param-value> + <param-value>https://localhost:9443/fedizidpsts/STSService?wsdl</param-value> </init-param> <init-param> <param-name>sts.wsdl.service</param-name> Modified: cxf/fediz/trunk/services/pom.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/pom.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/services/pom.xml (original) +++ cxf/fediz/trunk/services/pom.xml Tue May 15 11:59:31 2012 @@ -24,12 +24,11 @@ <parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz</artifactId> - <version>0.6-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>services</artifactId> - <version>0.6-SNAPSHOT</version> <name>Apache Fediz Services</name> <packaging>pom</packaging> Modified: cxf/fediz/trunk/services/sts/pom.xml URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/pom.xml?rev=1338661&r1=1338660&r2=1338661&view=diff ============================================================================== --- cxf/fediz/trunk/services/sts/pom.xml (original) +++ cxf/fediz/trunk/services/sts/pom.xml Tue May 15 11:59:31 2012 @@ -24,7 +24,7 @@ <parent> <groupId>org.apache.cxf.fediz</groupId> <artifactId>fediz</artifactId> - <version>0.6-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>fediz-idp-sts</artifactId>
