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 2017/11/10 11:18:39 UTC

[cxf] branch master updated: Adding SAML "action" system test

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 5504cad  Adding SAML "action" system test
5504cad is described below

commit 5504cad08be5f2eb8396410618da68cb732b80e0
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Nov 10 11:18:19 2017 +0000

    Adding SAML "action" system test
---
 .../apache/cxf/systest/ws/action/ActionTest.java   | 22 ++++++++++++++++++++++
 .../cxf/systest/ws/action/DoubleItAction.wsdl      |  3 +++
 .../org/apache/cxf/systest/ws/action/client.xml    | 22 ++++++++++++++++++++++
 .../org/apache/cxf/systest/ws/action/server.xml    | 12 ++++++++++++
 4 files changed, 59 insertions(+)

diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
index 8855519..7f5af6c 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
@@ -404,4 +404,26 @@ public class ActionTest extends AbstractBusClientServerTestBase {
         ((java.io.Closeable)port).close();
         bus.shutdown(true);
     }
+
+    @org.junit.Test
+    public void testSignedSAML() throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = ActionTest.class.getResource("client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        BusFactory.setDefaultBus(bus);
+        BusFactory.setThreadDefaultBus(bus);
+
+        URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSignedSAMLPort");
+        DoubleItPortType port =
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, PORT);
+        port.doubleIt(25);
+
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
 }
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
index eca0182..ea3409e 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
@@ -78,6 +78,9 @@
         <wsdl:port name="DoubleItSignatureNegativeServerPort2" binding="tns:DoubleItNoSecurityBinding">
             <soap:address location="http://localhost:9001/DoubleItSignatureNegativeServer2"/>
         </wsdl:port>
+        <wsdl:port name="DoubleItSignedSAMLPort" binding="tns:DoubleItNoSecurityBinding">
+            <soap:address location="http://localhost:9001/DoubleItSignedSAML"/>
+        </wsdl:port>
     </wsdl:service>
     
 </wsdl:definitions>
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client.xml
index aef6e72..cc02e28 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client.xml
@@ -335,4 +335,26 @@
         </jaxws:inInterceptors>
     </jaxws:client>
     
+    <bean id="samlCallbackHandler" class="org.apache.cxf.systest.ws.saml.client.SamlCallbackHandler">
+        <constructor-arg value="true" />
+        <constructor-arg value="true" />
+        <property name="confirmationMethod" value="urn:oasis:names:tc:SAML:2.0:cm:holder-of-key" />
+    </bean>
+    
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSignedSAMLPort" createdFromAPI="true">
+        <jaxws:outInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="SAMLTokenSigned"/>
+                        <entry key="user" value="alice"/>
+                        <entry key="signaturePropFile" value="alice.properties"/>
+                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+                        <entry key="samlCallbackRef" value-ref="samlCallbackHandler"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:outInterceptors>
+    </jaxws:client>
+    
 </beans>
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
index f1437a4..d2447d8 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
@@ -272,5 +272,17 @@
             </bean>
         </jaxws:inInterceptors>
     </jaxws:endpoint>
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="SignedSAML" address="http://localhost:${testutil.ports.action.Server}/DoubleItSignedSAML" serviceName="s:DoubleItService" endpointName="s:DoubleItSignedSAMLPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="SAMLTokenSigned Signature"/>
+                        <entry key="signatureVerificationPropFile" value="bob.properties"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:inInterceptors>
+    </jaxws:endpoint>
     
 </beans>

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].