Repository: cxf Updated Branches: refs/heads/master 0f74af5ed -> 05858853a
Adding a test for multiple algorithm suites Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/05858853 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/05858853 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/05858853 Branch: refs/heads/master Commit: 05858853abad9966e1110b026e21b6bde9f7a492 Parents: a910ac0 Author: Colm O hEigeartaigh <[email protected]> Authored: Mon Sep 26 12:35:38 2016 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Mon Sep 26 12:35:52 2016 +0100 ---------------------------------------------------------------------- .../systest/ws/algsuite/AlgorithmSuiteTest.java | 30 +++++++++++ .../systest/ws/algsuite/DoubleItAlgSuite.wsdl | 3 ++ .../apache/cxf/systest/ws/algsuite/client.xml | 13 +++++ .../apache/cxf/systest/ws/algsuite/server.xml | 54 ++++++++++++++++++++ 4 files changed, 100 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/05858853/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java index 1580c22..2eef9d9 100644 --- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java @@ -310,4 +310,34 @@ public class AlgorithmSuiteTest extends AbstractBusClientServerTestBase { bus.shutdown(true); } + @org.junit.Test + public void testMultipleAlgorithmSuitesPolicy() throws Exception { + + if (!SecurityTestUtil.checkUnrestrictedPoliciesInstalled()) { + return; + } + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = AlgorithmSuiteTest.class.getResource("client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = AlgorithmSuiteTest.class.getResource("DoubleItAlgSuite.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + + QName portQName = new QName(NAMESPACE, "DoubleItMultipleAlgSuitesPort"); + DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(port, PORT); + + // DOM + port.doubleIt(25); + + // Streaming + SecurityTestUtil.enableStreaming(port); + port.doubleIt(25); + + bus.shutdown(true); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/05858853/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/DoubleItAlgSuite.wsdl ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/DoubleItAlgSuite.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/DoubleItAlgSuite.wsdl index b5f3bee..67e6ee7 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/DoubleItAlgSuite.wsdl +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/DoubleItAlgSuite.wsdl @@ -68,5 +68,8 @@ <wsdl:port name="DoubleItSignaturePort2" binding="tns:DoubleItInlinePolicyBinding"> <soap:address location="http://localhost:9010/DoubleItSignatureno2"/> </wsdl:port> + <wsdl:port name="DoubleItMultipleAlgSuitesPort" binding="tns:DoubleItInlinePolicyBinding"> + <soap:address location="http://localhost:9010/DoubleItMultipleAlgSuites"/> + </wsdl:port> </wsdl:service> </wsdl:definitions> http://git-wip-us.apache.org/repos/asf/cxf/blob/05858853/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/client.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/client.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/client.xml index e1324f9..3999018 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/client.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/client.xml @@ -183,6 +183,19 @@ </bean> </jaxws:outInterceptors> </jaxws:client> + <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItMultipleAlgSuitesPort" createdFromAPI="true"> + <jaxws:properties> + <entry key="security.username" value="Alice"/> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> + <entry key="security.encryption.properties" value="bob.properties"/> + <entry key="security.encryption.username" value="bob"/> + </jaxws:properties> + <jaxws:features> + <p:policies> + <wsp:PolicyReference xmlns:wsp="http://www.w3.org/ns/ws-policy" URI="#DoubleItSymmetric128Policy"/> + </p:policies> + </jaxws:features> + </jaxws:client> <wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="DoubleItSymmetric128Policy"> <wsp:ExactlyOne> <wsp:All> http://git-wip-us.apache.org/repos/asf/cxf/blob/05858853/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/server.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/server.xml index 4fd8f28..72dff2a 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/server.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/algsuite/server.xml @@ -172,6 +172,19 @@ </bean> </jaxws:inInterceptors> </jaxws:endpoint> + <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="DoubleItMultipleAlgSuites" address="http://localhost:${testutil.ports.algsuite.Server}/DoubleItMultipleAlgSuites" serviceName="s:DoubleItService" endpointName="s:DoubleItMultipleAlgSuitesPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/algsuite/DoubleItAlgSuite.wsdl"> + <jaxws:properties> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> + <entry key="security.signature.properties" value="bob.properties"/> + <entry key="security.subject.cert.constraints" value=".*O=apache.org.*"/> + <entry key="ws-security.is-bsp-compliant" value="false"/> + </jaxws:properties> + <jaxws:features> + <p:policies> + <wsp:PolicyReference xmlns:wsp="http://www.w3.org/ns/ws-policy" URI="#DoubleItSymmetric128MultipleAlgSuitesPolicy"/> + </p:policies> + </jaxws:features> + </jaxws:endpoint> <wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="DoubleItSymmetric128Policy"> <wsp:ExactlyOne> <wsp:All> @@ -321,4 +334,45 @@ </wsp:All> </wsp:ExactlyOne> </wsp:Policy> + <wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="DoubleItSymmetric128MultipleAlgSuitesPolicy"> + <wsp:ExactlyOne> + <wsp:All> + <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> + <wsp:ExactlyOne> + <sp:Basic128/> + <sp:TripleDes/> + </wsp:ExactlyOne> + </wsp:Policy> + </sp:AlgorithmSuite> + </wsp:Policy> + </sp:SymmetricBinding> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + </wsp:All> + </wsp:ExactlyOne> + </wsp:Policy> </beans>
