tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svkr...@apache.org
Subject svn commit: r573990 - in /incubator/tuscany/java/sca/modules/binding-ws-axis2: ./ src/main/java/org/apache/tuscany/sca/binding/ws/axis2/ src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/ src/main/resources/org/apache/tuscany/sca...
Date Sun, 09 Sep 2007 10:56:50 GMT
Author: svkrish
Date: Sun Sep  9 03:56:49 2007
New Revision: 573990

URL: http://svn.apache.org/viewvc?rev=573990&view=rev
Log:
added support for specifying ws security (userid and passwd) as policy, added logic to recognize
policyset specifications on ws bindings and configure axis2config parameters, added itest
to test authentication policy

Added:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.2.mar
  (with props)
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityTestCase.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurity.composite
Modified:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml?rev=573990&r1=573989&r2=573990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml Sun Sep  9 03:56:49 2007
@@ -80,6 +80,12 @@
             <artifactId>tuscany-host-http</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-security</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.axis2</groupId>
@@ -137,7 +143,7 @@
             <artifactId>neethi</artifactId>
             <version>2.0.1</version>
         </dependency>
-
+        
         <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
@@ -188,6 +194,62 @@
             <artifactId>tuscany-implementation-java-runtime</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
             <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-mtompolicy</artifactId>
+            <version>1.2</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.santuario</groupId>
+            <artifactId>xmlsec</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <version>2.6.0</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.ws.security</groupId>
+            <artifactId>wss4j</artifactId>
+            <version>1.5.3</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>xml-apis</groupId>
+            <artifactId>xml-apis</artifactId>
+            <version>1.3.03</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-core</artifactId>
+            <version>1.2</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-policy</artifactId>
+            <version>1.2</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-trust</artifactId>
+            <version>1.2</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart</artifactId>
+            <version>1.2</version>
+            <type>mar</type>
+            <scope>runtime</scope>
         </dependency>
 
     </dependencies>

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java?rev=573990&r1=573989&r2=573990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
Sun Sep  9 03:56:49 2007
@@ -37,6 +37,7 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
@@ -48,6 +49,9 @@
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 
 public class Axis2ServiceClient {
@@ -77,6 +81,8 @@
             TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
             ConfigurationContext configContext = tuscanyAxisConfigurator.getConfigurationContext();
 
+            configureSecurity(configContext);
+            
             Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition();
             setServiceAndPort(wsBinding);
             QName serviceQName = wsBinding.getServiceName();
@@ -206,5 +212,25 @@
         }
         return null;
     }
+    
+    private void configureSecurity(ConfigurationContext configContext) throws AxisFault {
+        if ( wsBinding instanceof PolicySetAttachPoint ) {
+            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+            Parameter configParam = null;
+            Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
+            for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
+                for ( Object policy : policySet.getPolicies() ) {
+                    if ( policy instanceof Axis2ConfigParamPolicy ) {
+                        axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+                        configParam = new Parameter(axis2ConfigParamPolicy.getParamName(),

+                                                    axis2ConfigParamPolicy.getParamElement().getFirstElement());
+                        configParam.setParameterElement(axis2ConfigParamPolicy.getParamElement());
+                        configContext.getAxisConfiguration().addParameter(configParam);
+                    }
+                }
+            }
+        }
+    }
+
 
 }

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=573990&r1=573989&r2=573990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
Sun Sep  9 03:56:49 2007
@@ -19,8 +19,13 @@
 
 package org.apache.tuscany.sca.binding.ws.axis2;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.net.URI;
+import java.net.URL;
+import java.security.PrivilegedAction;
 import java.util.Iterator;
 import java.util.List;
 
@@ -30,32 +35,45 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.ModuleBuilder;
 import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.description.WSDLToAxisServiceBuilder;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.neethi.Policy;
 import org.apache.tuscany.sca.assembly.AbstractContract;
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
 import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.databinding.axiom.String2OMElement;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
@@ -85,16 +103,20 @@
                                 ServletHost servletHost,
                                 MessageFactory messageFactory) {
 
-        this.contract = contract;
+        this.contract = contract; 
         this.wsBinding = wsBinding;
         this.servletHost = servletHost;
         this.messageFactory = messageFactory;
-
+        
         try {
             TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
             configContext = tuscanyAxisConfigurator.getConfigurationContext();
+            //deployRampartModule();
+            configureSecurity();
         } catch (AxisFault e) {
             throw new RuntimeException(e); // TODO: better exception
+        } catch ( Exception e ) {
+            throw new RuntimeException(e);
         }
 
         configContext.setContextRoot(servletHost.getContextPath());
@@ -105,6 +127,19 @@
         }
         wsBinding.setURI(uri);
     }
+    
+    private void engageModules() throws AxisFault {
+        if ( wsBinding instanceof PolicySetAttachPoint ) {
+            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+            if ( policiedBinding.getPolicySets().size() > 0 ) {
+                //TODO: need to verify if one of the policies are concerned with security
+                AxisModule m = new AxisModule("rampart");
+                m.setFileName(wsBinding.getClass().getClassLoader().getResource("rampart-1.2.mar"));
+                configContext.getAxisConfiguration().addModule(m);
+                configContext.getAxisConfiguration().engageModule(m, configContext.getAxisConfiguration());
+            }
+        }
+    }
 
     public void start() {
 
@@ -112,10 +147,11 @@
         // service for every port
 
         try {
+            AxisService axisService = createAxisService(); 
             configContext.getAxisConfiguration().addService(createAxisService());
         } catch (AxisFault e) {
             throw new RuntimeException(e);
-        }
+        } 
 
         Axis2ServiceServlet servlet = new Axis2ServiceServlet();
         servlet.init(configContext);
@@ -405,5 +441,69 @@
     protected Binding getBinding(){
         return wsBinding;
     }
+    
+    private void configureSecurity() throws AxisFault {
+        if ( wsBinding instanceof PolicySetAttachPoint ) {
+            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+            Parameter configParam = null;
+            Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
+            for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
+                for ( Object policy : policySet.getPolicies() ) {
+                    if ( policy instanceof Axis2ConfigParamPolicy ) {
+                        axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+                        configParam = new Parameter(axis2ConfigParamPolicy.getParamName(),

+                                                    axis2ConfigParamPolicy.getParamElement().getFirstElement());
+                        configParam.setParameterElement(axis2ConfigParamPolicy.getParamElement());
+                        configContext.getAxisConfiguration().addParameter(configParam);
+                    }
+                }
+            }
+        }
+    }
+    
+    private void deployRampartModule()  throws DeploymentException, AxisFault {
+    	ClassLoader tccl = (ClassLoader) org.apache.axis2.java.security.AccessController
+        .doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
+        });
+
 
+        AxisModule module = new AxisModule();
+        module.setParent(configContext.getAxisConfiguration());
+		String moduleName = "rampart-1.2";
+		URL moduleurl = TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/rampart-1.2.mar");
+		module.setName(moduleName);
+		ClassLoader deploymentClassloader = Utils.createClassLoader(new URL[]{moduleurl},
+													tccl,
+													true,
+													(File)configContext.getAxisConfiguration().getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+													
+		module.setModuleClassLoader(deploymentClassloader);
+		populateModule(module, moduleurl,configContext.getAxisConfiguration());
+		module.setFileName(moduleurl);
+		TuscanyAxisConfigurator.addNewModule(module, configContext.getAxisConfiguration());
+		org.apache.axis2.util.Utils.calculateDefaultModuleVersion(
+				configContext.getAxisConfiguration().getModules(), configContext.getAxisConfiguration());
+    }
+    
+    private void populateModule(AxisModule module, URL moduleUrl, AxisConfiguration axisConfig)
throws DeploymentException {
+        try {
+            ClassLoader classLoadere = module.getModuleClassLoader();
+            InputStream moduleStream = classLoadere.getResourceAsStream("META-INF/module.xml");
+            if (moduleStream == null) {
+                moduleStream = classLoadere.getResourceAsStream("meta-inf/module.xml");
+            }
+            if (moduleStream == null) {
+                throw new DeploymentException(
+                        Messages.getMessage(
+                                DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
+            }
+            ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
+            moduleBuilder.populateModule();
+        } catch (IOException e) {
+            throw new DeploymentException(e);
+        }
+    }
 }

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java?rev=573990&r1=573989&r2=573990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
Sun Sep  9 03:56:49 2007
@@ -31,7 +31,8 @@
 public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator
{
 
     public TuscanyAxisConfigurator() throws AxisFault {
-        super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
null);
+        super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config"));
+    	//super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
null);
     }
 
     public ConfigurationContext getConfigurationContext() throws AxisFault {

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml?rev=573990&r1=573989&r2=573990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
Sun Sep  9 03:56:49 2007
@@ -25,6 +25,12 @@
     <parameter name="hotupdate">false</parameter>
     <parameter name="enableMTOM">false</parameter>
     <parameter name="enableSwA">false</parameter>
+    
+    <!-- parameter name="OutflowSecurity">
+		<action>
+			<items>Timestamp</items>
+		</action>
+	</parameter-->
 
     <!--Uncomment if you want to enable file caching for attachments -->
     <!--parameter name="cacheAttachments">true</parameter>
@@ -51,7 +57,7 @@
     <!--To override repository/services you need to uncomment following parameter and
value SHOULD be absolute file path.-->
     <!--<parameter name="ServicesDirectory">service</parameter>-->
     <!--To override repository/modules you need to uncomment following parameter and value
SHOULD be absolute file path-->
-    <!--<parameter name="ModulesDirectory">modules</parameter>-->
+    <parameter name="ModulesDirectory">F:\LatestTrunk\sca\modules\binding-ws-axis2\src\main\resources\modules</parameter>
 
 
 
@@ -269,7 +275,7 @@
     <!--  Commented out by Tuscany
     <module ref="addressing"/>
     -->
-
+    <module ref="rampart"/>
     <!--Configuring module , providing parameters for modules whether they refer or not-->
     <!--<moduleConfig name="addressing">-->
     <!--<parameter name="addressingPara">N/A</parameter>-->

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list?rev=573990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
(added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
Sun Sep  9 03:56:49 2007
@@ -0,0 +1 @@
+rampart-1.2.mar
\ No newline at end of file

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.2.mar
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.2.mar?rev=573990&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.2.mar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java?rev=573990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java
(added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java
Sun Sep  9 03:56:49 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.tuscany.sca.binding.ws.axis2.itests.policy;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMText;
+import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractHelloWorldOMTestCase extends TestCase {
+
+    private SCADomain domain;
+    private HelloWorldOM helloWorld;
+
+    public void testCalculator() throws Exception {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om",
"helloworld");
+        OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
+        requestOM.addChild(parmE);
+        parmE.addChild(fac.createOMText("petra"));
+        OMElement responseOM = helloWorld.getGreetings(requestOM);
+        OMElement child = (OMElement)responseOM.getFirstElement();
+        Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        domain = SCADomain.newInstance(getCompositeName());
+        helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        domain.close();
+    }
+    
+    protected String getCompositeName() {
+        String className = this.getClass().getName();
+        return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java?rev=573990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java
(added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java
Sun Sep  9 03:56:49 2007
@@ -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.tuscany.sca.binding.ws.axis2.itests.policy;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException,
+            UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+        	System.out.println("*** Calling Client UserId/Password Handler .... ");
+            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+            pwcb.setPassword("TuscanyWsUserPasswd");
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java?rev=573990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java
(added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java
Sun Sep  9 03:56:49 2007
@@ -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.tuscany.sca.binding.ws.axis2.itests.policy;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class 
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException,
+            UnsupportedCallbackException {
+    	for (int i = 0; i < callbacks.length; i++) {
+    		System.out.println("*** Calling Server User/Passwd Handler....");
+    		WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+            pwcb.setPassword("TuscanyWsUserPasswd");
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityTestCase.java?rev=573990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityTestCase.java
(added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityTestCase.java
Sun Sep  9 03:56:49 2007
@@ -0,0 +1,24 @@
+/*
+ * 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.tuscany.sca.binding.ws.axis2.itests.policy;
+
+public class WSSecurityTestCase extends AbstractHelloWorldOMTestCase {
+    // super class does it all getting composite based on this class name
+}

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml?rev=573990&r1=573989&r2=573990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
Sun Sep  9 03:56:49 2007
@@ -19,7 +19,8 @@
 -->
 <sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
  			targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- 			xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+ 			xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 			xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
 
  <sca:intent name="soap"  
  			 constrains="sca:binding.ws">
@@ -41,5 +42,42 @@
  			 Communitcation thro this binding requires SOAP 1.2
  			 </sca:description>
  </sca:intent>
+ 
+ <sca:intent name="wsAuthentication" 
+ 			 constrains="sca:binding.ws">
+ 			 <description>
+ 			 Communitcation thro this binding required Authentication.
+ 			 </description>
+ </sca:intent>	
+ 
+ <!-- POLICY SETS -->
+  <sca:policySet name="wsAuthenticationPolicy"
+ 	provides="wsAuthentication"
+ 	appliesTo="sca:binding.ws"
+ 	>
+ 	<tuscany:wsConfigParam>
+ 		<parameter name="InflowSecurity">
+ 			<action>
+ 				<items>UsernameToken</items>
+ 				<passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.ServerPWCBHandler</passwordCallbackClass>
+       		</action>
+      	</parameter>
+ 	</tuscany:wsConfigParam>
+ </sca:policySet>
+ 
+ <sca:policySet name="wsClientAuthenticationPolicy"
+ 	provides="wsAuthentication"
+ 	appliesTo="sca:binding.ws">
+ 	<tuscany:wsConfigParam>
+ 		<parameter name="OutflowSecurity">
+ 			<action>
+ 				<items>UsernameToken</items>
+ 				<user>TuscanyWsUser</user>
+				<passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.ClientPWCBHandler</passwordCallbackClass>"
+
+                <passwordType>PasswordText</passwordType>
+               </action>
+    	</parameter>
+ 	</tuscany:wsConfigParam>
+ </sca:policySet>
 
 </sca:definitions>

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurity.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurity.composite?rev=573990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurity.composite
(added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurity.composite
Sun Sep  9 03:56:49 2007
@@ -0,0 +1,49 @@
+<?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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+           name="endpoint3">
+           
+    <!-- 
+    exposing a component with a WS binding using a WSDL port with an explicit URL
+    so for this composite the service is: http://localhost:8085/myExplicitURI 
+    -->      
+
+    <service name="helloWorld" promote="HelloWorldService" policySets="wsAuthenticationPolicy">
+        <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)"
/>
+        <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
/>
+    </service>
+
+    <component name="HelloWorldService">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+    </component>
+
+    <component name="HelloWorldComponent">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+        <reference name="helloWorldWS" />
+    </component>
+
+    <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="wsClientAuthenticationPolicy">
+        <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)"
/>
+        <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+                    uri="http://localhost:8085/myExplicitURI"/>
+    </reference>
+
+</composite>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message