cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jp...@apache.org
Subject svn commit: r1437983 - in /cxf/trunk/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 12:49:05 GMT
Author: jpell
Date: Thu Jan 24 12:49:05 2013
New Revision: 1437983

URL: http://svn.apache.org/viewvc?rev=1437983&view=rev
Log:
CXF-4776 cleanup of test cases

Added:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java
    cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml
    cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml
    cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml
    cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml
Removed:
    cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/AttachmentPolicy.xml
    cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml
Modified:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
    cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java?rev=1437983&r1=1437982&r2=1437983&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
Thu Jan 24 12:49:05 2013
@@ -35,6 +35,5 @@ public interface JavaFirstAttachmentPoli
     void doOutputMessagePolicy();
     
     @WebMethod(operationName = "doNoPolicy")
-    void doNoPolicy();
-    
+    void doNoPolicy();    
 }

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java?rev=1437983&r1=1437982&r2=1437983&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
Thu Jan 24 12:49:05 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/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java?rev=1437983&r1=1437982&r2=1437983&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
Thu Jan 24 12:49:05 2013
@@ -22,22 +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);
@@ -57,7 +69,103 @@ 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 testJavaFirstAttachmentWsdl() throws Exception {
         Document doc = loadWsdl("JavaFirstAttachmentPolicyService");
@@ -145,7 +253,7 @@ public class JavaFirstPolicyServiceTest 
     }
 
     private Document loadWsdl(String serviceName) throws Exception {
-        HttpURLConnection connection = getHttpConnection("http://localhost:" + PORT2
+        HttpURLConnection connection = getHttpConnection("http://localhost:" + PORT
                                                          + "/" + serviceName + "?wsdl");
         InputStream is = connection.getInputStream();
         String wsdlContents = IOUtils.toString(is);

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java?rev=1437983&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java
(added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentService.java
Thu Jan 24 12:49:05 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();
+}

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java?rev=1437983&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java
(added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/SslUsernamePasswordAttachmentServiceImpl.java
Thu Jan 24 12:49:05 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() {
+    }
+
+}

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java?rev=1437983&r1=1437982&r2=1437983&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
Thu Jan 24 12:49:05 2013
@@ -35,7 +35,7 @@ public class URIDomainExpressionBuilder 
 
     @Override
     public DomainExpression build(Element paramElement) {
-        return new UriDomainExpression();
+        return new UriDomainExpression(paramElement.getTextContent());
     }
 
     @Override

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java?rev=1437983&r1=1437982&r2=1437983&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
Thu Jan 24 12:49:05 2013
@@ -28,7 +28,10 @@ import org.apache.cxf.service.model.Serv
 import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
 
 public class UriDomainExpression implements DomainExpression {
-    public UriDomainExpression() {
+    private final String url;
+    
+    public UriDomainExpression(final String url) {
+        this.url = url;
     }
 
     @Override
@@ -37,16 +40,30 @@ public class UriDomainExpression impleme
     }
 
     @Override
-    public boolean appliesTo(BindingMessageInfo paramBindingMessageInfo) {
-        return ("doInputMessagePolicy".equals(paramBindingMessageInfo.getBindingOperation().getName().getLocalPart())

-            && MessageInfo.Type.INPUT.equals(paramBindingMessageInfo.getMessageInfo().getType()))
-            || ("doOutputMessagePolicy".equals(paramBindingMessageInfo.getBindingOperation().getName().getLocalPart())

-            && MessageInfo.Type.OUTPUT.equals(paramBindingMessageInfo.getMessageInfo().getType()));
+    public boolean appliesTo(BindingMessageInfo bmi) {
+        String serviceName = 
+            bmi.getBindingOperation().getBinding().getService().getName().getLocalPart();
+        
+        if ("JavaFirstAttachmentPolicyService".equals(serviceName) && "usernamepassword".equals(url))
{
+            return ("doInputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())

+                && MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType()))
+                || ("doOutputMessagePolicy".equals(bmi.getBindingOperation().getName().getLocalPart())

+                && MessageInfo.Type.OUTPUT.equals(bmi.getMessageInfo().getType()));
+        } else if ("SslUsernamePasswordAttachmentService".equals(serviceName) 
+            && "sslusernamepassword".equals(url)) {
+            return MessageInfo.Type.INPUT.equals(bmi.getMessageInfo().getType());
+        } else {
+            return false;
+        }
     }
 
     @Override
-    public boolean appliesTo(BindingOperationInfo paramBindingOperationInfo) {
-        return "doOperationLevelPolicy".equals(paramBindingOperationInfo.getName().getLocalPart());
+    public boolean appliesTo(BindingOperationInfo boi) {
+        if ("usernamepassword".equals(url)) {
+            return "doOperationLevelPolicy".equals(boi.getName().getLocalPart());
+        } else {
+            return false;
+        }
     }
 
     @Override

Added: cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml?rev=1437983&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml
(added)
+++ cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/SslUsernamePasswordAttachment.xml
Thu Jan 24 12:49:05 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

Added: cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml?rev=1437983&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml
(added)
+++ cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordAttachment.xml
Thu Jan 24 12:49:05 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

Added: cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml?rev=1437983&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml
(added)
+++ cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/UsernamePasswordToken.xml
Thu Jan 24 12:49:05 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

Added: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml?rev=1437983&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml
(added)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/javafirstclient.xml
Thu Jan 24 12:49:05 2013
@@ -0,0 +1,67 @@
+<?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:properties>
+			<entry key="ws-security.username" value="jason" />
+		</jaxws:properties>
+	</jaxws:client>
+	
+	<jaxws:client 
+		id="SslUsernamePasswordAttachmentServiceClient" serviceClass="org.apache.cxf.systest.ws.policy.SslUsernamePasswordAttachmentService">
+		<jaxws:properties>
+			<entry key="ws-security.username" value="jason" />
+		</jaxws:properties>
+	</jaxws:client>
+	
+	
+		
+</beans>

Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml?rev=1437983&r1=1437982&r2=1437983&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml
(original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml
Thu Jan 24 12:49:05 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,87 +25,122 @@
         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>
-    
-    <p:externalAttachment location="classpath:java_first_policies/AttachmentPolicy.xml"/>
-    
-    <!--  register a policy attachment appliesto checker! -->
-	<bean id="uridomainexpressionbuilder" 
-	    class="org.apache.cxf.systest.ws.policy.URIDomainExpressionBuilder" />
+	<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>
+    
+	<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.JavaFirstAttachmentPolicyService2"
+		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>
 	
-    <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.JavaFirstAttachmentPolicyService2"
-        class="org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyServiceImpl" />
-        
-    <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>
-    
-    <jaxws:endpoint 
-       id="JavaFirstAttachmentPolicyService"
-       address="http://localhost:${testutil.ports.JavaFirstPolicyServer.2}/JavaFirstAttachmentPolicyService"

-       implementor="#org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService2">
-        
-       <jaxws:properties>
-          <entry key="ws-security.callback-handler"
-                value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
-       </jaxws:properties>
-       
-       <jaxws:features>
+	<jaxws:endpoint id="JavaFirstAttachmentPolicyService"
+		address="http://localhost:${testutil.ports.JavaFirstPolicyServer}/JavaFirstAttachmentPolicyService"
+		implementor="#org.apache.cxf.systest.ws.policy.JavaFirstAttachmentPolicyService2">
+
+		<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="JavaFirstAttachmentPolicyService2"
-       address="http://localhost:${testutil.ports.JavaFirstPolicyServer.2}/JavaFirstAttachmentPolicyService2"

-       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>
+		</jaxws:features>
+	</jaxws:endpoint>
+
+	<jaxws:endpoint id="JavaFirstAttachmentPolicyService2"
+		address="http://localhost:${testutil.ports.JavaFirstPolicyServer}/JavaFirstAttachmentPolicyService2"
+		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> 
-    
-    <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>
+		</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