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 2014/01/08 12:35:11 UTC

svn commit: r1556502 - in /cxf/branches/2.7.x-fixes/systests/ws-security/src/test: java/org/apache/cxf/systest/ws/action/ resources/ resources/org/apache/cxf/systest/ws/action/ resources/org/apache/cxf/systest/ws/action/client/ resources/org/apache/cxf...

Author: coheigea
Date: Wed Jan  8 11:35:10 2014
New Revision: 1556502

URL: http://svn.apache.org/r1556502
Log:
Merging a test-case for SAML Property references

Added:
    cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/saml_sv.properties
Modified:
    cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
    cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
    cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml
    cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml

Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java?rev=1556502&r1=1556501&r2=1556502&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java Wed Jan  8 11:35:10 2014
@@ -191,5 +191,29 @@ public class ActionTest extends Abstract
         ((java.io.Closeable)port).close();
         bus.shutdown(true);
     }
+    
+    @org.junit.Test
+    public void testSAMLToken() throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = ActionTest.class.getResource("client/client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSamlTokenPort");
+        DoubleItPortType port = 
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, PORT);
+        
+        // Successful call
+        port.doubleIt(25);
+        
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
 
 }

Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl?rev=1556502&r1=1556501&r2=1556502&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl Wed Jan  8 11:35:10 2014
@@ -63,6 +63,9 @@
         <wsdl:port name="DoubleItSignedTimestampPort" binding="tns:DoubleItNoSecurityBinding">
             <soap:address location="http://localhost:9001/DoubleItSignedTimestamp" />
         </wsdl:port>
+        <wsdl:port name="DoubleItSamlTokenPort" binding="tns:DoubleItNoSecurityBinding">
+            <soap:address location="http://localhost:9001/DoubleItSamlToken" />
+        </wsdl:port>
     </wsdl:service>
 
 </wsdl:definitions>

Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml?rev=1556502&r1=1556501&r2=1556502&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml Wed Jan  8 11:35:10 2014
@@ -20,12 +20,14 @@
 <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"
        xmlns:sec="http://cxf.apache.org/configuration/security"
        xsi:schemaLocation="
           http://www.springframework.org/schema/beans           http://www.springframework.org/schema/beans/spring-beans.xsd
+          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.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://cxf.apache.org/configuration/security          http://cxf.apache.org/schemas/configuration/security.xsd
@@ -139,4 +141,26 @@
        </jaxws:inInterceptors>
     </jaxws:client>
     
+    <bean id="samlCallbackHandler" class="org.apache.cxf.systest.ws.saml.client.SamlCallbackHandler">
+        <property name="confirmationMethod" value="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
+    </bean>
+    
+    <util:properties id="samlProperties" location="classpath:saml_sv.properties"/>
+    
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSamlTokenPort" 
+                  createdFromAPI="true">
+       <jaxws:outInterceptors>
+           <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+               <constructor-arg>
+                   <map>
+                        <entry key="action" value="SAMLTokenUnsigned"/> 
+                        <entry key="samlCallbackRef" value-ref="samlCallbackHandler"/>
+                        <entry key="samlPropRefId" value="samlPropertiesId" />
+                        <entry key="samlPropertiesId" value-ref="samlProperties" />
+                   </map>
+               </constructor-arg>
+           </bean>
+       </jaxws:outInterceptors>
+    </jaxws:client>
+    
 </beans>

Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml?rev=1556502&r1=1556501&r2=1556502&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml Wed Jan  8 11:35:10 2014
@@ -156,4 +156,24 @@
      
     </jaxws:endpoint> 
     
+    <jaxws:endpoint 
+       id="SamlToken"
+       address="http://localhost:${testutil.ports.Server}/DoubleItSamlToken" 
+       serviceName="s:DoubleItService"
+       endpointName="s:DoubleItSamlTokenPort"
+       xmlns:s="http://www.example.org/contract/DoubleIt"
+       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="SAMLTokenUnsigned"/> 
+                   </map>
+               </constructor-arg>
+           </bean>
+       </jaxws:inInterceptors>
+     
+    </jaxws:endpoint> 
+    
 </beans>

Added: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/saml_sv.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/saml_sv.properties?rev=1556502&view=auto
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/saml_sv.properties (added)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/saml_sv.properties Wed Jan  8 11:35:10 2014
@@ -0,0 +1,2 @@
+org.apache.ws.security.saml.issuerClass=org.apache.ws.security.saml.SAMLIssuerImpl
+org.apache.ws.security.saml.issuer=www.example.com