You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/07/16 17:27:28 UTC
svn commit: r1503762 - in /cxf/trunk/systests/ws-security/src/test:
java/org/apache/cxf/systest/ws/xkms/
resources/org/apache/cxf/systest/ws/xkms/
Author: coheigea
Date: Tue Jul 16 15:27:28 2013
New Revision: 1503762
URL: http://svn.apache.org/r1503762
Log:
Added an @Ignore'd Asymmetric test
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/xkms/XKMSTest.java
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/DoubleItXKMS.wsdl
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/client.xml
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/server.xml
Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/xkms/XKMSTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/xkms/XKMSTest.java?rev=1503762&r1=1503761&r2=1503762&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/xkms/XKMSTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/xkms/XKMSTest.java Tue Jul 16 15:27:28 2013
@@ -87,6 +87,37 @@ public class XKMSTest extends AbstractBu
port.doubleIt(25);
// Streaming
+ // SecurityTestUtil.enableStreaming(port);
+ // port.doubleIt(25);
+
+ ((java.io.Closeable)port).close();
+ bus.shutdown(true);
+ }
+
+ // TODO The client uses XKMS to locate the public key of the service with which to encrypt
+ // the message.
+ @org.junit.Test
+ @org.junit.Ignore
+ public void testAsymmetricBinding() throws Exception {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = XKMSTest.class.getResource("client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ URL wsdl = XKMSTest.class.getResource("DoubleItXKMS.wsdl");
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+ QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPort");
+ DoubleItPortType port =
+ service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(port, PORT);
+
+ // DOM
+ port.doubleIt(25);
+
+ // Streaming
// SecurityTestUtil.enableStreaming(x509Port);
// x509Port.doubleIt(25);
Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/DoubleItXKMS.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/DoubleItXKMS.wsdl?rev=1503762&r1=1503761&r2=1503762&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/DoubleItXKMS.wsdl (original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/DoubleItXKMS.wsdl Tue Jul 16 15:27:28 2013
@@ -49,11 +49,33 @@
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
+ <wsdl:binding name="DoubleItAsymmetricBinding" type="tns:DoubleItPortType">
+ <wsp:PolicyReference URI="#DoubleItAsymmetricPolicy" />
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="DoubleIt">
+ <soap:operation soapAction="" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ <wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Input_Policy"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ <wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Output_Policy"/>
+ </wsdl:output>
+ <wsdl:fault name="DoubleItFault">
+ <soap:body use="literal" name="DoubleItFault" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
<wsdl:service name="DoubleItService">
<wsdl:port name="DoubleItSymmetricPort" binding="tns:DoubleItSymmetricBinding">
<soap:address location="http://localhost:9001/DoubleItXKMSSymmetric" />
</wsdl:port>
+ <wsdl:port name="DoubleItAsymmetricPort" binding="tns:DoubleItAsymmetricBinding">
+ <soap:address location="http://localhost:9001/DoubleItXKMSAsymmetric" />
+ </wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="DoubleItSymmetricPolicy">
@@ -89,6 +111,49 @@
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
+ <wsp:Policy wsu:Id="DoubleItAsymmetricPolicy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding>
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10 />
+ <sp:RequireIssuerSerialReference />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic128/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
<wsp:Policy wsu:Id="DoubleItBinding_DoubleIt_Input_Policy">
<wsp:ExactlyOne>
Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/client.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/client.xml?rev=1503762&r1=1503761&r2=1503762&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/client.xml (original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/client.xml Tue Jul 16 15:27:28 2013
@@ -20,6 +20,7 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:util="http://www.springframework.org/schema/util"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:p="http://cxf.apache.org/policy"
@@ -28,6 +29,7 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd"
@@ -41,6 +43,7 @@
</cxf:features>
</cxf:bus>
+ <!-- Begin Symmetric -->
<jaxws:client id="xkmsClient" xmlns:serviceNamespace="http://www.w3.org/2002/03/xkms#wsdl"
serviceClass="org.w3._2002._03.xkms_wsdl.XKMSPortType"
serviceName="serviceNamespace:XKMSPortType" endpointName="serviceNamespace:XKMSService"
@@ -62,6 +65,38 @@
<entry key="ws-security.encryption.username" value="CN=bob, OU=eng, O=apache.org"/>
</jaxws:properties>
</jaxws:client>
+ <!-- End Symmetric -->
+
+ <!-- Begin Asymmetric -->
+ <bean id="crypto" class="org.apache.wss4j.common.crypto.CryptoFactory"
+ factory-method="getInstance">
+ <constructor-arg>
+ <util:properties id="cryptoProperties"
+ location="classpath:alice.properties"/>
+ </constructor-arg>
+ </bean>
+
+ <bean id="xkmsAsymmetricCrypto" class="org.apache.cxf.xkms.crypto.XkmsCryptoProvider">
+ <constructor-arg>
+ <ref bean="xkmsClient" />
+ </constructor-arg>
+ <constructor-arg>
+ <ref bean="crypto" />
+ </constructor-arg>
+ </bean>
+
+ <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItAsymmetricPort"
+ createdFromAPI="true">
+ <jaxws:properties>
+ <entry key="ws-security.encryption.crypto" value-ref="xkmsAsymmetricCrypto"/>
+ <entry key="ws-security.encryption.username" value="CN=bob, OU=eng, O=apache.org"/>
+ <entry key="ws-security.callback-handler"
+ value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.username" value="alice"/>
+ <entry key="ws-security.signature.crypto" value-ref="xkmsAsymmetricCrypto"/>
+ </jaxws:properties>
+ </jaxws:client>
+ <!-- End Asymmetric -->
<http:conduit name="https://localhost:.*">
<http:tlsClientParameters disableCNCheck="true">
Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/server.xml?rev=1503762&r1=1503761&r2=1503762&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/server.xml (original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/server.xml Tue Jul 16 15:27:28 2013
@@ -85,4 +85,22 @@
</jaxws:endpoint>
+ <jaxws:endpoint
+ id="Asymmetric"
+ address="http://localhost:${testutil.ports.Server}/DoubleItXKMSAsymmetric"
+ serviceName="s:DoubleItService"
+ endpointName="s:DoubleItAsymmetricPort"
+ xmlns:s="http://www.example.org/contract/DoubleIt"
+ implementor="org.apache.cxf.systest.ws.common.DoubleItImpl"
+ wsdlLocation="org/apache/cxf/systest/ws/xkms/DoubleItXKMS.wsdl">
+
+ <jaxws:properties>
+ <entry key="ws-security.callback-handler"
+ value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.properties" value="bob.properties"/>
+ <entry key="ws-security.encryption.username" value="useReqSigCert"/>
+ </jaxws:properties>
+
+ </jaxws:endpoint>
+
</beans>