You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2013/05/18 18:04:40 UTC
svn commit: r1484133 [4/6] - in /cxf/trunk/services: ./ xkms/
xkms/xkms-client/ xkms/xkms-client/src/ xkms/xkms-client/src/main/
xkms/xkms-client/src/main/java/ xkms/xkms-client/src/main/java/org/
xkms/xkms-client/src/main/java/org/apache/ xkms/xkms-cl...
Added: cxf/trunk/services/xkms/xkms-osgi/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/pom.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/pom.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/pom.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,66 @@
+<?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>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-osgi</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache CXF XKMS OSGi deployment</name>
+ <url>http://cxf.apache.org</url>
+
+ <parent>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-parent</artifactId>
+ <version>2.8.0-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-x509-handlers</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Require-Bundle>
+ org.apache.cxf.bundle,
+ org.springframework.beans
+ </Require-Bundle>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/cxf-endpoint.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/cxf-endpoint.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/cxf-endpoint.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/cxf-endpoint.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,54 @@
+<!-- #%L ReservationService Client %% Copyright (C) 2011 - 2012 Talend Inc.
+ %% Licensed 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.
+ #L% -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/blueprint/core"
+ xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xmlns:ext="http://www.osgi.org/xmlns/blueprint-ext/v1.1.0"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+ http://www.osgi.org/xmlns/blueprint-ext/v1.1.0 https://svn.apache.org/repos/asf/aries/tags/blueprint-0.3.1/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext.xsd
+ http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
+ http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
+ http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
+ ">
+
+ <bean id="xkmsProviderBean" class="org.apache.cxf.xkms.service.XKMSService">
+ <property name="validators">
+ <list>
+ <ref component-id="dateValidator" />
+ </list>
+ </property>
+ <property name="locators">
+ <list>
+ <ref component-id="x509LdapLocator" />
+ <!-- ref component-id="x509FileLocator" /-->
+ </list>
+ </property>
+ <property name="keyRegisterHandlers">
+ <list>
+ <ref component-id="ldapRegisterHandler" />
+ <!-- ref component-id="fileRegisterHandler" /-->
+ </list>
+ </property>
+ </bean>
+
+ <bean id="additionalClasses" class="org.apache.cxf.xkms.model.extensions.AdditionalClassesFactory"/>
+
+ <jaxws:endpoint id="XKMSService" xmlns:serviceNamespace="http://www.w3.org/2002/03/xkms#wsdl"
+ serviceName="serviceNamespace:XKMSService" endpointName="serviceNamespace:XKMSPort"
+ implementor="#xkmsProviderBean" address="/XKMS">
+ <jaxws:properties>
+ <entry key="jaxb.additionalContextClasses">
+ <bean class="java.lang.Object" factory-ref="additionalClasses" factory-method="create"/>
+ </entry>
+ </jaxws:properties>
+ </jaxws:endpoint>
+
+</blueprint>
Added: cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/xkms-key-handlers.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/xkms-key-handlers.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/xkms-key-handlers.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/xkms-key-handlers.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2008, 2009 SOPERA GmbH. All rights reserved. This program
+ and the accompanying materials are made available under the terms of the
+ Eclipse Public License v1.0 which accompanies this distribution, and is available
+ at http://www.eclipse.org/legal/epl-v10.html Contributors: SOPERA GmbH -
+ initial API and implementation -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/blueprint/core"
+ xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xmlns:ext="http://www.osgi.org/xmlns/blueprint-ext/v1.1.0"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+ http://www.osgi.org/xmlns/blueprint-ext/v1.1.0 https://svn.apache.org/repos/asf/aries/tags/blueprint-0.3.1/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext.xsd
+ http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
+ http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
+ http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
+ ">
+
+ <cm:property-placeholder persistent-id="org.apache.cxf.xkms"/>
+
+ <bean id="dateValidator" class="org.apache.cxf.xkms.x509.validator.DateValidator" />
+
+ <bean id="x509LdapLocator" class="org.apache.cxf.xkms.x509.locator.LdapLocator">
+ <argument ref="ldapSearch" />
+ <argument value="${xkms.backend.ldap.rootDN}" />
+ </bean>
+
+ <bean id="ldapRegisterHandler" class="org.apache.cxf.xkms.x509.handlers.LdapRegisterHandler">
+ <argument ref="ldapSearch" />
+ <argument value="${xkms.backend.ldap.rootDN}" />
+ </bean>
+
+ <bean id="ldapSearch" class="org.apache.cxf.xkms.x509.handlers.LDAPSearch">
+ <argument value="${xkms.backend.ldap.url}" />
+ <argument value="${xkms.backend.ldap.user}" />
+ <argument value="${xkms.backend.ldap.pwd}" />
+ <argument value="${xkms.backend.ldap.retry}" />
+ </bean>
+
+ <!-- bean id="x509FileLocator" class="org.apache.cxf.xkms.x509.locator.FileLocator">
+ <argument value="${xkms.backend.file.storageDir}" />
+ </bean>
+
+ <bean id="fileRegisterHandler" class="org.apache.cxf.xkms.x509.handlers.FileRegisterHandler">
+ <argument value="${xkms.filepersistence.storageDir}" />
+ </bean-->
+
+</blueprint>
Added: cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-locate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-locate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-locate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-locate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,12 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:LocateRequest xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#">
+ <ns2:QueryKeyBinding>
+ <ns2:UseKeyWith Application="urn:ietf:rfc:2459"
+ Identifier="CN=www.issuer.com" />
+ </ns2:QueryKeyBinding>
+ </ns2:LocateRequest>
+ </soap:Body>
+</soap:Envelope>
+
Added: cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-validate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-validate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-validate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/request-validate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,15 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:ValidateRequest xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#"
+ Id="CN=www.anothersts.com, L=CGN, ST=NRW, C=DE, O=AnotherSTS">
+ <ns2:QueryKeyBinding>
+ <KeyInfo>
+ <X509Data>
+ <X509Certificate>MIIFIjCCAwoCAQEwDQYJKoZIhvcNAQEFBQAwUzEPMA0GA1UEChMGSXNzdWVyMQswCQYDVQQGEwJERTEMMAoGA1UECBMDTlJXMQwwCgYDVQQHEwNDR04xFzAVBgNVBAMTDnd3dy5pc3N1ZXIuY29tMB4XDTEyMDIyOTEyMjMxOVoXDTEzMDIyODEyMjMxOVowWzETMBEGA1UEChMKQW5vdGhlclNUUzELMAkGA1UEBhMCREUxDDAKBgNVB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C/Uhab6QgWySHyTyguH7EFGN9a0/7IRynd+UVqErA2DyjCE6mgzzT7mqVg5ox8W4Flzq2kmip8foLAZ4zW6b19y71+2LUVIPguEfufhLbpmmF65ezDZUmYRYFFHWulhPufSpfEUZguKXIM0voIXAgYrbdtLmHPTGb8Qm3qPDcVQJsOEeqTDbRB9nnXP1t+gaSKr/IO597Mr9o9+TUq2WlH1H3NauLL3XCsWmL0pBEBM8a5fMxs04xPdW9V6A8EyHk4CcSOofMJiAZQIlllqsdYQBsOD/iGVHeVYXSnP0PnQmCjdQMaoGIl/dC6oLuk2EerekIuR1NVMdGchpPY/Q2GQmpnnou0faCK/pE9nUEoh+uxva6iOi7Ns2O3gR2aXxeZM1Bgm4SwTnAl5Acnpy5Forg5pg==</X509Certificate>
+ </X509Data>
+ </KeyInfo>
+ </ns2:QueryKeyBinding>
+ </ns2:ValidateRequest>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added: cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-locate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-locate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-locate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-locate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,17 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:LocateResult xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#"
+ ResultMajor="http://www.w3.org/2002/03/xkms#Success" Id="3bcbb1d6-3215-41aa-aafe-8192e324d283"
+ Service="http://services.sopera.org/xkms/v2.0">
+ <ns2:UnverifiedKeyBinding>
+ <KeyInfo>
+ <X509Data>
+ <X509Certificate>MIIF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oLmMeAxU7v5mcE6U2bDmP63cMIGDBgNVHSMEfDB6gBQjfKC5jHgMVO7+ZnBOlNmw5j+t3KFXpFUwUzEPMA0GA1UEChMGSXNzdWVyMQswCQYDVQQGEwJERTEMMAoGA1UECBMDTlJXMQwwCgYDVQQHEwNDR04xFzAVBgNVBAMTDnd3dy5pc3N1ZXIuY29tggkAojYNnDcwupEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAgEAPDAcr3TdfLlczzkBR6iiN63ERK/FnIcB8vIJdxJeYsq/w49CgxMjOugGsZ7rKTmT89zPQzVe/GJITRHNS1q81cf8hd4SWZ/i3z7k8tqhMRq0b31aQqkLzjPWD6PAwzDWUAY8HMMq9Gbxx52u4yXxx1PabTxq/0EDtX7+JfZ462BGtWCcUrrXq6Wck4acvAw2NmMfUR+RYLVKLINen82KD1YAl+mOKFfc3r9i1mLi/ylE2LuKN6Z3LnYAcaUgq22mRKR6hGXyw4zU2HzFNlgBnoJottYdZWxa5Chcr6wMgZS/rg3gQ8z6ALOFG/UTBxcXRmI0CCBhTPjn4Dq8gd+BWixBzFVF8DoYEyVEX7fGNOAwb3OZCQMVsaM6PuqIfiz0s5oiqdohYSzwXc6ajmQB7JJkfHE8B43dnL+G1+d2mqvhXhTeJNlwC0Hcqtc7MY2rRDY0Kj0LrGqjhN6kKiXHXA0YqVpn1W7qsu+GS51jxpxZ2DUELNuIhXU/xbP3IS/BKMgiwNM2kZBtP0qkfKlsO9IemiQTNGZzxm+DJvE5U4wC0cVxsvqRTqdfKumaIMoUHsIrC5OWibTZ658KFuZZGHtxolH1sZnSPjs9D9RC9xDv5OyIHcH
cMhN6c7wk2Tf3GpY91r6Sp6TxIkB2cZQDT8eTSS/PTHC+muh5/365lRE=
+ </X509Certificate>
+ </X509Data>
+ </KeyInfo>
+ </ns2:UnverifiedKeyBinding>
+ </ns2:LocateResult>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added: cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-validate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-validate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-validate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/main/resources/test-requests/response-validate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,17 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:ValidateResult xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#"
+ ResultMajor="http://www.w3.org/2002/03/xkms#Success"
+ RequestId="CN=www.anothersts.com, L=CGN, ST=NRW, C=DE, O=AnotherSTS"
+ Id="bbc29ec6-11b5-4dd1-97d4-01279fb0e8a5" Service="http://services.sopera.org/xkms/v2.0">
+ <ns2:KeyBinding>
+ <ns2:Status StatusValue="http://www.w3.org/2002/03/xkms#Valid">
+ <ns2:ValidReason>http://www.w3.org/2002/03/xkms#IssuerTrust</ns2:ValidReason>
+ <ns2:ValidReason>http://www.w3.org/2002/03/xkms#Signature</ns2:ValidReason>
+ <ns2:ValidReason>http://www.w3.org/2002/03/xkms#ValidityInterval</ns2:ValidReason>
+ </ns2:Status>
+ </ns2:KeyBinding>
+ </ns2:ValidateResult>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added: cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-locate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-locate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-locate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-locate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,12 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:LocateRequest xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#">
+ <ns2:QueryKeyBinding>
+ <ns2:UseKeyWith Application="urn:ietf:rfc:2459"
+ Identifier="CN=www.issuer.com" />
+ </ns2:QueryKeyBinding>
+ </ns2:LocateRequest>
+ </soap:Body>
+</soap:Envelope>
+
Added: cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-validate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-validate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-validate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/request-validate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,15 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:ValidateRequest xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#"
+ Id="CN=www.anothersts.com, L=CGN, ST=NRW, C=DE, O=AnotherSTS">
+ <ns2:QueryKeyBinding>
+ <KeyInfo>
+ <X509Data>
+ <X509Certificate>MIIFIjCCAwoCAQEwDQYJKoZIhvcNAQEFBQAwUzEPMA0GA1UEChMGSXNzdWVyMQswCQYDVQQGEwJERTEMMAoGA1UECBMDTlJXMQwwCgYDVQQHEwNDR04xFzAVBgNVBAMTDnd3dy5pc3N1ZXIuY29tMB4XDTEyMDIyOTEyMjMxOVoXDTEzMDIyODEyMjMxOVowWzETMBEGA1UEChMKQW5vdGhlclNUUzELMAkGA1UEBhMCREUxDDAKBgNVBAgTA05SV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QgWySHyTyguH7EFGN9a0/7IRynd+UVqErA2DyjCE6mgzzT7mqVg5ox8W4Flzq2kmip8foLAZ4zW6b19y71+2LUVIPguEfufhLbpmmF65ezDZUmYRYFFHWulhPufSpfEUZguKXIM0voIXAgYrbdtLmHPTGb8Qm3qPDcVQJsOEeqTDbRB9nnXP1t+gaSKr/IO597Mr9o9+TUq2WlH1H3NauLL3XCsWmL0pBEBM8a5fMxs04xPdW9V6A8EyHk4CcSOofMJiAZQIlllqsdYQBsOD/iGVHeVYXSnP0PnQmCjdQMaoGIl/dC6oLuk2EerekIuR1NVMdGchpPY/Q2GQmpnnou0faCK/pE9nUEoh+uxva6iOi7Ns2O3gR2aXxeZM1Bgm4SwTnAl5Acnpy5Forg5pg==</X509Certificate>
+ </X509Data>
+ </KeyInfo>
+ </ns2:QueryKeyBinding>
+ </ns2:ValidateRequest>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added: cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-locate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-locate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-locate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-locate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,17 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:LocateResult xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#"
+ ResultMajor="http://www.w3.org/2002/03/xkms#Success" Id="3bcbb1d6-3215-41aa-aafe-8192e324d283"
+ Service="http://services.sopera.org/xkms/v2.0">
+ <ns2:UnverifiedKeyBinding>
+ <KeyInfo>
+ <X509Data>
+ <X509Certificate>MIIF4DCCA8ig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U7v5mcE6U2bDmP63cMIGDBgNVHSMEfDB6gBQjfKC5jHgMVO7+ZnBOlNmw5j+t3KFXpFUwUzEPMA0GA1UEChMGSXNzdWVyMQswCQYDVQQGEwJERTEMMAoGA1UECBMDTlJXMQwwCgYDVQQHEwNDR04xFzAVBgNVBAMTDnd3dy5pc3N1ZXIuY29tggkAojYNnDcwupEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAgEAPDAcr3TdfLlczzkBR6iiN63ERK/FnIcB8vIJdxJeYsq/w49CgxMjOugGsZ7rKTmT89zPQzVe/GJITRHNS1q81cf8hd4SWZ/i3z7k8tqhMRq0b31aQqkLzjPWD6PAwzDWUAY8HMMq9Gbxx52u4yXxx1PabTxq/0EDtX7+JfZ462BGtWCcUrrXq6Wck4acvAw2NmMfUR+RYLVKLINen82KD1YAl+mOKFfc3r9i1mLi/ylE2LuKN6Z3LnYAcaUgq22mRKR6hGXyw4zU2HzFNlgBnoJottYdZWxa5Chcr6wMgZS/rg3gQ8z6ALOFG/UTBxcXRmI0CCBhTPjn4Dq8gd+BWixBzFVF8DoYEyVEX7fGNOAwb3OZCQMVsaM6PuqIfiz0s5oiqdohYSzwXc6ajmQB7JJkfHE8B43dnL+G1+d2mqvhXhTeJNlwC0Hcqtc7MY2rRDY0Kj0LrGqjhN6kKiXHXA0YqVpn1W7qsu+GS51jxpxZ2DUELNuIhXU/xbP3IS/BKMgiwNM2kZBtP0qkfKlsO9IemiQTNGZzxm+DJvE5U4wC0cVxsvqRTqdfKumaIMoUHsIrC5OWibTZ658KFuZZGHtxolH1sZnSPjs9D9RC9xDv5OyIHcH
cMhN6c7wk2Tf3GpY91r6Sp6TxIkB2cZQDT8eTSS/PTHC+muh5/365lRE=
+ </X509Certificate>
+ </X509Data>
+ </KeyInfo>
+ </ns2:UnverifiedKeyBinding>
+ </ns2:LocateResult>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added: cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-validate.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-validate.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-validate.xml (added)
+++ cxf/trunk/services/xkms/xkms-osgi/src/test/resources/test-requests/response-validate.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,17 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:ValidateResult xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ns2="http://www.w3.org/2002/03/xkms#" xmlns:ns3="http://www.w3.org/2001/04/xmlenc#"
+ ResultMajor="http://www.w3.org/2002/03/xkms#Success"
+ RequestId="CN=www.anothersts.com, L=CGN, ST=NRW, C=DE, O=AnotherSTS"
+ Id="bbc29ec6-11b5-4dd1-97d4-01279fb0e8a5" Service="http://services.sopera.org/xkms/v2.0">
+ <ns2:KeyBinding>
+ <ns2:Status StatusValue="http://www.w3.org/2002/03/xkms#Valid">
+ <ns2:ValidReason>http://www.w3.org/2002/03/xkms#IssuerTrust</ns2:ValidReason>
+ <ns2:ValidReason>http://www.w3.org/2002/03/xkms#Signature</ns2:ValidReason>
+ <ns2:ValidReason>http://www.w3.org/2002/03/xkms#ValidityInterval</ns2:ValidReason>
+ </ns2:Status>
+ </ns2:KeyBinding>
+ </ns2:ValidateResult>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file
Added: cxf/trunk/services/xkms/xkms-service/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-service/pom.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-service/pom.xml (added)
+++ cxf/trunk/services/xkms/xkms-service/pom.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,56 @@
+<?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>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-service</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache CXF XKMS Service</name>
+ <url>http://cxf.apache.org</url>
+
+ <parent>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-parent</artifactId>
+ <version>2.8.0-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSResponseFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSResponseFactory.java?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSResponseFactory.java (added)
+++ cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSResponseFactory.java Sat May 18 16:04:37 2013
@@ -0,0 +1,109 @@
+/**
+ * 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.xkms.service;
+
+import java.util.UUID;
+
+import org.apache.cxf.xkms.model.xkms.RequestAbstractType;
+import org.apache.cxf.xkms.model.xkms.ResultMajorEnum;
+import org.apache.cxf.xkms.model.xkms.ResultType;
+
+public final class XKMSResponseFactory {
+
+ private XKMSResponseFactory() {
+ }
+
+ /**
+ * @param request Request to generate response for
+ * @return Returns response for provided request, with SUCCESS as default major result.
+ */
+ public static ResultType createResponse(RequestAbstractType request) {
+ return createResponse(request, new ResultType());
+ }
+
+ /**
+ * The following activities are performed:
+ *
+ * 1) generation and assigning of unique response ID
+ * 2) copying of request id
+ * 3) copying of service name
+ * 4) copying of opaqueClientData
+ * 5) setting major result to success
+ *
+ * @param request Request to be used for response
+ * @param response Response to be enriched
+ * @return Returns enriched response
+ */
+ public static <T extends ResultType> T createResponse(RequestAbstractType request, T response) {
+ response.setId(generateUniqueID());
+
+ copyRequestId(request, response);
+ copyServiceName(request, response);
+ copyOpaqueClientData(request, response);
+
+ response.setResultMajor(ResultMajorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SUCCESS.value());
+
+ return response;
+ }
+
+ /**
+ * Copies OpaqueClientData from request to response as per XKMS specification
+ * http://www.w3.org/TR/xkms2/#XKMS_2_0_Section_1 [86]
+ *
+ * @param request Containing OpaqueClientData
+ * @param response to be used for inserting OpaqueClientData
+ * @return Response unmodified, except for including OpaqueClientData from request
+ */
+ public static ResultType copyOpaqueClientData(RequestAbstractType request, ResultType response) {
+ response.setOpaqueClientData(request.getOpaqueClientData());
+ return response;
+ }
+
+ /**
+ * Copies Request ID to response as per XKMS specification http://www.w3.org/TR/xkms2/#XKMS_2_0_Section_1
+ *
+ * @param request Containing request ID
+ * @param response to be used for inserting request ID
+ * @return Response unmodified, except for setting request ID
+ */
+ public static ResultType copyRequestId(RequestAbstractType request, ResultType response) {
+ response.setRequestId(request.getId());
+ return response;
+ }
+
+ /**
+ * Copies service name from request to response.
+ *
+ * @param request containing service name
+ * @param response to be used for inserting service name
+ * @return Response unmodified, except for setting service name
+ */
+ public static ResultType copyServiceName(RequestAbstractType request, ResultType response) {
+ response.setService(request.getService());
+ return response;
+ }
+
+ /**
+ * @return Returns generated random UUID
+ */
+ public static String generateUniqueID() {
+ return UUID.randomUUID().toString();
+ }
+
+}
Added: cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java (added)
+++ cxf/trunk/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java Sat May 18 16:04:37 2013
@@ -0,0 +1,313 @@
+/**
+ * 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.xkms.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.xkms.exception.ExceptionMapper;
+import org.apache.cxf.xkms.handlers.KeyRegisterHandler;
+import org.apache.cxf.xkms.handlers.Locator;
+import org.apache.cxf.xkms.handlers.Validator;
+import org.apache.cxf.xkms.handlers.XKMSConstants;
+import org.apache.cxf.xkms.model.xkms.CompoundRequestType;
+import org.apache.cxf.xkms.model.xkms.CompoundResultType;
+import org.apache.cxf.xkms.model.xkms.KeyBindingAbstractType;
+import org.apache.cxf.xkms.model.xkms.KeyBindingEnum;
+import org.apache.cxf.xkms.model.xkms.KeyBindingType;
+import org.apache.cxf.xkms.model.xkms.KeyUsageEnum;
+import org.apache.cxf.xkms.model.xkms.LocateRequestType;
+import org.apache.cxf.xkms.model.xkms.LocateResultType;
+import org.apache.cxf.xkms.model.xkms.MessageAbstractType;
+import org.apache.cxf.xkms.model.xkms.PendingRequestType;
+import org.apache.cxf.xkms.model.xkms.RecoverRequestType;
+import org.apache.cxf.xkms.model.xkms.RecoverResultType;
+import org.apache.cxf.xkms.model.xkms.RegisterRequestType;
+import org.apache.cxf.xkms.model.xkms.RegisterResultType;
+import org.apache.cxf.xkms.model.xkms.ReissueRequestType;
+import org.apache.cxf.xkms.model.xkms.ReissueResultType;
+import org.apache.cxf.xkms.model.xkms.ResultMinorEnum;
+import org.apache.cxf.xkms.model.xkms.ResultType;
+import org.apache.cxf.xkms.model.xkms.RevokeRequestType;
+import org.apache.cxf.xkms.model.xkms.RevokeResultType;
+import org.apache.cxf.xkms.model.xkms.StatusRequestType;
+import org.apache.cxf.xkms.model.xkms.StatusResultType;
+import org.apache.cxf.xkms.model.xkms.StatusType;
+import org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType;
+import org.apache.cxf.xkms.model.xkms.ValidateRequestType;
+import org.apache.cxf.xkms.model.xkms.ValidateResultType;
+import org.w3._2002._03.xkms_wsdl.XKMSPortType;
+
+public class XKMSService implements XKMSPortType {
+
+ protected static final Logger LOG = LogUtils.getL7dLogger(XKMSService.class);
+
+ private String serviceName = XKMSConstants.XKMS_ENDPOINT_NAME;
+
+ private List<Locator> locators = new ArrayList<Locator>();
+
+ private List<Validator> validators = new ArrayList<Validator>();
+
+ private List<KeyRegisterHandler> keyRegisterHandlers = new ArrayList<KeyRegisterHandler>();
+
+ @Override
+ public ReissueResultType reissue(ReissueRequestType request) {
+ try {
+ validateRequest(request);
+ ReissueResultType response = XKMSResponseFactory.createResponse(request, new ReissueResultType());
+ try {
+ for (KeyRegisterHandler handler : keyRegisterHandlers) {
+ if (handler.canProcess(request)) {
+ return handler.reissue(request, response);
+ }
+ }
+ throw new UnsupportedOperationException("Service was unable to handle your request");
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Error due X509 Validation: " + e.getMessage(), e);
+ return ExceptionMapper.toResponse(e, response);
+ }
+ } catch (Exception e) {
+ return ExceptionMapper.toResponse(e, XKMSResponseFactory.createResponse(request, new ReissueResultType()));
+ }
+ }
+
+ @Override
+ public CompoundResultType compound(CompoundRequestType request) {
+ validateRequest(request);
+
+ return ExceptionMapper.toResponse(new UnsupportedOperationException("XKMS request is currently not supported"),
+ XKMSResponseFactory.createResponse(request, new CompoundResultType()));
+ }
+
+ @Override
+ public RegisterResultType register(RegisterRequestType request) {
+ try {
+ validateRequest(request);
+ RegisterResultType response = XKMSResponseFactory.createResponse(request, new RegisterResultType());
+ try {
+ for (KeyRegisterHandler handler : keyRegisterHandlers) {
+ if (handler.canProcess(request)) {
+ return handler.register(request, response);
+ }
+ }
+ throw new UnsupportedOperationException("Service was unable to handle your request");
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Error due X509 Validation: " + e.getMessage(), e);
+ return ExceptionMapper.toResponse(e, response);
+ }
+ } catch (Exception e) {
+ return ExceptionMapper.toResponse(e, XKMSResponseFactory.createResponse(request, new RegisterResultType()));
+ }
+ }
+
+ @Override
+ public ResultType pending(PendingRequestType request) {
+ validateRequest(request);
+
+ return ExceptionMapper.toResponse(new UnsupportedOperationException("XKMS request is currently not supported"),
+ XKMSResponseFactory.createResponse(request, new ResultType()));
+ }
+
+ @Override
+ public RevokeResultType revoke(RevokeRequestType request) {
+ try {
+ validateRequest(request);
+ RevokeResultType response = XKMSResponseFactory.createResponse(request, new RevokeResultType());
+ try {
+ for (KeyRegisterHandler handler : keyRegisterHandlers) {
+ if (handler.canProcess(request)) {
+ return handler.revoke(request, response);
+ }
+ }
+ throw new UnsupportedOperationException("Service was unable to handle your request");
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Error due X509 Validation: " + e.getMessage(), e);
+ return ExceptionMapper.toResponse(e, response);
+ }
+ } catch (Exception e) {
+ return ExceptionMapper.toResponse(e, XKMSResponseFactory.createResponse(request, new RevokeResultType()));
+ }
+ }
+
+ @Override
+ public LocateResultType locate(LocateRequestType request) {
+ try {
+ validateRequest(request);
+ // Create basic response
+ LocateResultType result = XKMSResponseFactory.createResponse(request, new LocateResultType());
+ // Search
+ for (Locator locator : getLocators()) {
+ UnverifiedKeyBindingType keyBinding = locator.locate(request);
+ if (keyBinding != null) {
+ result.getUnverifiedKeyBinding().add(keyBinding);
+ return result;
+ }
+ }
+ // No matches found
+ result.setResultMinor(ResultMinorEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_NO_MATCH.value());
+ return result;
+ } catch (Exception e) {
+ return ExceptionMapper.toResponse(e, XKMSResponseFactory.createResponse(request, new LocateResultType()));
+ }
+ }
+
+ @Override
+ public RecoverResultType recover(RecoverRequestType request) {
+ validateRequest(request);
+
+ return ExceptionMapper.toResponse(new UnsupportedOperationException("XKMS request is currently not supported"),
+ XKMSResponseFactory.createResponse(request, new RecoverResultType()));
+ }
+
+ @Override
+ public StatusResultType status(StatusRequestType request) {
+ validateRequest(request);
+
+ return ExceptionMapper.toResponse(new UnsupportedOperationException("XKMS request is currently not supported"),
+ XKMSResponseFactory.createResponse(request, new StatusResultType()));
+ }
+
+ @Override
+ public ValidateResultType validate(ValidateRequestType request) {
+ try {
+ validateRequest(request);
+
+ // Create basic response
+ ValidateResultType result = XKMSResponseFactory.createResponse(request, new ValidateResultType());
+ KeyBindingType binding = createKeyBinding(result);
+
+ // Validate request
+ for (Validator validator : validators) {
+ StatusType status = validator.validate(request);
+ addValidationReasons(binding, status);
+ }
+
+ resolveValidationStatus(binding);
+ return result;
+ } catch (Exception e) {
+ return ExceptionMapper.toResponse(e, XKMSResponseFactory.createResponse(request, new ValidateResultType()));
+ }
+ }
+
+ /**
+ * Performs basic validations on request message to ensure XKMS standard is applied correctly.
+ *
+ * The following validations are performed: 1) Check if a request ID is set 2) Check if service name equals this
+ * XKMS service instance
+ *
+ * @param request XKMS request
+ */
+ private void validateRequest(MessageAbstractType request) {
+ // Check if ID is set
+ if (request.getId() == null || request.getId().isEmpty()) {
+ throw new IllegalArgumentException("Message Id is not set");
+ }
+ // Check if Service matches this instance
+ if (!getServiceName().equals(request.getService())) {
+ throw new IllegalArgumentException("Service " + request.getService()
+ + " is not responsible to process request");
+ }
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ // TODO refactoring into factory class?
+ public static KeyBindingType createKeyBinding(ValidateResultType result) {
+ KeyBindingType binding = new KeyBindingType();
+ binding.setId(UUID.randomUUID().toString());
+ result.getKeyBinding().add(binding);
+
+ StatusType status = new StatusType();
+ binding.setStatus(status);
+
+ return binding;
+ }
+
+ private void addValidationReasons(KeyBindingType binding, StatusType status) {
+ StatusType resultStatus = binding.getStatus();
+ resultStatus.getValidReason().addAll(status.getValidReason());
+ resultStatus.getInvalidReason().addAll(status.getInvalidReason());
+ resultStatus.getIndeterminateReason().addAll(status.getIndeterminateReason());
+ }
+
+ public void setLocators(List<Locator> locators) {
+ this.locators = locators;
+ }
+
+ public void setValidators(List<Validator> validators) {
+ this.validators = validators;
+ }
+
+ public void setKeyRegisterHandlers(List<KeyRegisterHandler> keyRegisterHandlers) {
+ this.keyRegisterHandlers = keyRegisterHandlers;
+ }
+
+ /**
+ * http://www.w3.org/TR/xkms2/#XKMS_2_0_Section_4_1 [206]
+ *
+ * If no (or indeterminate) reasons are present total status is INDETERMINATE.
+ * If no invalid and indeterminate reasons are present status is VALID.
+ * If invalid reasons are present status is INVALID.
+ *
+ * @param binding KeyBinding to check validation reasons for
+ */
+ private void resolveValidationStatus(KeyBindingType binding) {
+ StatusType status = binding.getStatus();
+ status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INDETERMINATE);
+ if (!status.getValidReason().isEmpty() && status.getIndeterminateReason().isEmpty()) {
+ status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID);
+ }
+ if (!status.getInvalidReason().isEmpty()) {
+ status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_INVALID);
+ // Only return invalid reasons
+ status.getValidReason().clear();
+ }
+ }
+
+ /**
+ * Sets encryption, signature and exchang as key usage for provided keyBinding.
+ *
+ * @param keyBinding KeyBinding to set KeyUsage within
+ */
+ protected void setKeyUssageAll(KeyBindingAbstractType keyBinding) {
+ keyBinding.getKeyUsage().add(KeyUsageEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_ENCRYPTION);
+ keyBinding.getKeyUsage().add(KeyUsageEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_SIGNATURE);
+ keyBinding.getKeyUsage().add(KeyUsageEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_EXCHANGE);
+ }
+
+ public List<Validator> getValidators() {
+ return validators;
+ }
+
+ public List<Locator> getLocators() {
+ return locators;
+ }
+
+}
Added: cxf/trunk/services/xkms/xkms-war/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/pom.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/pom.xml (added)
+++ cxf/trunk/services/xkms/xkms-war/pom.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,113 @@
+<!--
+ Licensed to the Apache Soft 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,
+ softwwareare 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>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-war</artifactId>
+ <packaging>war</packaging>
+ <name>Apache CXF XKMS Service war deployment</name>
+ <url>http://cxf.apache.org</url>
+
+ <parent>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-parent</artifactId>
+ <version>2.8.0-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-x509-handlers</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>cxf25</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-mex</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>Tomcat6</id>
+ <properties>
+ <tomcat.url>http://localhost:8080/manager</tomcat.url>
+ </properties>
+ </profile>
+ <profile>
+ <id>Tomcat7</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <tomcat.url>http://localhost:8080/manager/text</tomcat.url>
+ </properties>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <server>myTomcat</server>
+ <url>${tomcat.url}</url>
+ <path>/${project.build.finalName}</path>
+ </configuration>
+ </plugin>
+ </plugins>
+ <!-- Name of the generated WAR file -->
+ <finalName>xkms</finalName>
+ </build>
+
+</project>
Added: cxf/trunk/services/xkms/xkms-war/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/src/main/resources/log4j.properties?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/src/main/resources/log4j.properties (added)
+++ cxf/trunk/services/xkms/xkms-war/src/main/resources/log4j.properties Sat May 18 16:04:37 2013
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=FATAL, CONSOLE
+#log4j.rootCategory=DEBUG, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=target/wss4j.log
+log4j.appender.LOGFILE.Append=false
+log4j.appender.LOGFILE.Threshold=DEBUG
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Added: cxf/trunk/services/xkms/xkms-war/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/src/main/resources/logging.properties?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/src/main/resources/logging.properties (added)
+++ cxf/trunk/services/xkms/xkms-war/src/main/resources/logging.properties Sat May 18 16:04:37 2013
@@ -0,0 +1,71 @@
+#
+# 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.
+#
+
+############################################################
+# 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 = INFO
+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
Added: cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/cxf-servlet.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/cxf-servlet.xml (added)
+++ cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/cxf-servlet.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,46 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans
+ xmlns="http://www.springframework.org/schema/beans"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:test="http://apache.org/hello_world_soap_http"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://cxf.apache.org/core
+ http://cxf.apache.org/schemas/core.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-2.0.xsd">
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="xkms-endpoint.xml"/>
+ <import resource="xkms-key-handlers.xml"/>
+
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+
+</beans>
+
Added: cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/web.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/web.xml (added)
+++ cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/web.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,41 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>CXF STS</display-name>
+ <servlet>
+ <servlet-name>xkms</servlet-name>
+ <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+ <!-- <load-on-startup>1</load-on-startup> -->
+ <init-param>
+ <param-name>config-location</param-name>
+ <param-value>WEB-INF/cxf-servlet.xml</param-value>
+ </init-param>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>xkms</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>60</session-timeout>
+ </session-config>
+
+</web-app>
Added: cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-endpoint.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-endpoint.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-endpoint.xml (added)
+++ cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-endpoint.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2008, 2009 SOPERA GmbH. All rights reserved. This program
+ and the accompanying materials are made available under the terms of the
+ Eclipse Public License v1.0 which accompanies this distribution, and is available
+ at http://www.eclipse.org/legal/epl-v10.html Contributors: SOPERA GmbH -
+ initial API and implementation -->
+<beans
+ xmlns="http://www.springframework.org/schema/beans"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:test="http://apache.org/hello_world_soap_http"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://cxf.apache.org/core
+ http://cxf.apache.org/schemas/core.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-2.0.xsd">
+
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+
+ <bean id="xkmsProviderBean" class="org.apache.cxf.xkms.service.XKMSService">
+ <property name="validators">
+ <list>
+ <ref bean="dateValidator" />
+ </list>
+ </property>
+ <property name="locators">
+ <list>
+ <!-- ref bean="x509LdapLocator" /-->
+ <ref bean="x509FileLocator" />
+ </list>
+ </property>
+ <property name="keyRegisterHandlers">
+ <list>
+ <!-- ref bean="ldapRegisterHandler" /-->
+ <ref bean="fileRegisterHandler" />
+ </list>
+ </property>
+ </bean>
+
+ <jaxws:endpoint id="XKMSService" xmlns:serviceNamespace="http://www.w3.org/2002/03/xkms#wsdl"
+ serviceName="serviceNamespace:XKMSService" endpointName="serviceNamespace:XKMSPort"
+ implementor="#xkmsProviderBean" address="/XKMS">
+ <jaxws:properties>
+ <entry key="jaxb.additionalContextClasses">
+ <bean class="org.apache.cxf.xkms.model.extensions.ClassArrayFactoryBean">
+ <property name="classNames">
+ <list>
+ <value>org.apache.cxf.xkms.model.extensions.ResultDetails</value>
+ </list>
+ </property>
+ </bean>
+ </entry>
+ </jaxws:properties>
+ </jaxws:endpoint>
+
+</beans>
Added: cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-key-handlers.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-key-handlers.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-key-handlers.xml (added)
+++ cxf/trunk/services/xkms/xkms-war/src/main/webapp/WEB-INF/xkms-key-handlers.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2008, 2009 SOPERA GmbH. All rights reserved. This program
+ and the accompanying materials are made available under the terms of the
+ Eclipse Public License v1.0 which accompanies this distribution, and is available
+ at http://www.eclipse.org/legal/epl-v10.html Contributors: SOPERA GmbH -
+ initial API and implementation -->
+<beans
+ xmlns="http://www.springframework.org/schema/beans"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:test="http://apache.org/hello_world_soap_http"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://cxf.apache.org/core
+ http://cxf.apache.org/schemas/core.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-2.0.xsd">
+
+ <bean id="dateValidator" class="org.apache.cxf.xkms.x509.validator.DateValidator" />
+
+<!--
+ <bean id="x509LdapLocator" class="org.apache.cxf.xkms.x509.locator.LdapLocator">
+ <constructor-arg ref="ldapSearch" />
+ <constructor-arg value="${xkms.backend.ldap.rootDN}" />
+ </bean>
+
+ <bean id="ldapRegisterHandler" class="org.apache.cxf.xkms.x509.handlers.LdapRegisterHandler">
+ <constructor-arg ref="ldapSearch" />
+ <constructor-arg value="${xkms.backend.ldap.rootDN}" />
+ </bean>
+
+ <bean id="ldapSearch" class="org.apache.cxf.xkms.x509.handlers.LDAPSearch">
+ <constructor-arg value="${xkms.backend.ldap.url}" />
+ <constructor-arg value="${xkms.backend.ldap.user}" />
+ <constructor-arg value="${xkms.backend.ldap.pwd}" />
+ <constructor-arg value="${xkms.backend.ldap.retry}" />
+ </bean>
+-->
+
+ <bean id="x509FileLocator" class="org.apache.cxf.xkms.x509.locator.FileLocator">
+ <constructor-arg value="../conf/certs" />
+ </bean>
+
+ <bean id="fileRegisterHandler" class="org.apache.cxf.xkms.x509.handlers.FileRegisterHandler">
+ <constructor-arg value="../conf/certs" />
+ </bean>
+
+</beans>
Added: cxf/trunk/services/xkms/xkms-x509-handlers/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-x509-handlers/pom.xml?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-x509-handlers/pom.xml (added)
+++ cxf/trunk/services/xkms/xkms-x509-handlers/pom.xml Sat May 18 16:04:37 2013
@@ -0,0 +1,89 @@
+<?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>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-x509-handlers</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache CXF XKMS X509 Handlers</name>
+ <url>http://cxf.apache.org</url>
+
+ <parent>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-parent</artifactId>
+ <version>2.8.0-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.services.xkms</groupId>
+ <artifactId>cxf-services-xkms-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-packaging-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>timestamp</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>build-qualifier</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/AbstractX509RegisterHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/AbstractX509RegisterHandler.java?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/AbstractX509RegisterHandler.java (added)
+++ cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/AbstractX509RegisterHandler.java Sat May 18 16:04:37 2013
@@ -0,0 +1,140 @@
+/**
+ * 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.xkms.x509.handlers;
+
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.cxf.xkms.handlers.KeyRegisterHandler;
+import org.apache.cxf.xkms.model.xkms.KeyBindingEnum;
+import org.apache.cxf.xkms.model.xkms.KeyBindingType;
+import org.apache.cxf.xkms.model.xkms.PrototypeKeyBindingType;
+import org.apache.cxf.xkms.model.xkms.RegisterRequestType;
+import org.apache.cxf.xkms.model.xkms.RegisterResultType;
+import org.apache.cxf.xkms.model.xkms.ReissueRequestType;
+import org.apache.cxf.xkms.model.xkms.ReissueResultType;
+import org.apache.cxf.xkms.model.xkms.RequestAbstractType;
+import org.apache.cxf.xkms.model.xkms.RespondWithEnum;
+import org.apache.cxf.xkms.model.xkms.RevokeRequestType;
+import org.apache.cxf.xkms.model.xkms.RevokeResultType;
+import org.apache.cxf.xkms.model.xkms.StatusType;
+import org.apache.cxf.xkms.model.xkms.UseKeyWithType;
+import org.apache.cxf.xkms.model.xmldsig.KeyInfoType;
+import org.apache.cxf.xkms.model.xmldsig.X509DataType;
+import org.apache.cxf.xkms.x509.utils.X509Utils;
+
+public abstract class AbstractX509RegisterHandler implements KeyRegisterHandler {
+
+ protected final CertificateFactory certFactory;
+
+ public AbstractX509RegisterHandler() throws CertificateException {
+ certFactory = CertificateFactory.getInstance("X.509");
+ }
+
+ @Override
+ public boolean canProcess(RequestAbstractType request) {
+ List<String> respondWithList = request.getRespondWith();
+ if ((respondWithList != null) && !(respondWithList.isEmpty())) {
+ return respondWithList.contains(RespondWithEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_X_509_CERT);
+ } else {
+ // Default handler
+ return true;
+ }
+ }
+
+ @Override
+ public RegisterResultType register(RegisterRequestType request, RegisterResultType response) {
+ try {
+ PrototypeKeyBindingType binding = request.getPrototypeKeyBinding();
+ X509Utils.assertElementNotNull(binding, PrototypeKeyBindingType.class);
+ KeyInfoType keyInfo = binding.getKeyInfo();
+ X509Utils.assertElementNotNull(binding, KeyInfoType.class);
+ List<UseKeyWithType> useKeyWithList = binding.getUseKeyWith();
+ if (useKeyWithList == null || useKeyWithList.size() != 1) {
+ throw new IllegalArgumentException("Exactly one useKeyWith element needed");
+ //TODO standard requires support for multiple useKeyWith attributes
+ }
+ UseKeyWithType useKeyWith = useKeyWithList.get(0);
+ List<X509Certificate> certList = getCertsFromKeyInfo(keyInfo);
+ if (certList.size() != 1) {
+ throw new IllegalArgumentException("Must provide one X509Certificate");
+ }
+ X509Certificate cert = certList.get(0);
+ saveCertificate(cert, useKeyWith);
+
+ KeyBindingType responseBinding = prepareResponseBinding(binding);
+ response.getKeyBinding().add(responseBinding);
+ return response;
+ } catch (CertificateException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public abstract void saveCertificate(X509Certificate cert, UseKeyWithType key);
+
+ private KeyBindingType prepareResponseBinding(PrototypeKeyBindingType binding) {
+ KeyBindingType responseBinding = new KeyBindingType();
+ responseBinding.setKeyInfo(binding.getKeyInfo());
+ StatusType status = new StatusType();
+ status.setStatusValue(KeyBindingEnum.HTTP_WWW_W_3_ORG_2002_03_XKMS_VALID);
+ responseBinding.setStatus(status);
+ return responseBinding;
+ }
+
+ @Override
+ public ReissueResultType reissue(ReissueRequestType request, ReissueResultType response) {
+ throw new UnsupportedOperationException("This service does not support reissue");
+ }
+
+ @Override
+ public RevokeResultType revoke(RevokeRequestType request, RevokeResultType response) {
+ throw new UnsupportedOperationException("This service does not support revoke");
+ }
+
+ private List<X509Certificate> getCertsFromKeyInfo(KeyInfoType keyInfo) throws CertificateException {
+ List<X509Certificate> certList = new ArrayList<X509Certificate>();
+ for (Object key : keyInfo.getContent()) {
+ if (key instanceof JAXBElement) {
+ Object value = ((JAXBElement<?>) key).getValue();
+ if (value instanceof X509DataType) {
+ X509DataType x509Data = (X509DataType) value;
+ List<Object> data = x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName();
+ for (Object certO : data) {
+ JAXBElement<?> certO2 = (JAXBElement<?>) certO;
+ if (certO2.getDeclaredType() == byte[].class) {
+ byte[] certContent = (byte[]) certO2.getValue();
+ X509Certificate cert = (X509Certificate) certFactory
+ .generateCertificate(new ByteArrayInputStream(certContent));
+ certList.add(cert);
+ }
+ }
+ }
+ }
+
+ }
+ return certList;
+ }
+
+}
Added: cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/FileRegisterHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/FileRegisterHandler.java?rev=1484133&view=auto
==============================================================================
--- cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/FileRegisterHandler.java (added)
+++ cxf/trunk/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/FileRegisterHandler.java Sat May 18 16:04:37 2013
@@ -0,0 +1,79 @@
+/**
+ * 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.xkms.x509.handlers;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.math.BigInteger;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import org.apache.cxf.xkms.model.xkms.UseKeyWithType;
+
+public class FileRegisterHandler extends AbstractX509RegisterHandler {
+
+ private final File storageDir;
+
+ public FileRegisterHandler(File storageDir) throws CertificateException {
+ super();
+ if (storageDir == null) {
+ throw new IllegalStateException("File Persistence: root certificate directory is not initialized");
+ }
+ this.storageDir = storageDir;
+ }
+
+ @Override
+ public void saveCertificate(X509Certificate cert, UseKeyWithType id) {
+ String name = cert.getSubjectX500Principal().getName();
+ try {
+ File certFile = new File(storageDir, getRelativePathForSubjectDn(id.getIdentifier(), cert));
+ certFile.getParentFile().mkdirs();
+ FileOutputStream fos = new FileOutputStream(certFile);
+ BufferedOutputStream bos = new BufferedOutputStream(fos);
+ bos.write(cert.getEncoded());
+ bos.close();
+ fos.close();
+ } catch (Exception e) {
+ throw new RuntimeException("Error saving certificate " + name + ": " + e.getMessage(), e);
+ }
+ }
+
+ public String getRelativePathForSubjectDn(String subjectDn, X509Certificate cert) {
+ BigInteger serialNumber = cert.getSerialNumber();
+ String issuer = cert.getIssuerX500Principal().getName();
+ String path = convertDnForFileSystem(subjectDn)
+ + "-" + serialNumber.toString() + "-" + convertDnForFileSystem(issuer) + ".cer";
+ // TODO Filter for only valid and safe characters
+ return path;
+ }
+
+ public String convertDnForFileSystem(String dn) {
+ String result = dn.replace("=", "-");
+ result = result.replace(", ", "_");
+ result = result.replace(",", "_");
+ result = result.replace("/", "_");
+ result = result.replace("\\", "_");
+ result = result.replace("{", "_");
+ result = result.replace("}", "_");
+ result = result.replace(":", "_");
+ return result;
+ }
+
+}