summaryrefslogtreecommitdiffstats
path: root/java/sca/samples
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/samples
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/samples')
-rw-r--r--java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java10
-rw-r--r--java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java10
2 files changed, 12 insertions, 8 deletions
diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
index 2ebcc8470a..5c692df4ec 100644
--- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
+++ b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
@@ -7,6 +7,7 @@ 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;
+import org.apache.tuscany.sca.policy.SecurityUtil;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -46,10 +47,11 @@ public class CheckingsDeptAuthPolicyInterceptor implements Interceptor {
Object msgBody = msg.getBody();
if (msgBody instanceof Object[]) {
Object args[] = (Object[])msg.getBody();
- if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) {
- BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL),
- (String)args[0]);
- }
+ Principal principal = SecurityUtil.getPrincipal(msg);
+ if (principal != null){
+ BigbankCheckingsAcl.authorize(principal,
+ (String)args[0]);
+ }
}
Message responseMsg = null;
diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
index 5668fa23b9..b023adf907 100644
--- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
+++ b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
@@ -23,6 +23,7 @@ import java.security.Principal;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.SecurityUtil;
import org.apache.tuscany.sca.policy.util.PolicyHandler;
/**
@@ -39,10 +40,11 @@ public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler {
if ( context[count] instanceof Message ) {
Message msg = (Message)context[count];
Object args[] = (Object[])msg.getBody();
- if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) {
- BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL),
- (String)args[0]);
- }
+ Principal principal = SecurityUtil.getPrincipal(msg);
+ if (principal != null){
+ BigbankCheckingsAcl.authorize(principal,
+ (String)args[0]);
+ }
}
}
}