You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/09/15 10:08:02 UTC

svn commit: r695374 [1/3] - in /tuscany/java/sca: itest/ itest/policy-security-basicauth/src/main/java/helloworld/ itest/policy-security-basicauth/src/main/resources/ itest/policy-security-token/ itest/policy-security-token/src/ itest/policy-security-t...

Author: slaws
Date: Mon Sep 15 01:07:58 2008
New Revision: 695374

URL: http://svn.apache.org/viewvc?rev=695374&view=rev
Log:
More work exploring the policy extension model by implementing a token based authentication schema across binding.ws and binding.jm. No authentication is actually performed here. That is left for users to provide their own policy interceptors. However tokens are passed and security Subjects/Principals are created. This exercise has highlighted some awkwardness in the process of building policy implementations. I'll post about this on the mail list. 

Added:
    tuscany/java/sca/itest/policy-security-token/   (with props)
    tuscany/java/sca/itest/policy-security-token/pom.xml   (with props)
    tuscany/java/sca/itest/policy-security-token/src/
    tuscany/java/sca/itest/policy-security-token/src/main/
    tuscany/java/sca/itest/policy-security-token/src/main/java/
    tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/
    tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java   (with props)
    tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java   (with props)
    tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java   (with props)
    tuscany/java/sca/itest/policy-security-token/src/main/resources/
    tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml   (with props)
    tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite   (with props)
    tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties   (with props)
    tuscany/java/sca/itest/policy-security-token/src/test/
    tuscany/java/sca/itest/policy-security-token/src/test/java/
    tuscany/java/sca/itest/policy-security-token/src/test/java/org/
    tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/
    tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/
    tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/
    tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/
    tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/   (with props)
    tuscany/java/sca/modules/binding-jms-policy/LICENSE   (with props)
    tuscany/java/sca/modules/binding-jms-policy/NOTICE   (with props)
    tuscany/java/sca/modules/binding-jms-policy/pom.xml   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/
    tuscany/java/sca/modules/binding-jms-policy/src/main/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java   (with props)
    tuscany/java/sca/modules/binding-jms-policy/src/main/resources/
    tuscany/java/sca/modules/binding-jms-policy/src/main/resources/META-INF/
    tuscany/java/sca/modules/binding-jms-policy/src/main/resources/META-INF/services/
    tuscany/java/sca/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/java/sca/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    tuscany/java/sca/modules/binding-jms-policy/src/test/
    tuscany/java/sca/modules/binding-jms-policy/src/test/java/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/
    tuscany/java/sca/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java   (with props)
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingHeaderConfigurator.java   (with props)
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/SecurityUtil.java   (with props)
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPrincipal.java   (with props)
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/token/
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/token/TokenPrincipal.java   (with props)
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyInterceptor.java   (with props)
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java   (with props)
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProviderFactory.java   (with props)
Removed:
    tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/jndi.properties
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/
Modified:
    tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java
    tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java
    tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/definitions.xml
    tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/helloworld.composite
    tuscany/java/sca/itest/pom.xml
    tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
    tuscany/java/sca/modules/binding-jms-runtime/pom.xml
    tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
    tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
    tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
    tuscany/java/sca/modules/binding-ws-axis2-policy/pom.xml
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/java/sca/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    tuscany/java/sca/modules/binding-ws-axis2/pom.xml
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    tuscany/java/sca/modules/binding-ws-wsdlgen/pom.xml
    tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
    tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
    tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicy.java
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProcessor.java
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java
    tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
    tuscany/java/sca/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/java/sca/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    tuscany/java/sca/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/tuscany_definitions.xml
    tuscany/java/sca/modules/pom.xml

Modified: tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java?rev=695374&r1=695373&r2=695374&view=diff
==============================================================================
--- tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java (original)
+++ tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java Mon Sep 15 01:07:58 2008
@@ -30,13 +30,11 @@
     @Reference
     protected HelloWorldService helloworldWS;
     
-    @Reference
-    protected HelloWorldService helloworldJMS;    
+
 
     public String getGreetings(String name) {
         return "Hello " + 
-                helloworldWS.getGreetings(name) + 
-                helloworldJMS.getGreetings(name);
+                helloworldWS.getGreetings(name);
     }
 
 }

Modified: tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java?rev=695374&r1=695373&r2=695374&view=diff
==============================================================================
--- tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java (original)
+++ tuscany/java/sca/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java Mon Sep 15 01:07:58 2008
@@ -18,6 +18,10 @@
  */
 package helloworld;
 
+import javax.security.auth.Subject;
+
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
 import org.osoa.sca.annotations.Service;
 
 /**
@@ -26,8 +30,17 @@
 @Service(HelloWorldService.class)
 public class HelloWorldServiceImpl implements HelloWorldService {
 
+    @Context
+    protected RequestContext requestContext;
+    
     public String getGreetings(String name) {
-        return "Hello " + name;
+        Subject subject = requestContext.getSecuritySubject();
+        
+        if (subject == null){
+            return "Hello " + name + " null subject";
+        } else {
+            return "Hello " + name + " " + subject.toString();
+        }
     }
 
 }

Modified: tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/definitions.xml?rev=695374&r1=695373&r2=695374&view=diff
==============================================================================
--- tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/definitions.xml (original)
+++ tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/definitions.xml Mon Sep 15 01:07:58 2008
@@ -27,21 +27,18 @@
     <sca:policySet name="BasicAuthenticationPolicySet"
                    provides="authentication"
                    appliesTo="sca:binding.ws">
-                   
         <tuscany:basicAuthentication>
           <tuscany:userName>myname</tuscany:userName>
           <tuscany:password>mypassword</tuscany:password>
         </tuscany:basicAuthentication>
-        
     </sca:policySet>
-      
-    <!-- some authentication implementation policies - may think about these later 
-    <policySet name="allowed_users" appliesTo="sca:implementation.java">
-    	<permitAll/>
-    </policySet>
     
-    <policySet name="runAsAdmin" appliesTo="sca:implementation.java">
-    	<runAs role="Administrator"/>
-    </policySet>
-    -->
+    <sca:policySet name="ImplementationIdentityPolicySet"
+                    provides="tuscany:identity"
+                   appliesTo="sca:implementation.java">
+        <securityIdentity>
+            <useCallerIdentity/>
+        </securityIdentity>  
+    </sca:policySet>      
+      
 </definitions>
\ No newline at end of file

Modified: tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/helloworld.composite?rev=695374&r1=695373&r2=695374&view=diff
==============================================================================
--- tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/helloworld.composite (original)
+++ tuscany/java/sca/itest/policy-security-basicauth/src/main/resources/helloworld.composite Mon Sep 15 01:07:58 2008
@@ -33,26 +33,14 @@
         <reference name="helloworldWS" requires="authentication">
             <binding.ws uri="http://localhost:8085/HelloWorldServiceWSComponent"/>
         </reference>
-        <reference name="helloworldJMS">
-            <binding.jms uri="jms:HelloWorldService"/>
-        </reference>
     </component>           
 
     <component name="HelloWorldServiceWSComponent">
-        <implementation.java class="helloworld.HelloWorldServiceImpl" />
+        <implementation.java class="helloworld.HelloWorldServiceImpl" requires="tuscany:identity"/>
         <service name="HelloWorldService" requires="authentication">
         	<interface.java interface="helloworld.HelloWorldService"/>
             <binding.ws uri="http://localhost:8085/HelloWorldServiceWSComponent"/>
         </service>
     </component>
     
-    <component name="HelloWorldServiceJMSComponent">
-        <implementation.java class="helloworld.HelloWorldServiceImpl" />
-        
-        <!--service name="HelloWorldService" requires="authentication"-->
-        <service name="HelloWorldService" >
-            <interface.java interface="helloworld.HelloWorldService"/>
-            <binding.jms/>
-        </service>
-    </component>    
 </composite>

Propchange: tuscany/java/sca/itest/policy-security-token/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Sep 15 01:07:58 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+target
+work

Added: tuscany/java/sca/itest/policy-security-token/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/pom.xml?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/pom.xml (added)
+++ tuscany/java/sca/itest/policy-security-token/pom.xml Mon Sep 15 01:07:58 2008
@@ -0,0 +1,106 @@
+<?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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-itest</artifactId>
+        <version>1.4-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>itest-policy-security-token</artifactId>
+    <name>Apache Tuscany SCA Policy Token Authentication Integration Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-api</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-tomcat</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency> 
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jms-runtime</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency> 
+        
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <version>4.1.1</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+           <groupId>org.apache.geronimo.specs</groupId>
+           <artifactId>geronimo-jms_1.1_spec</artifactId>
+           <version>1.1</version>
+           <scope>provided</scope>
+           <exclusions>
+               <exclusion>
+                   <groupId>org.apache.geronimo.specs</groupId>
+                   <artifactId>geronimo-jms_1.1_spec</artifactId>
+               </exclusion>
+           </exclusions>
+        </dependency>  
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>httpunit</groupId>
+            <artifactId>httpunit</artifactId>
+            <version>1.6.1</version>
+            <scope>test</scope>
+        </dependency>        
+
+    </dependencies>
+</project>

Propchange: tuscany/java/sca/itest/policy-security-token/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/itest/policy-security-token/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java (added)
+++ tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,42 @@
+/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+    
+    @Reference
+    protected HelloWorldService helloworldWS;
+    
+    @Reference
+    protected HelloWorldService helloworldJMS;    
+
+    public String getGreetings(String name) {
+        return "Hello " + 
+                helloworldWS.getGreetings(name) + 
+                helloworldJMS.getGreetings(name);
+    }
+
+}

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java (added)
+++ tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java Mon Sep 15 01:07:58 2008
@@ -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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+    public String getGreetings(String name);
+}

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java (added)
+++ tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,46 @@
+/*
+ * 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 helloworld;
+
+import javax.security.auth.Subject;
+
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+    @Context
+    protected RequestContext requestContext;
+    
+    public String getGreetings(String name) {
+        Subject subject = requestContext.getSecuritySubject();
+        
+        if (subject == null){
+            return "Hello " + name + " null subject";
+        } else {
+            return "Hello " + name + " " + subject.toString();
+        }
+    }
+
+}

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml (added)
+++ tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml Mon Sep 15 01:07:58 2008
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+    * 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.    
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" 
+             targetNamespace="http://itest/policy"
+    		 xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" 
+    		 xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+             xmlns:ip="http://itest/policy" >
+
+
+    <sca:policySet name="Axis2TokenAuthenticationPolicySet"
+                   provides="authentication"
+                   appliesTo="sca:binding.ws">
+                
+        <tuscany:axis2TokenAuthentication xmlns:foo="http://tuscany.apache.org/foo" tokenName="foo:myname"/>
+    </sca:policySet>
+    
+    <sca:policySet name="JMSTokenAuthenticationPolicySet"
+                   provides="authentication"
+                   appliesTo="sca:binding.jms">
+                
+        <tuscany:jmsTokenAuthentication xmlns:foo="http://tuscany.apache.org/foo" tokenName="foo:myname"/>
+    </sca:policySet>
+    
+    <sca:policySet name="ImplementationIdentityPolicySet"
+                    provides="tuscany:identity"
+                   appliesTo="sca:implementation.java">
+        <securityIdentity>
+            <useCallerIdentity/>
+        </securityIdentity>  
+    </sca:policySet>    
+      
+</definitions>
\ No newline at end of file

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite (added)
+++ tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite Mon Sep 15 01:07:58 2008
@@ -0,0 +1,56 @@
+<?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" 
+           targetNamespace="http://itest/policy"
+           xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+           xmlns:ip="http://itest/policy"
+           name="Helloworld">
+           
+    <component name="HelloWorldClientComponent">
+        <implementation.java class="helloworld.HelloWorldClientImpl"/>
+        <service name="HelloWorldService">
+            <interface.java interface="helloworld.HelloWorldService"/>
+            <binding.sca/>
+        </service>
+        <reference name="helloworldWS" requires="authentication">
+            <binding.ws uri="http://localhost:8085/HelloWorldServiceWSComponent"/>
+        </reference>
+        <reference name="helloworldJMS" requires="authentication">
+            <binding.jms uri="jms:HelloWorldService"/>
+        </reference>
+    </component>           
+
+    <component name="HelloWorldServiceWSComponent">
+        <implementation.java class="helloworld.HelloWorldServiceImpl" requires="tuscany:identity"/>
+        <service name="HelloWorldService" requires="authentication">
+        	<interface.java interface="helloworld.HelloWorldService"/>
+            <binding.ws uri="http://localhost:8085/HelloWorldServiceWSComponent"/>
+        </service>
+    </component>
+    
+    <component name="HelloWorldServiceJMSComponent">
+        <implementation.java class="helloworld.HelloWorldServiceImpl" requires="tuscany:identity"/>
+        <service name="HelloWorldService" requires="authentication">
+            <interface.java interface="helloworld.HelloWorldService"/>
+            <binding.jms/>
+        </service>
+    </component>    
+</composite>

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/helloworld.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties (added)
+++ tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties Mon Sep 15 01:07:58 2008
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as. 
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.RequestQueue = RequestQueue
+queue.ResponseQueue = ResponseQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/itest/policy-security-token/src/main/resources/jndi.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java (added)
+++ tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,115 @@
+/*
+ * 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.itest;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.Assert;
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.ws.security.util.Base64;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+public class TokenAuthTestCase {
+    private static SCANode node;
+    private static HelloWorldService service;
+
+    @BeforeClass
+    public static void init() throws Exception {
+        try {
+            SCANodeFactory factory = SCANodeFactory.newInstance();
+            node = factory.createSCANodeFromClassLoader("helloworld.composite", 
+                                                        TokenAuthTestCase.class.getClassLoader());
+            node.start();
+            
+            service = ((SCAClient)node).getService(HelloWorldService.class, "HelloWorldClientComponent");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @AfterClass
+    public static void destroy() throws Exception {
+        node.stop();
+    }
+    
+    @Test
+    //@Ignore
+    public void testViaSCAClient() {
+        String greetings = service.getGreetings("Simon");
+        System.out.println(">>>" + greetings);
+    } 
+    
+    @Test
+    @Ignore
+    public void testWSViaNonSCAClient() {
+        
+        try {
+            String token ="MyToken";
+            String encToken = Base64.encode(token.getBytes());
+            
+            String response = callService("http://L3AW203:8085/HelloWorldServiceWSComponent",
+                                          "<?xml version='1.0' encoding='UTF-8'?>" +
+                                            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + 
+                                             "<soapenv:Header>" + 
+                                               "<ns2:Token xmlns:ns2=\"http://helloworld/\">" + encToken + "</ns2:Token>" + 
+                                             "</soapenv:Header>" + 
+                                             "<soapenv:Body>" + 
+                                               "<ns2:getGreetings xmlns:ns2=\"http://helloworld/\">" + 
+                                                 "<arg0>Simon</arg0>" + 
+                                               "</ns2:getGreetings>" + 
+                                             "</soapenv:Body>" + 
+                                            "</soapenv:Envelope>" );
+            System.out.println(">>>" + response);
+        } catch(Exception ex) {
+            System.out.println(ex.toString());
+        }
+    } 
+    
+    @Test
+    @Ignore
+    public void testJMSViaNonSCAClient() {
+        // TODO
+    }
+    
+    public String callService(String url, String requestString) throws Exception {
+        System.out.println("Request = " + requestString);
+        WebConversation wc   = new WebConversation();
+        wc.setAuthorization("Me", "MyPasswd");
+        WebRequest request   = new PostMethodWebRequest( url, 
+                                                         new ByteArrayInputStream(requestString.getBytes("UTF-8")),"text/xml");
+        request.setHeaderField("SOAPAction", "");
+        WebResponse response = wc.getResource(request);
+        System.out.println("Response= " + response.getText());               
+        Assert.assertEquals(200, response.getResponseCode());
+        return response.getText(); 
+    }    
+}

Propchange: tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/itest/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/pom.xml?rev=695374&r1=695373&r2=695374&view=diff
==============================================================================
--- tuscany/java/sca/itest/pom.xml (original)
+++ tuscany/java/sca/itest/pom.xml Mon Sep 15 01:07:58 2008
@@ -106,6 +106,7 @@
                 <module>policy-security</module>
                 <module>policy-security-basicauth</module>
                 <module>policy-security-jsr250</module>
+                <module>policy-security-token</module>
                 <module>properties</module>
                 <module>recursive</module>
                 <module>recursive-multi-level</module>

Modified: tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd?rev=695374&r1=695373&r2=695374&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd (original)
+++ tuscany/java/sca/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd Mon Sep 15 01:07:58 2008
@@ -41,7 +41,7 @@
             <attribute name="requestConnection" type="QName"/>
             <attribute name="responseConnection" type="QName"/>
             <attribute name="operationProperties" type="QName"/>
-            <anyAttribute/>
+            <anyAttribute namespace="##any" processContents="lax"/>
          </extension>
       </complexContent>
    </complexType>

Propchange: tuscany/java/sca/modules/binding-jms-policy/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Sep 15 01:07:58 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: tuscany/java/sca/modules/binding-jms-policy/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/LICENSE?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/LICENSE (added)
+++ tuscany/java/sca/modules/binding-jms-policy/LICENSE Mon Sep 15 01:07:58 2008
@@ -0,0 +1,205 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+
+

Propchange: tuscany/java/sca/modules/binding-jms-policy/LICENSE
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/LICENSE
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tuscany/java/sca/modules/binding-jms-policy/NOTICE
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/NOTICE?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/NOTICE (added)
+++ tuscany/java/sca/modules/binding-jms-policy/NOTICE Mon Sep 15 01:07:58 2008
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: tuscany/java/sca/modules/binding-jms-policy/NOTICE
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/NOTICE
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tuscany/java/sca/modules/binding-jms-policy/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/pom.xml?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/pom.xml (added)
+++ tuscany/java/sca/modules/binding-jms-policy/pom.xml Mon Sep 15 01:07:58 2008
@@ -0,0 +1,69 @@
+<?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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>1.4-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>tuscany-binding-jms-policy</artifactId>
+    <name>Apache Tuscany Policy Model for JMS binding</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-contribution</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-assembly-xml</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-security</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>       
+    </dependencies>
+		
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+
+                <configuration>
+                    <instructions>
+                        <Bundle-Version>${tuscany.version}</Bundle-Version>
+                        <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jms.policy</Bundle-SymbolicName>
+                        <Bundle-Description>${pom.name}</Bundle-Description>
+                        <Export-Package>org.apache.tuscany.sca.binding.jms.policy*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Propchange: tuscany/java/sca/modules/binding-jms-policy/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/modules/binding-jms-policy/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java (added)
+++ tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,56 @@
+/*
+ * 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.jms.policy.authentication.token;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * Implementation for policies that could be injected as parameter
+ * into the axis2config.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSTokenAuthenticationPolicy implements Policy {
+    public static final QName JMS_TOKEN_AUTHENTICATION_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jmsTokenAuthentication");
+    public static final String JMS_TOKEN_AUTHENTICATION_TOKEN_NAME = "tokenName";
+
+    private QName tokenName;
+
+    public QName getTokenName() {
+        return tokenName;
+    }
+    
+    public void setTokenName(QName tokenName) {
+        this.tokenName = tokenName;
+    }
+    
+    public QName getSchemaName() {
+        return JMS_TOKEN_AUTHENTICATION_POLICY_QNAME;
+    }
+
+    public boolean isUnresolved() {
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+    }
+}

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java (added)
+++ tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,112 @@
+/*
+ * 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.jms.policy.authentication.token;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSTokenAuthenticationPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSTokenAuthenticationPolicy> {
+    
+    public QName getArtifactType() {
+        return JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_POLICY_QNAME;
+    }
+    
+    public JMSTokenAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+    }
+
+    
+    public JMSTokenAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+        JMSTokenAuthenticationPolicy policy = new JMSTokenAuthenticationPolicy();
+        int event = reader.getEventType();
+        QName name = null;
+        
+        while (reader.hasNext()) {
+            event = reader.getEventType();
+            switch (event) {
+                case START_ELEMENT : {
+                    name = reader.getName();
+                    if ( name.equals(getArtifactType()) ) {
+                        policy.setTokenName(getQName(reader, JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_TOKEN_NAME));
+                    } 
+                    break;
+                }
+            }
+            
+            if ( event == END_ELEMENT ) {
+                if ( getArtifactType().equals(reader.getName()) ) {
+                    break;
+                } 
+            }
+            
+            //Read the next element
+            if (reader.hasNext()) {
+                reader.next();
+            }
+        }
+         
+        return policy;
+    }
+
+    public void write(JMSTokenAuthenticationPolicy policy, XMLStreamWriter writer) 
+        throws ContributionWriteException, XMLStreamException {
+        String prefix = "tuscany";
+        writer.writeStartElement(prefix, 
+                                 getArtifactType().getLocalPart(),
+                                 getArtifactType().getNamespaceURI());
+        writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
+
+        if ( policy.getTokenName() != null ) {
+            writer.writeStartElement(prefix, 
+                                     JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_TOKEN_NAME,
+                                     getArtifactType().getNamespaceURI());
+            writer.writeCharacters(policy.getTokenName().toString());
+            writer.writeEndElement();
+        }      
+        
+        writer.writeEndElement();
+    }
+
+    public Class<JMSTokenAuthenticationPolicy> getModelType() {
+        return JMSTokenAuthenticationPolicy.class;
+    }
+
+    public void resolve(JMSTokenAuthenticationPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+    }
+    
+}

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java (added)
+++ tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.policy.authentication.token;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JMSTokenAuthenticationPolicyProviderFactory implements PolicyProviderFactory<JMSTokenAuthenticationPolicy> {
+    private ExtensionPointRegistry registry;
+    
+    public JMSTokenAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
+        super();
+        this.registry = registry;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+     */
+    public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+        return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+                                                        RuntimeComponentReference reference,
+                                                        Binding binding) {
+        return new JMSTokenAuthenticationReferencePolicyProvider(component, reference, binding);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+                                                      RuntimeComponentService service,
+                                                      Binding binding) {
+        return new JMSTokenAuthenticationServicePolicyProvider(component, service, binding);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+     */
+    public Class getModelType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java (added)
+++ tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,81 @@
+/*
+ * 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.jms.policy.authentication.token;
+
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Policy handler to handle PolicySet related to Logging with the QName
+ * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSTokenAuthenticationReferencePolicyInterceptor implements Interceptor {
+
+    private Invoker next;
+    private Operation operation;
+    private PolicySet policySet = null;
+    private String context;
+    private JMSTokenAuthenticationPolicy policy;
+
+    public JMSTokenAuthenticationReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+        super();
+        this.operation = operation;
+        this.policySet = policySet;
+        this.context = context;
+        init();
+    }
+
+    private void init() {
+        if (policySet != null) {
+            for (Object policyObject : policySet.getPolicies()){
+                if (policyObject instanceof JMSTokenAuthenticationPolicy){
+                    policy = (JMSTokenAuthenticationPolicy)policyObject;
+                    break;
+                }
+            }
+        }
+    }
+
+    public Message invoke(Message msg) {
+        // could call out here to some 3rd party system to get credentials
+        
+        if ( policy.getTokenName() != null){
+    
+            // add header to Tuscany message
+            msg.getHeaders().put(policy.getTokenName().toString(),
+                                 "SomeJMSAuthorizationToken");  
+        }
+        
+        return getNext().invoke(msg);
+    }
+
+    public Invoker getNext() {
+        return next;
+    }
+
+    public void setNext(Invoker next) {
+        this.next = next;
+    }
+}

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java?rev=695374&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java (added)
+++ tuscany/java/sca/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java Mon Sep 15 01:07:58 2008
@@ -0,0 +1,90 @@
+/*
+ * 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.jms.policy.authentication.token;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JMSTokenAuthenticationReferencePolicyProvider implements PolicyProvider {
+    private RuntimeComponent component;
+    private RuntimeComponentReference reference;
+    private Binding binding;
+
+    public JMSTokenAuthenticationReferencePolicyProvider(RuntimeComponent component,
+                                             RuntimeComponentReference reference,
+                                             Binding binding) {
+        super();
+        this.component = component;
+        this.reference = reference;
+        this.binding = binding;
+    }
+
+    private PolicySet findPolicySet() {
+        if (binding instanceof PolicySetAttachPoint) {
+            List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+            for (PolicySet ps : policySets) {
+                for (Object p : ps.getPolicies()) {
+                    if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
+                        return ps;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    private String getContext() {
+        return "component.reference: " + component.getURI()
+            + "#"
+            + reference.getName()
+            + "("
+            + binding.getClass().getName()
+            + ")";
+    }
+    
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+     */
+    public Interceptor createInterceptor(Operation operation) {
+        PolicySet ps = findPolicySet();
+        return ps == null ? null : new JMSTokenAuthenticationReferencePolicyInterceptor(getContext(), operation, ps);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+     */
+    public String getPhase() {
+        return Phase.REFERENCE_POLICY;
+    }
+
+}