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 2016/09/26 11:47:45 UTC

[3/5] cxf git commit: Adding a test for multiple algorithm suites

Adding a test for multiple algorithm suites

# Conflicts:
#	systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d8797447
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d8797447
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d8797447

Branch: refs/heads/3.0.x-fixes
Commit: d8797447eb7fceeedd45709134b352fd6b37457a
Parents: a5a36d6
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Sep 26 12:35:38 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Sep 26 12:42:47 2016 +0100

----------------------------------------------------------------------
 .../systest/ws/algsuite/AlgorithmSuiteTest.java | 34 ++++++++++++
 .../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, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d8797447/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 134dcf1..a358527 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,38 @@ public class AlgorithmSuiteTest extends AbstractBusClientServerTestBase {
         bus.shutdown(true);
     }
     
+<<<<<<< HEAD
 }
+=======
+    @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);
+    }
+}
+>>>>>>> 434cdaf... Adding a test for multiple algorithm suites

http://git-wip-us.apache.org/repos/asf/cxf/blob/d8797447/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/d8797447/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 a5f4036..45fcbe5 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/d8797447/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 6edd0eb..2bf11e3 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>