cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1462031 - in /cxf/branches/wss4j2.0-port/systests/ws-security/src/test: java/org/apache/cxf/systest/ws/action/ resources/org/apache/cxf/systest/ws/action/ resources/org/apache/cxf/systest/ws/action/client/ resources/org/apache/cxf/systest/...
Date Thu, 28 Mar 2013 11:03:25 GMT
Author: coheigea
Date: Thu Mar 28 11:03:25 2013
New Revision: 1462031

URL: http://svn.apache.org/r1462031
Log:
Adding some sanity tests for not sending any security header to a service with a UsernameToken
requirement

Modified:
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/clean-policy.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/created-policy.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/hash-pass-policy.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/no-pass-policy.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/nonce-policy.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/plaintext-pass-policy.xml
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/supp-token-policy.xml

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
Thu Mar 28 11:03:25 2013
@@ -79,4 +79,42 @@ public class ActionTest extends Abstract
         bus.shutdown(true);
     }
     
+    @org.junit.Test
+    public void testUsernameToken() 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, "DoubleItUsernameTokenPort");
+        DoubleItPortType port = 
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, PORT);
+        
+        // Successful call
+        port.doubleIt(25);
+        
+        // This should fail, as the client is not sending a UsernameToken
+        portQName = new QName(NAMESPACE, "DoubleItUsernameTokenPort2");
+        port = service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, PORT);
+        
+        try {
+            port.doubleIt(25);
+            fail("Failure expected on not sending a UsernameToken element");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            String error = "An error was discovered";
+            assertTrue(ex.getMessage().contains(error));
+        }
+        
+        
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
+    
 }

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/DoubleItAction.wsdl
Thu Mar 28 11:03:25 2013
@@ -51,6 +51,12 @@
         <wsdl:port name="DoubleIt3DESEncryptionPort" binding="tns:DoubleItNoSecurityBinding">
             <soap:address location="http://localhost:9001/DoubleIt3DESEncryption" />
         </wsdl:port>
+        <wsdl:port name="DoubleItUsernameTokenPort" binding="tns:DoubleItNoSecurityBinding">
+            <soap:address location="http://localhost:9001/DoubleItUsernameToken" />
+        </wsdl:port>
+        <wsdl:port name="DoubleItUsernameTokenPort2" binding="tns:DoubleItNoSecurityBinding">
+            <soap:address location="http://localhost:9001/DoubleItUsernameToken2" />
+        </wsdl:port>
     </wsdl:service>
 
 </wsdl:definitions>

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/client/client.xml
Thu Mar 28 11:03:25 2013
@@ -66,4 +66,19 @@
        </jaxws:inInterceptors>
     </jaxws:client>
     
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItUsernameTokenPort"

+                  createdFromAPI="true">
+       <jaxws:outInterceptors>
+           <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+               <constructor-arg>
+                   <map>
+                        <entry key="action" value="UsernameToken"/> 
+                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback"/>
+                        <entry key="user" value="Alice"/>
+                   </map>
+               </constructor-arg>
+           </bean>
+       </jaxws:outInterceptors>
+    </jaxws:client>
+    
 </beans>

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server/server.xml
Thu Mar 28 11:03:25 2013
@@ -79,5 +79,47 @@
      
     </jaxws:endpoint> 
     
+    <jaxws:endpoint 
+       id="UsernameToken"
+       address="http://localhost:${testutil.ports.Server}/DoubleItUsernameToken" 
+       serviceName="s:DoubleItService"
+       endpointName="s:DoubleItUsernameTokenPort"
+       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="UsernameToken"/> 
+                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback"/>
+                   </map>
+               </constructor-arg>
+           </bean>
+       </jaxws:inInterceptors>
+     
+    </jaxws:endpoint> 
+    
+    <jaxws:endpoint 
+       id="UsernameToken2"
+       address="http://localhost:${testutil.ports.Server}/DoubleItUsernameToken2" 
+       serviceName="s:DoubleItService"
+       endpointName="s:DoubleItUsernameTokenPort2"
+       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="UsernameToken"/> 
+                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback"/>
+                   </map>
+               </constructor-arg>
+           </bean>
+       </jaxws:inInterceptors>
+     
+    </jaxws:endpoint> 
+    
     
 </beans>

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/clean-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/clean-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/clean-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/clean-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/created-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/created-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/created-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/created-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/hash-pass-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/hash-pass-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/hash-pass-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/hash-pass-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/no-pass-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/no-pass-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/no-pass-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/no-pass-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/nonce-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/nonce-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/nonce-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/nonce-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/plaintext-pass-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/plaintext-pass-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/plaintext-pass-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/plaintext-pass-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/supp-token-policy.xml
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/supp-token-policy.xml?rev=1462031&r1=1462030&r2=1462031&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/supp-token-policy.xml
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/supp-token-policy.xml
Thu Mar 28 11:03:25 2013
@@ -18,7 +18,6 @@
                                 <sp:Lax />
                             </wsp:Policy>
                         </sp:Layout>
-                        <sp:IncludeTimestamp />
                         <sp:AlgorithmSuite>
                             <wsp:Policy>
                                 <sp:Basic128 />



Mime
View raw message