summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-jms-runtime/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-09-24 08:13:02 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-09-24 08:13:02 +0000
commit8d6c3f989bb2f359091468534730080425afa8c4 (patch)
tree986a29d3ef78d0b960ddb4dc98e15adc831ffe84 /java/sca/modules/binding-jms-runtime/src
parent9f462538f3ac1e5522a87206a0668ecdecc9e3c4 (diff)
Change message getHeaders() operation to return a list, remove the QoS context and change various tests to take account of this assuming that the security information is now passed in the header. This pass the security context is not consolidated into a single subject. The tests that used to pass just a principal still do. Also add a delivery mode JMS policy test. Add some ignores.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@698457 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-jms-runtime/src')
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java10
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java14
2 files changed, 20 insertions, 4 deletions
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
index cfa099e875..9c5fba5de6 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
@@ -30,6 +30,7 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.naming.NamingException;
+import javax.security.auth.Subject;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
@@ -42,6 +43,8 @@ import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.SecurityUtil;
+import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -401,8 +404,11 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
}
if (jmsTokenAuthenticationPolicy != null) {
- String token = (String)tuscanyMsg.getHeaders().get(jmsTokenAuthenticationPolicy.getTokenName().toString());
- jmsMsg.setStringProperty(jmsTokenAuthenticationPolicy.getTokenName().toString(), token);
+ Subject subject = SecurityUtil.getSubject(tuscanyMsg);
+ TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
+ if (principal != null){
+ jmsMsg.setStringProperty(jmsTokenAuthenticationPolicy.getTokenName().toString(), principal.getName());
+ }
}
}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
index f28c85f160..87b1bb21e2 100644
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
+++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
@@ -32,6 +32,7 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.NamingException;
+import javax.security.auth.Subject;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
@@ -43,6 +44,8 @@ import org.apache.tuscany.sca.core.invocation.MessageImpl;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.SecurityUtil;
+import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -205,8 +208,15 @@ public class JMSBindingListener implements MessageListener {
if (jmsTokenAuthenticationPolicy != null) {
String token = requestJMSMsg.getStringProperty(jmsTokenAuthenticationPolicy.getTokenName().toString());
- tuscanyMsg.getHeaders().put(jmsTokenAuthenticationPolicy.getTokenName().toString(),
- token);
+
+ Subject subject = SecurityUtil.getSubject(tuscanyMsg);
+ TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
+
+ if (principal == null){
+ principal = new TokenPrincipal(token);
+ subject.getPrincipals().add(principal);
+ }
+
}
}