Author: coheigea
Date: Mon Mar 18 15:46:43 2013
New Revision: 1457826

URL: http://svn.apache.org/r1457826
Log:
Merged revisions 1457817 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1457817 | coheigea | 2013-03-18 15:37:24 +0000 (Mon, 18 Mar 2013) | 2 lines

  [CXF-4901] - OnlySignEntireHeadersAndBody property validation doesn't check 
if a SOAP Body child was signed

........

Added:
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/server/
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/server/Server.java
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/client/
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/client/client.xml
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/server/
    
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/server/server.xml
Modified:
    
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java

Modified: 
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java?rev=1457826&r1=1457825&r2=1457826&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
 Mon Mar 18 15:46:43 2013
@@ -118,11 +118,22 @@ public abstract class AbstractBindingPol
                 if (xpath != null) {
                     String[] nodes = StringUtils.split(xpath, "/");
                     // envelope/Body || envelope/Header/header || 
envelope/Header/wsse:Security/header
-                    if (nodes.length == 5 && nodes[3].contains("Security")) {
-                        continue;
-                    } else if (nodes.length < 3 || nodes.length > 4) {
+                    if (nodes.length < 3 || nodes.length > 5) {
                         return false;
                     }
+                    
+                    if (!(nodes[2].contains("Header") || 
nodes[2].contains("Body"))) {
+                        return false;
+                    }
+                    
+                    if (nodes.length == 5 && !nodes[3].contains("Security")) {
+                        return false;
+                    }
+                    
+                    if (nodes.length == 4 && nodes[2].contains("Body")) {
+                        return false;
+                    }
+                    
                 }
             }
         }

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.bindings;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.systest.ws.bindings.server.Server;
+import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.example.contract.doubleit.DoubleItPortType;
+
+import org.junit.BeforeClass;
+
+/**
+ * This is a test for various properties associated with a security binding
+ */
+public class BindingPropertiesTest extends AbstractBusClientServerTestBase {
+    static final String PORT = allocatePort(Server.class);
+    
+    private static final String NAMESPACE = 
"http://www.example.org/contract/DoubleIt";;
+    private static final QName SERVICE_QNAME = new QName(NAMESPACE, 
"DoubleItService");
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue(
+            "Server failed to launch",
+            // run the server in the same process
+            // set this to false to fork
+            launchServer(Server.class, true)
+        );
+    }
+    
+    @org.junit.AfterClass
+    public static void cleanup() throws Exception {
+        SecurityTestUtil.cleanup();
+        stopAllServers();
+    }
+    
+    // Child of Body is signed which conflicts with the 
OnlySignEntireHeadersAndBody property
+    @org.junit.Test
+    public void testOnlySignEntireHeadersAndBody() throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = 
BindingPropertiesTest.class.getResource("client/client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+
+        URL wsdl = 
BindingPropertiesTest.class.getResource("DoubleItBindings.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+       
+        // This should work, as OnlySignEntireHeadersAndBody is not specified
+        QName portQName = new QName(NAMESPACE, "DoubleItNotOnlySignPort");
+        DoubleItPortType port = service.getPort(portQName, 
DoubleItPortType.class);
+        updateAddressPort(port, PORT);
+        port.doubleIt(25);
+        
+        // This should fail, as OnlySignEntireHeadersAndBody is specified
+        portQName = new QName(NAMESPACE, "DoubleItOnlySignPort");
+        port = service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, PORT);
+        
+        try {
+            port.doubleIt(25);
+            fail("Failure expected on OnlySignEntireHeadersAndBody property");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            String error = "OnlySignEntireHeadersAndBody does not match the 
requirements";
+            assertTrue(ex.getMessage().contains(error));
+        }
+        
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
+    
+}

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/server/Server.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/server/Server.java?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/server/Server.java
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/server/Server.java
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.bindings.server;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class Server extends AbstractBusTestServerBase {
+
+    public Server() {
+
+    }
+
+    protected void run()  {
+        URL busFile = Server.class.getResource("server.xml");
+        Bus busLocal = new SpringBusFactory().createBus(busFile);
+        BusFactory.setDefaultBus(busLocal);
+        setBus(busLocal);
+
+        try {
+            new Server();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions name="DoubleIt"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:tns="http://www.example.org/contract/DoubleIt";
+    targetNamespace="http://www.example.org/contract/DoubleIt"; 
+    xmlns:wsp="http://www.w3.org/ns/ws-policy";
+    
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+    xmlns:wsaws="http://www.w3.org/2005/08/addressing"; 
+    xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";
+    xmlns:sp13="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200802";>
+    
+    <wsdl:import location="src/test/resources/DoubleItLogical.wsdl" 
+                 namespace="http://www.example.org/contract/DoubleIt"/>
+                 
+    <wsdl:binding name="DoubleItOnlySignBinding" type="tns:DoubleItPortType">
+        <soap:binding style="document"
+            transport="http://schemas.xmlsoap.org/soap/http"; />
+        <wsdl:operation name="DoubleIt">
+            <soap:operation soapAction="" />
+            <wsdl:input>
+                <soap:body use="literal" />
+                <wsp:PolicyReference URI="#SignBodyChildPolicy"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+            <wsdl:fault name="DoubleItFault">
+                <soap:body use="literal" name="DoubleItFault" />
+            </wsdl:fault>
+        </wsdl:operation>
+    </wsdl:binding>
+    
+    <wsdl:service name="DoubleItService">
+        <wsdl:port name="DoubleItOnlySignPort" 
binding="tns:DoubleItOnlySignBinding">
+            <soap:address location="http://localhost:9010/DoubleItOnlySign"; />
+        </wsdl:port>
+        <wsdl:port name="DoubleItNotOnlySignPort" 
binding="tns:DoubleItOnlySignBinding">
+            <soap:address location="http://localhost:9010/DoubleItNotOnlySign"; 
/>
+        </wsdl:port>
+    </wsdl:service>
+    
+    <wsp:Policy wsu:Id="SignBodyChildPolicy">
+      <wsp:ExactlyOne>
+         <wsp:All>
+            <sp:SignedElements>
+               <sp:XPath>//*[local-name()='DoubleIt']</sp:XPath>
+            </sp:SignedElements>
+         </wsp:All>
+      </wsp:ExactlyOne>
+   </wsp:Policy>
+
+</wsdl:definitions>

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/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/bindings/client/client.xml?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/client/client.xml
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/client/client.xml
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<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: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://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
+          http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+          http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+          http://www.w3.org/ns/ws-policy  
http://www.w3.org/2007/02/ws-policy.xsd";
+>
+    <cxf:bus>
+        <cxf:features>
+            <p:policies/>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+
+       <jaxws:client
+               
name="{http://www.example.org/contract/DoubleIt}DoubleItOnlySignPort";
+               createdFromAPI="true">
+               <jaxws:properties>
+                       <entry key="ws-security.username" value="Alice" />
+                       <entry key="ws-security.callback-handler"
+                               
value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+                       <entry key="ws-security.encryption.properties"
+                               
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties" />
+                       <entry key="ws-security.encryption.username" 
value="bob" />
+                       <entry key="ws-security.signature.properties"
+                               
value="org/apache/cxf/systest/ws/wssec10/client/alice.properties" />
+                       <entry key="ws-security.signature.username" 
value="alice" />
+               </jaxws:properties>
+               <jaxws:features>
+                       <p:policies>
+                               <wsp:PolicyReference 
xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
+                                   
URI="classpath:/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml" />
+                       </p:policies>
+               </jaxws:features>
+       </jaxws:client>
+       
+       <jaxws:client
+        
name="{http://www.example.org/contract/DoubleIt}DoubleItNotOnlySignPort";
+        createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username" value="Alice" />
+            <entry key="ws-security.callback-handler"
+                
value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+            <entry key="ws-security.encryption.properties"
+                
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties" />
+            <entry key="ws-security.encryption.username" value="bob" />
+            <entry key="ws-security.signature.properties"
+                
value="org/apache/cxf/systest/ws/wssec10/client/alice.properties" />
+            <entry key="ws-security.signature.username" value="alice" />
+        </jaxws:properties>
+        <jaxws:features>
+            <p:policies>
+                <wsp:PolicyReference 
xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
+                    
URI="classpath:/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml" />
+            </p:policies>
+        </jaxws:features>
+    </jaxws:client>
+       
+</beans>

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,44 @@
+<wsp:Policy wsu:Id="OnlySignEntireHeadersAndBodyPolicy"
+        
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";>
+        <wsp:ExactlyOne>
+            <wsp:All>
+                <sp:AsymmetricBinding
+                    
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
+                    <wsp:Policy>
+                        <sp:InitiatorToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10 />
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:InitiatorToken>
+                        <sp:RecipientToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10 />
+                                        <sp:RequireIssuerSerialReference />
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:RecipientToken>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Lax />
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:AlgorithmSuite>
+                            <wsp:Policy>
+                                <sp:Basic128 />
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                    </wsp:Policy>
+                </sp:AsymmetricBinding>
+            </wsp:All>
+        </wsp:ExactlyOne>
+    </wsp:Policy>
\ No newline at end of file

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,45 @@
+<wsp:Policy wsu:Id="OnlySignEntireHeadersAndBodyPolicy"
+        
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";>
+        <wsp:ExactlyOne>
+            <wsp:All>
+                <sp:AsymmetricBinding
+                    
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
+                    <wsp:Policy>
+                        <sp:InitiatorToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10 />
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:InitiatorToken>
+                        <sp:RecipientToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10 />
+                                        <sp:RequireIssuerSerialReference />
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:RecipientToken>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Lax />
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:OnlySignEntireHeadersAndBody />
+                        <sp:AlgorithmSuite>
+                            <wsp:Policy>
+                                <sp:Basic128 />
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                    </wsp:Policy>
+                </sp:AsymmetricBinding>
+            </wsp:All>
+        </wsp:ExactlyOne>
+    </wsp:Policy>
\ No newline at end of file

Added: 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/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/bindings/server/server.xml?rev=1457826&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/server/server.xml
 (added)
+++ 
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/bindings/server/server.xml
 Mon Mar 18 15:46:43 2013
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xmlns:jaxws="http://cxf.apache.org/jaxws";
+    xmlns:http="http://cxf.apache.org/transports/http/configuration";
+    xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration";
+    xmlns:sec="http://cxf.apache.org/configuration/security";
+    xmlns:cxf="http://cxf.apache.org/core";
+    xmlns:p="http://cxf.apache.org/policy";
+    xsi:schemaLocation="
+        http://www.springframework.org/schema/beans                     
http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://cxf.apache.org/jaxws                                     
http://cxf.apache.org/schemas/jaxws.xsd
+        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+        http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+        http://cxf.apache.org/transports/http/configuration             
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+        http://cxf.apache.org/transports/http-jetty/configuration       
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+        http://cxf.apache.org/configuration/security                    
http://cxf.apache.org/schemas/configuration/security.xsd
+        http://www.w3.org/ns/ws-policy                                  
http://www.w3.org/2007/02/ws-policy.xsd
+    ">
+    <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+    
+    <cxf:bus>
+        <cxf:features>
+            <p:policies/>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+    
+       <jaxws:endpoint id="OnlySignEntireHeadersAndBodyEndpoint"
+               
address="http://localhost:${testutil.ports.Server}/DoubleItOnlySign";
+               serviceName="s:DoubleItService" 
endpointName="s:DoubleItOnlySignPort"
+               xmlns:s="http://www.example.org/contract/DoubleIt"; 
implementor="org.apache.cxf.systest.ws.common.DoubleItImpl"
+               
wsdlLocation="org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl">
+
+               <jaxws:properties>
+                       <entry key="ws-security.callback-handler"
+                               
value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+                       <entry key="ws-security.signature.properties"
+                               
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties" />
+                       <entry key="ws-security.encryption.username" 
value="useReqSigCert" />
+                       <entry key="ws-security.subject.cert.constraints" 
value=".*O=apache.org.*"/>
+               </jaxws:properties>
+               <jaxws:features>
+            <p:policies>
+                <wsp:PolicyReference 
xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
+                    
URI="classpath:/org/apache/cxf/systest/ws/bindings/only-sign-policy.xml" />
+            </p:policies>
+        </jaxws:features>
+
+       </jaxws:endpoint>
+       
+       <jaxws:endpoint id="NotOnlySignEntireHeadersAndBodyEndpoint"
+        address="http://localhost:${testutil.ports.Server}/DoubleItNotOnlySign";
+        serviceName="s:DoubleItService" 
endpointName="s:DoubleItNotOnlySignPort"
+        xmlns:s="http://www.example.org/contract/DoubleIt"; 
implementor="org.apache.cxf.systest.ws.common.DoubleItImpl"
+        
wsdlLocation="org/apache/cxf/systest/ws/bindings/DoubleItBindings.wsdl">
+
+        <jaxws:properties>
+            <entry key="ws-security.callback-handler"
+                
value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+            <entry key="ws-security.signature.properties"
+                
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties" />
+            <entry key="ws-security.encryption.username" value="useReqSigCert" 
/>
+            <entry key="ws-security.subject.cert.constraints" 
value=".*O=apache.org.*"/>
+        </jaxws:properties>
+        <jaxws:features>
+            <p:policies>
+                <wsp:PolicyReference 
xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
+                    
URI="classpath:/org/apache/cxf/systest/ws/bindings/not-only-sign-policy.xml" />
+            </p:policies>
+        </jaxws:features>
+
+    </jaxws:endpoint>
+
+    
+</beans>


Reply via email to