cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jp...@apache.org
Subject svn commit: r1438244 - in /cxf/branches/2.6.x-fixes/systests/ws-security/src/test: java/org/apache/cxf/systest/ws/policy/ resources/java_first_policies/ resources/org/apache/cxf/systest/ws/policy/client/ resources/org/apache/cxf/systest/ws/policy/server/
Date Thu, 24 Jan 2013 22:44:28 GMT
Author: jpell
Date: Thu Jan 24 22:44:28 2013
New Revision: 1438244

URL: http://svn.apache.org/viewvc?rev=1438244&view=rev
Log:
CXF-4776 merged in test cases from trunk

Added:
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml   (with props)
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml   (with props)
Removed:
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml
Modified:
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
    cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java Thu Jan 24 22:44:28 2013
@@ -0,0 +1,39 @@
+/**
+ * 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.policy;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(name = "JavaFirstAttachmentPolicyService", 
+targetNamespace = "http://www.example.org/contract/JavaFirstAttachmentPolicyService")
+public interface JavaFirstAttachmentPolicyService {
+    @WebMethod(operationName = "doOperationLevelPolicy")
+    void doOperationLevelPolicy();
+
+    @WebMethod(operationName = "doInputMessagePolicy")
+    void doInputMessagePolicy();
+
+    @WebMethod(operationName = "doOutputMessagePolicy")
+    void doOutputMessagePolicy();
+    
+    @WebMethod(operationName = "doNoPolicy")
+    void doNoPolicy();    
+}

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java Thu Jan 24 22:44:28 2013
@@ -0,0 +1,39 @@
+/**
+ * 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.policy;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService", 
+serviceName = "JavaFirstAttachmentPolicyService", 
+targetNamespace = "http://www.example.org/contract/JavaFirstAttachmentPolicyService")
+public class JavaFirstAttachmentPolicyServiceImpl implements JavaFirstAttachmentPolicyService {
+    public void doOperationLevelPolicy() {
+    }
+
+    public void doInputMessagePolicy() {
+    }
+
+    public void doOutputMessagePolicy() {
+    }
+
+    public void doNoPolicy() {
+    }
+}

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java?rev=1438244&r1=1438243&r2=1438244&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java (original)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java Thu Jan 24 22:44:28 2013
@@ -36,7 +36,7 @@ public interface JavaFirstPolicyService 
     void doOperationOne();
 
     @Policies({
-        @Policy(uri = "classpath:/java_first_policies/SslWithUsernamePasswordToken.xml", 
+        @Policy(uri = "classpath:/java_first_policies/UsernamePasswordToken.xml", 
             placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT)
     })
     @WebMethod(operationName = "doOperationTwo")
@@ -50,7 +50,7 @@ public interface JavaFirstPolicyService 
     void doOperationThree();
     
     @Policies({
-        @Policy(uri = "classpath:/java_first_policies/SslWithUsernamePasswordToken.xml", 
+        @Policy(uri = "classpath:/java_first_policies/UsernamePasswordToken.xml", 
             placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT)
     })
     @WebMethod(operationName = "doOperationFour")

Modified: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java?rev=1438244&r1=1438243&r2=1438244&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java Thu Jan 24 22:44:28 2013
@@ -22,21 +22,34 @@ package org.apache.cxf.systest.ws.policy
 import java.io.InputStream;
 import java.io.StringReader;
 import java.net.HttpURLConnection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.service.model.MessageInfo.Type;
 import org.apache.cxf.systest.ws.common.SecurityTestUtil;
 import org.apache.cxf.systest.ws.policy.server.JavaFirstPolicyServer;
+import org.apache.cxf.systest.ws.wssec11.client.UTPasswordCallback;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+
 import org.apache.neethi.Constants;
 
+import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.handler.WSHandlerConstants;
+
 import org.junit.BeforeClass;
 
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
 public class JavaFirstPolicyServiceTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(JavaFirstPolicyServer.class);
     static final String PORT2 = allocatePort(JavaFirstPolicyServer.class, 2);
@@ -56,15 +69,106 @@ public class JavaFirstPolicyServiceTest 
         SecurityTestUtil.cleanup();
         stopAllServers();
     }
+    
+    @org.junit.Test
+    @org.junit.Ignore
+    public void testUsernameTokenInterceptorNoPasswordValidation() {
+        ClassPathXmlApplicationContext ctx = 
+            new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/policy/client/javafirstclient.xml");
+        
+        JavaFirstAttachmentPolicyService svc = 
+            (JavaFirstAttachmentPolicyService) ctx.getBean("JavaFirstAttachmentPolicyServiceClient");
+        
+        Client client = ClientProxy.getClient(svc);
+        client.getEndpoint().getEndpointInfo().setAddress(
+                                "http://localhost:" + PORT + "/JavaFirstAttachmentPolicyService");
+       
+        WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor();
+        client.getEndpoint().getOutInterceptors().add(wssOut);
+        
+        // just some basic sanity tests first to make sure that auth is working where password is provided.
+        wssOut.setProperties(getPasswordProperties("alice", "password"));
+        svc.doInputMessagePolicy();
+        
+        wssOut.setProperties(getPasswordProperties("alice", "passwordX"));
+        try {
+            svc.doInputMessagePolicy();
+            fail("Expected authentication failure");
+        } catch (Exception e) {
+            assertTrue(true);
+        }
+        
+        wssOut.setProperties(getNoPasswordProperties("alice"));
+        
+        try {
+            svc.doInputMessagePolicy();
+            fail("Expected authentication failure");
+        } catch (Exception e) {
+            assertTrue(true);
+        }
+    }
+    
+    @org.junit.Test
+    @org.junit.Ignore
+    public void testUsernameTokenPolicyValidatorNoPasswordValidation() {
+        ClassPathXmlApplicationContext ctx = 
+            new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/policy/client/javafirstclient.xml");
+        
+        SslUsernamePasswordAttachmentService svc = 
+            (SslUsernamePasswordAttachmentService) ctx.getBean("SslUsernamePasswordAttachmentServiceClient");
+        
+        Client client = ClientProxy.getClient(svc);
+        client.getEndpoint().getEndpointInfo().setAddress(
+                                "https://localhost:" + PORT2 + "/SslUsernamePasswordAttachmentService");
+       
+        WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor();
+        client.getEndpoint().getOutInterceptors().add(wssOut);
+        
+        // just some basic sanity tests first to make sure that auth is working where password is provided.
+        wssOut.setProperties(getPasswordProperties("alice", "password"));
+        svc.doSslAndUsernamePasswordPolicy();
+        
+        wssOut.setProperties(getPasswordProperties("alice", "passwordX"));
+        try {
+            svc.doSslAndUsernamePasswordPolicy();
+            fail("Expected authentication failure");
+        } catch (Exception e) {
+            assertTrue(true);
+        }
+        
+        wssOut.setProperties(getNoPasswordProperties("alice"));
+        
+        try {
+            svc.doSslAndUsernamePasswordPolicy();
+            fail("Expected authentication failure");
+        } catch (Exception e) {
+            assertTrue(true);
+        }
+    }
+    
+    private Map<String, Object> getPasswordProperties(String username, String password) {
+        UTPasswordCallback callback = new UTPasswordCallback();
+        callback.setAliasPassword(username, password);
+        
+        Map<String, Object> outProps = new HashMap<String, Object>();
+        outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
+        outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
+        outProps.put(WSHandlerConstants.PW_CALLBACK_REF, callback);
+        outProps.put(WSHandlerConstants.USER, username);
+        return outProps;
+    }
+    
+    private Map<String, Object> getNoPasswordProperties(String username) {
+        Map<String, Object> outProps = new HashMap<String, Object>();
+        outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
+        outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_NONE);
+        outProps.put(WSHandlerConstants.USER, username);
+        return outProps;
+    }
 
     @org.junit.Test
     public void testJavaFirstWsdl() throws Exception {
-        HttpURLConnection connection = getHttpConnection("http://localhost:" + PORT2
-                                                         + "/JavaFirstPolicyService?wsdl");
-        InputStream is = connection.getInputStream();
-        String wsdlContents = IOUtils.toString(is);
-
-        Document doc = DOMUtils.readXml(new StringReader(wsdlContents));
+        Document doc = loadWsdl("JavaFirstPolicyService");
 
         Element portType = DOMUtils.getFirstChildWithName(doc.getDocumentElement(), WSDL_NAMESPACE, "portType");
         assertNotNull(portType);
@@ -72,32 +176,47 @@ public class JavaFirstPolicyServiceTest 
         List<Element> operationMessages = DOMUtils.getChildrenWithName(portType, WSDL_NAMESPACE, "operation");
         assertEquals(5, operationMessages.size());
         
-        Element operationOne = getOperationMessage("doOperationOne", operationMessages);
-        assertEquals("#InternalTransportAndUsernamePolicy", getPolicyReferenceId(operationOne));
-        Element operationTwo = getOperationMessage("doOperationTwo", operationMessages);
-        assertEquals("#TransportAndUsernamePolicy", getPolicyReferenceId(operationTwo));
-        Element operationThree = getOperationMessage("doOperationThree", operationMessages);
-        assertEquals("#InternalTransportAndUsernamePolicy", getPolicyReferenceId(operationThree));
-        Element operationFour = getOperationMessage("doOperationFour", operationMessages);
-        assertEquals("#TransportAndUsernamePolicy", getPolicyReferenceId(operationFour));
-        Element operationPing = getOperationMessage("doPing", operationMessages);
-        assertNull(getPolicyReferenceId(operationPing));
+        Element operationOne = getOperationElement("doOperationOne", operationMessages);
+        assertEquals("#InternalTransportAndUsernamePolicy", 
+                     getMessagePolicyReferenceId(operationOne, Type.INPUT, Constants.URI_POLICY_NS));
+        Element operationTwo = getOperationElement("doOperationTwo", operationMessages);
+        assertEquals("#TransportAndUsernamePolicy", 
+                     getMessagePolicyReferenceId(operationTwo, Type.INPUT, Constants.URI_POLICY_NS));
+        Element operationThree = getOperationElement("doOperationThree", operationMessages);
+        assertEquals("#InternalTransportAndUsernamePolicy", 
+                     getMessagePolicyReferenceId(operationThree, Type.INPUT, Constants.URI_POLICY_NS));
+        Element operationFour = getOperationElement("doOperationFour", operationMessages);
+        assertEquals("#TransportAndUsernamePolicy", 
+                     getMessagePolicyReferenceId(operationFour, Type.INPUT, Constants.URI_POLICY_NS));
+        Element operationPing = getOperationElement("doPing", operationMessages);
+        assertNull(getMessagePolicyReferenceId(operationPing, Type.INPUT, Constants.URI_POLICY_NS));
         
         List<Element> policyMessages = DOMUtils.getChildrenWithName(doc.getDocumentElement(), 
                                                                     Constants.URI_POLICY_NS, "Policy");
+        
         assertEquals(2, policyMessages.size());
         
         // validate that both the internal and external policies are included
         assertEquals("TransportAndUsernamePolicy", getPolicyId(policyMessages.get(0)));
         assertEquals("InternalTransportAndUsernamePolicy", getPolicyId(policyMessages.get(1)));
     }
+
+    private Document loadWsdl(String serviceName) throws Exception {
+        HttpURLConnection connection = getHttpConnection("http://localhost:" + PORT
+                                                         + "/" + serviceName + "?wsdl");
+        InputStream is = connection.getInputStream();
+        String wsdlContents = IOUtils.toString(is);
+        
+        //System.out.println(wsdlContents);
+        return DOMUtils.readXml(new StringReader(wsdlContents));
+    }
     
     private String getPolicyId(Element element) {
         return element.getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
                                      PolicyConstants.WSU_ID_ATTR_NAME);
     }
     
-    private Element getOperationMessage(String operationName, List<Element> operationMessages) {
+    private Element getOperationElement(String operationName, List<Element> operationMessages) {
         Element operationElement = null;
         for (Element operation : operationMessages) {
             if (operationName.equals(operation.getAttribute("name"))) {
@@ -109,10 +228,11 @@ public class JavaFirstPolicyServiceTest 
         return operationElement;
     }
     
-    private String getPolicyReferenceId(Element operationMessage) {
-        Element inputMessage = DOMUtils.getFirstChildWithName(operationMessage, WSDL_NAMESPACE, "input");
-        assertNotNull(inputMessage);
-        Element policyReference = DOMUtils.getFirstChildWithName(inputMessage, Constants.URI_POLICY_NS, 
+    private String getMessagePolicyReferenceId(Element operationElement, Type type, String policyNamespace) {
+        Element messageElement = DOMUtils.getFirstChildWithName(operationElement, WSDL_NAMESPACE, 
+                                                              type.name().toLowerCase());
+        assertNotNull(messageElement);
+        Element policyReference = DOMUtils.getFirstChildWithName(messageElement, policyNamespace, 
                                                                  "PolicyReference");
         if (policyReference != null) {
             return policyReference.getAttribute("URI");

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java Thu Jan 24 22:44:28 2013
@@ -0,0 +1,30 @@
+/**
+ * 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.policy;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(name = "SslUsernamePasswordAttachmentService", 
+targetNamespace = "http://www.example.org/contract/SslUsernamePasswordAttachmentService")
+public interface SslUsernamePasswordAttachmentService {
+    @WebMethod(operationName = "doSslAndUsernamePasswordPolicy")
+    void doSslAndUsernamePasswordPolicy();
+}

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java Thu Jan 24 22:44:28 2013
@@ -0,0 +1,31 @@
+/**
+ * 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.policy;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "org.apache.cxf.systest.ws.policy.SslUsernamePasswordAttachmentService", 
+serviceName = "SslUsernamePasswordAttachmentService", 
+targetNamespace = "http://www.example.org/contract/SslUsernamePasswordAttachmentService")
+public class SslUsernamePasswordAttachmentServiceImpl implements SslUsernamePasswordAttachmentService {
+    public void doSslAndUsernamePasswordPolicy() {
+    }
+
+}

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java Thu Jan 24 22:44:28 2013
@@ -0,0 +1,43 @@
+/**
+ * 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.policy;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilder;
+
+public class URIDomainExpressionBuilder implements DomainExpressionBuilder {
+    private static final Collection<QName> SUPPORTED_TYPES = Collections.unmodifiableList(
+             Arrays.asList(new QName[] {
+                 new QName("http://www.w3.org/ns/ws-policy", "URI"),
+                 new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "URI")}));
+
+    public DomainExpression build(Element paramElement) {
+        return new UriDomainExpression(paramElement.getTextContent());
+    }
+
+    public Collection<QName> getDomainExpressionTypes() {
+        return SUPPORTED_TYPES;
+    }
+}

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java Thu Jan 24 22:44:28 2013
@@ -0,0 +1,66 @@
+/**
+ * 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.policy;
+
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
+
+public class UriDomainExpression implements DomainExpression {
+    private final String url;
+    
+    public UriDomainExpression(final String url) {
+        this.url = url;
+    }
+
+    public boolean appliesTo(BindingMessageInfo bmi) {
+        String serviceName = 
+            bmi.getBindingOperation().getBinding().getService().getName().getLocalPart();
+        
+        if ("JavaFirstAttachmentPolicyService".equals(serviceName) && "usernamepassword".equals(url)) {
+            return MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType());
+        } else if ("SslUsernamePasswordAttachmentService".equals(serviceName) 
+            && "sslusernamepassword".equals(url)) {
+            return MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType());
+        } else {
+            return false;
+        }
+    }
+
+    public boolean appliesTo(BindingOperationInfo arg0) {
+        return false;
+    }
+
+    public boolean appliesTo(EndpointInfo arg0) {
+        return false;
+    }
+
+    public boolean appliesTo(ServiceInfo arg0) {
+        return false;
+    }
+
+    public boolean appliesTo(BindingFaultInfo arg0) {
+        return false;
+    }
+}

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml Thu Jan 24 22:44:28 2013
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+	xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+
+	<wsp:AppliesTo>
+		<wsp:URI>sslusernamepassword</wsp:URI>
+	</wsp:AppliesTo>
+
+	<wsp:Policy wsu:Id="UsernameToken"
+		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+		<wsp:ExactlyOne>
+			<wsp:All>
+				<sp:TransportBinding>
+					<wsp:Policy>
+						<sp:TransportToken>
+							<wsp:Policy>
+								<sp:HttpsToken>
+									<wsp:Policy />
+								</sp:HttpsToken>
+							</wsp:Policy>
+						</sp:TransportToken>
+						<sp:Layout>
+							<wsp:Policy>
+								<sp:Lax />
+							</wsp:Policy>
+						</sp:Layout>
+						<sp:AlgorithmSuite>
+							<wsp:Policy>
+								<sp:Basic128 />
+							</wsp:Policy>
+						</sp:AlgorithmSuite>
+					</wsp:Policy>
+				</sp:TransportBinding>
+				
+				<sp:SupportingTokens>
+					<wsp:Policy>
+						<sp:UsernameToken
+							sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
+							<wsp:Policy>
+								<sp:WssUsernameToken11 />
+							</wsp:Policy>
+						</sp:UsernameToken>
+					</wsp:Policy>
+				</sp:SupportingTokens>
+			</wsp:All>
+		</wsp:ExactlyOne>
+	</wsp:Policy>
+</wsp:PolicyAttachment>
\ No newline at end of file

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml Thu Jan 24 22:44:28 2013
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+	xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+
+	<wsp:AppliesTo>
+		<wsp:URI>usernamepassword</wsp:URI>
+	</wsp:AppliesTo>
+
+	<wsp:Policy wsu:Id="UsernameToken"
+		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+		<wsp:ExactlyOne>
+			<wsp:All>
+				<sp:SupportingTokens>
+					<wsp:Policy>
+						<sp:UsernameToken
+							sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
+							<wsp:Policy>
+								<sp:WssUsernameToken11 />
+							</wsp:Policy>
+						</sp:UsernameToken>
+					</wsp:Policy>
+				</sp:SupportingTokens>
+			</wsp:All>
+		</wsp:ExactlyOne>
+	</wsp:Policy>
+</wsp:PolicyAttachment>
\ No newline at end of file

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml Thu Jan 24 22:44:28 2013
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<wsp:Policy wsu:Id="TransportAndUsernamePolicy" 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+	<wsp:ExactlyOne>
+		<wsp:All>
+			<sp:SupportingTokens>
+				<wsp:Policy>
+					<sp:UsernameToken>
+						<wsp:Policy>
+							<sp:WssUsernameToken10 />
+						</wsp:Policy>
+					</sp:UsernameToken>
+				</wsp:Policy>
+			</sp:SupportingTokens>
+		</wsp:All>
+	</wsp:ExactlyOne>
+</wsp:Policy>
\ No newline at end of file

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml?rev=1438244&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml Thu Jan 24 22:44:28 2013
@@ -0,0 +1,61 @@
+<?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>
+	
+	<http:conduit name="https://localhost:.*">
+        <http:tlsClientParameters disableCNCheck="true">
+            <sec:trustManagers>
+                <sec:keyStore type="jks" password="password" resource="org/apache/cxf/systest/ws/security/Truststore.jks"/>
+            </sec:trustManagers>
+        </http:tlsClientParameters>
+    </http:conduit>  
+    
+    <jaxws:client 
+		id="JavaFirstAttachmentPolicyServiceClient" serviceClass="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService">
+	</jaxws:client>
+	
+	<jaxws:client 
+		id="SslUsernamePasswordAttachmentServiceClient" serviceClass="org.apache.cxf.systest.ws.policy.SslUsernamePasswordAttachmentService">
+	</jaxws:client>
+	
+	
+		
+</beans>

Propchange: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml?rev=1438244&r1=1438243&r2=1438244&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml (original)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml Thu Jan 24 22:44:28 2013
@@ -1,31 +1,21 @@
 <?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.
--->
+<!-- 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="
+	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
@@ -35,45 +25,105 @@
         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"/>
+	<bean
+		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+
+	<cxf:bus>
+		<cxf:features>
+			<p:policies />
+			<cxf:logging />
+		</cxf:features>
+	</cxf:bus>
+
+    <httpj:engine-factory id="tls-settings">
+        <httpj:engine port="${testutil.ports.JavaFirstPolicyServer.2}">
+            <httpj:tlsServerParameters>
+                <sec:keyManagers keyPassword="password">
+                    <sec:keyStore type="jks" password="password" resource="org/apache/cxf/systest/ws/security/Bethal.jks"/>
+                </sec:keyManagers>
+                <sec:cipherSuitesFilter>
+                    <sec:include>.*_EXPORT_.*</sec:include>
+                    <sec:include>.*_EXPORT1024_.*</sec:include>
+                    <sec:include>.*_WITH_DES_.*</sec:include>
+                    <sec:include>.*_WITH_AES_.*</sec:include>
+                    <sec:include>.*_WITH_NULL_.*</sec:include>
+                    <sec:exclude>.*_DH_anon_.*</sec:exclude>
+                </sec:cipherSuitesFilter>
+                <sec:clientAuthentication want="true" required="false"/>
+            </httpj:tlsServerParameters>
+        </httpj:engine>
+    </httpj:engine-factory>
     
-    <cxf:bus>
-        <cxf:features>
-            <p:policies/>
-            <cxf:logging/>
-        </cxf:features>
-    </cxf:bus>
-    
-    <bean id="org.apache.cxf.systest.ws.policy.JavaFirstPolicyService"
-        class="org.apache.cxf.systest.ws.policy.JavaFirstPolicyServiceImpl" />
-    
-    <jaxws:endpoint 
-       id="JavaFirstPolicyService"
-       address="http://localhost:${testutil.ports.JavaFirstPolicyServer.2}/JavaFirstPolicyService" 
-       implementor="#org.apache.cxf.systest.ws.policy.JavaFirstPolicyService">
-        
-       <jaxws:properties>
-          <entry key="ws-security.callback-handler"
-                value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
-       </jaxws:properties> 
-    </jaxws:endpoint> 
-    
-    <wsp:Policy wsu:Id="InternalTransportAndUsernamePolicy"
-	xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
-	xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
-	xmlns:wsp="http://www.w3.org/ns/ws-policy">
-	<wsp:ExactlyOne>
-		<wsp:All>
-			<sp:SupportingTokens>
-				<wsp:Policy>
-					<sp:UsernameToken>
-                     <wsp:Policy>
-                        <sp:WssUsernameToken10 />
-                     </wsp:Policy>
-                  </sp:UsernameToken>
-				</wsp:Policy>
-			</sp:SupportingTokens>
-		</wsp:All>
-	</wsp:ExactlyOne>
-</wsp:Policy>
+	<p:externalAttachment location="classpath:java_first_policies/UsernamePasswordAttachment.xml" />
+	<p:externalAttachment location="classpath:java_first_policies/SslUsernamePasswordAttachment.xml" />
+
+	<!-- register a policy attachment appliesto checker! -->
+	<bean id="uridomainexpressionbuilder"
+		class="org.apache.cxf.systest.ws.policy.URIDomainExpressionBuilder" />
+
+	<bean id="org.apache.cxf.systest.ws.policy.JavaFirstPolicyService"
+		class="org.apache.cxf.systest.ws.policy.JavaFirstPolicyServiceImpl" />
+
+	<bean id="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService"
+		class="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyServiceImpl" />
+
+	<bean id="org.apache.cxf.systest.ws.policy.SslUsernamePasswordAttachmentService"
+		class="org.apache.cxf.systest.ws.policy.SslUsernamePasswordAttachmentServiceImpl" />
+
+	<jaxws:endpoint id="JavaFirstPolicyService"
+		address="http://localhost:${testutil.ports.JavaFirstPolicyServer}/JavaFirstPolicyService"
+		implementor="#org.apache.cxf.systest.ws.policy.JavaFirstPolicyService">
+
+		<jaxws:properties>
+			<entry key="ws-security.callback-handler"
+				value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+		</jaxws:properties>
+	</jaxws:endpoint>
+	
+	<jaxws:endpoint id="JavaFirstAttachmentPolicyService"
+		address="http://localhost:${testutil.ports.JavaFirstPolicyServer}/JavaFirstAttachmentPolicyService"
+		implementor="#org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService">
+
+		<jaxws:properties>
+			<entry key="ws-security.callback-handler"
+				value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+		</jaxws:properties>
+
+		<jaxws:features>
+			<p:policies />
+		</jaxws:features>
+	</jaxws:endpoint>
+	
+	<jaxws:endpoint id="SslUsernamePasswordAttachmentService"
+		address="https://localhost:${testutil.ports.JavaFirstPolicyServer.2}/SslUsernamePasswordAttachmentService"
+		implementor="#org.apache.cxf.systest.ws.policy.SslUsernamePasswordAttachmentService">
+
+		<jaxws:properties>
+			<entry key="ws-security.callback-handler"
+				value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+		</jaxws:properties>
+
+		<jaxws:features>
+			<p:policies />
+		</jaxws:features>
+	</jaxws:endpoint>
+
+	<wsp:Policy wsu:Id="InternalTransportAndUsernamePolicy"
+		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+		xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+		xmlns:wsp="http://www.w3.org/ns/ws-policy">
+		<wsp:ExactlyOne>
+			<wsp:All>
+				<sp:SupportingTokens>
+					<wsp:Policy>
+						<sp:UsernameToken>
+							<wsp:Policy>
+								<sp:WssUsernameToken10 />
+							</wsp:Policy>
+						</sp:UsernameToken>
+					</wsp:Policy>
+				</sp:SupportingTokens>
+			</wsp:All>
+		</wsp:ExactlyOne>
+	</wsp:Policy>
 </beans>



Mime
View raw message