Repository: cxf Updated Branches: refs/heads/master 73bf3ec4a -> b0a664f1a
Adding @Ignore'd security + addressing test Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b0a664f1 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b0a664f1 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b0a664f1 Branch: refs/heads/master Commit: b0a664f1ab71ea360444847de06405123e3add16 Parents: 73bf3ec Author: Colm O hEigeartaigh <[email protected]> Authored: Tue Jan 24 16:36:37 2017 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue Jan 24 16:36:55 2017 +0000 ---------------------------------------------------------------------- .../cxf/systest/ws/x509/X509TokenTest.java | 28 +++++ .../cxf/systest/ws/x509/DoubleItX509.wsdl | 54 ++++++++++ .../systest/ws/x509/DoubleItX509Addressing.wsdl | 103 +++++++++++++++++++ .../org/apache/cxf/systest/ws/x509/client.xml | 6 ++ .../org/apache/cxf/systest/ws/x509/server.xml | 6 ++ .../apache/cxf/systest/ws/x509/stax-server.xml | 7 ++ 6 files changed, 204 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a664f1/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java index 55b8298..a958d3b 100644 --- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java @@ -1570,4 +1570,32 @@ public class X509TokenTest extends AbstractBusClientServerTestBase { ((java.io.Closeable)x509Port).close(); bus.shutdown(true); } + + @org.junit.Test + @org.junit.Ignore + public void testSymmetricWithOptionalAddressing() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = X509TokenTest.class.getResource("client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = X509TokenTest.class.getResource("DoubleItX509Addressing.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + QName portQName = new QName(NAMESPACE, "DoubleItSymmetricAddressingPort"); + DoubleItPortType x509Port = + service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(x509Port, test.getPort()); + + if (test.isStreaming()) { + SecurityTestUtil.enableStreaming(x509Port); + } + + x509Port.doubleIt(25); + + ((java.io.Closeable)x509Port).close(); + bus.shutdown(true); + } } http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a664f1/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl index 7760e5d..feb8804 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl @@ -55,6 +55,24 @@ </wsdl:fault> </wsdl:operation> </wsdl:binding> + <wsdl:binding name="DoubleItSymmetricAddressingBinding" type="tns:DoubleItPortType"> + <wsp:PolicyReference URI="#DoubleItSymmetricAddressingPolicy"/> + <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:binding name="DoubleItKeyIdentifierDerivedBinding" type="tns:DoubleItPortType"> <wsp:PolicyReference URI="#DoubleItKeyIdentifierDerivedPolicy"/> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> @@ -648,6 +666,9 @@ <wsdl:port name="DoubleItKeyIdentifierPort" binding="tns:DoubleItKeyIdentifierBinding"> <soap:address location="http://localhost:9001/DoubleItX509KeyIdentifier"/> </wsdl:port> + <wsdl:port name="DoubleItSymmetricAddressingPort" binding="tns:DoubleItSymmetricAddressingBinding"> + <soap:address location="http://localhost:9001/DoubleItX509SymmetricAddressing"/> + </wsdl:port> <wsdl:port name="DoubleItKeyIdentifierDerivedPort" binding="tns:DoubleItKeyIdentifierDerivedBinding"> <soap:address location="http://localhost:9001/DoubleItX509KeyIdentifierDerived"/> </wsdl:port> @@ -804,6 +825,39 @@ </wsp:All> </wsp:ExactlyOne> </wsp:Policy> + <wsp:Policy wsu:Id="DoubleItSymmetricAddressingPolicy"> + <wsp:ExactlyOne> + <wsp:All> + <wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/> + <sp:SymmetricBinding> + <wsp:Policy> + <sp:ProtectionToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + <sp:RequireKeyIdentifierReference/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:ProtectionToken> + <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:SymmetricBinding> + </wsp:All> + </wsp:ExactlyOne> + </wsp:Policy> <wsp:Policy wsu:Id="DoubleItKeyIdentifierDerivedPolicy"> <wsp:ExactlyOne> <wsp:All> http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a664f1/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509Addressing.wsdl ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509Addressing.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509Addressing.wsdl new file mode 100644 index 0000000..ae3069a --- /dev/null +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509Addressing.wsdl @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/contract/DoubleIt" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsaws="http://www.w3.org/2005/08/addressing" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sp13="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200802" name="DoubleIt" targetNamespace="http://www.example.org/contract/DoubleIt"> + <wsdl:import location="src/test/resources/DoubleItLogical.wsdl" namespace="http://www.example.org/contract/DoubleIt"/> + <wsdl:binding name="DoubleItSymmetricAddressingBinding" type="tns:DoubleItPortType"> + <wsp:PolicyReference URI="#DoubleItSymmetricAddressingPolicy"/> + <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="DoubleItSymmetricAddressingPort" binding="tns:DoubleItSymmetricAddressingBinding"> + <soap:address location="http://localhost:9001/DoubleItX509SymmetricAddressing"/> + </wsdl:port> + </wsdl:service> + <wsp:Policy wsu:Id="DoubleItSymmetricAddressingPolicy"> + <wsp:ExactlyOne> + <wsp:All> + <wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/> + <sp:SymmetricBinding> + <wsp:Policy> + <sp:ProtectionToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + <sp:RequireKeyIdentifierReference/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:ProtectionToken> + <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:SymmetricBinding> + </wsp:All> + </wsp:ExactlyOne> + </wsp:Policy> + + <wsp:Policy wsu:Id="DoubleItBinding_DoubleIt_Input_Policy"> + <wsp:ExactlyOne> + <wsp:All> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + </wsp:All> + </wsp:ExactlyOne> + </wsp:Policy> + <wsp:Policy wsu:Id="DoubleItBinding_DoubleIt_Output_Policy"> + <wsp:ExactlyOne> + <wsp:All> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + </wsp:All> + </wsp:ExactlyOne> + </wsp:Policy> +</wsdl:definitions> http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a664f1/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client.xml index a0ee832..ae7d057 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client.xml @@ -41,6 +41,12 @@ <entry key="security.encryption.username" value="bob"/> </jaxws:properties> </jaxws:client> + <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSymmetricAddressingPort" createdFromAPI="true"> + <jaxws:properties> + <entry key="security.encryption.properties" value="bob.properties"/> + <entry key="security.encryption.username" value="bob"/> + </jaxws:properties> + </jaxws:client> <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItKeyIdentifierDerivedPort" createdFromAPI="true"> <jaxws:properties> <entry key="security.encryption.properties" value="bob.properties"/> http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a664f1/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server.xml index b33900e..7c4f2d9 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server.xml @@ -57,6 +57,12 @@ <entry key="security.signature.crypto" value-ref="crypto"/> </jaxws:properties> </jaxws:endpoint> + <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="SymmetricAddressing" address="http://localhost:${testutil.ports.x509.Server}/DoubleItX509SymmetricAddressing" serviceName="s:DoubleItService" endpointName="s:DoubleItSymmetricAddressingPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl"> + <jaxws:properties> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/> + <entry key="security.signature.crypto" value-ref="crypto"/> + </jaxws:properties> + </jaxws:endpoint> <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="KeyIdentifierDerived" address="http://localhost:${testutil.ports.x509.Server}/DoubleItX509KeyIdentifierDerived" serviceName="s:DoubleItService" endpointName="s:DoubleItKeyIdentifierDerivedPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl"> <jaxws:properties> <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/> http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a664f1/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/stax-server.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/stax-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/stax-server.xml index 9b226b3..870fd9c 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/stax-server.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/stax-server.xml @@ -59,6 +59,13 @@ <entry key="ws-security.enable.streaming" value="true"/> </jaxws:properties> </jaxws:endpoint> + <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="SymmetricAddressing" address="http://localhost:${testutil.ports.x509.StaxServer}/DoubleItX509SymmetricAddressing" serviceName="s:DoubleItService" endpointName="s:DoubleItSymmetricAddressingPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl"> + <jaxws:properties> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/> + <entry key="security.signature.crypto" value-ref="crypto"/> + <entry key="ws-security.enable.streaming" value="true"/> + </jaxws:properties> + </jaxws:endpoint> <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="KeyIdentifierDerived" address="http://localhost:${testutil.ports.x509.StaxServer}/DoubleItX509KeyIdentifierDerived" serviceName="s:DoubleItService" endpointName="s:DoubleItKeyIdentifierDerivedPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl"> <jaxws:properties> <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
