summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/policy-security
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-26 23:44:59 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-26 23:44:59 +0000
commit71a7cba384b8ae7f4578fb9ab1f725d5ce616074 (patch)
tree98bbc7c066d037a8d9ea1fea7a3ccfa64419ab11 /branches/sca-java-1.x/modules/policy-security
parent01a38d872dc2692d2a31f07f9c8f8098aa078853 (diff)
Merge all changes from 1.5.2 branch into trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830026 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/policy-security')
-rw-r--r--branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java42
1 files changed, 15 insertions, 27 deletions
diff --git a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
index c1fab9efe4..e783d77c97 100644
--- a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
+++ b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
@@ -27,7 +27,6 @@ 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;
-import org.osoa.sca.ServiceRuntimeException;
/**
@@ -52,7 +51,14 @@ public class BasicAuthenticationServicePolicyInterceptor implements Interceptor
}
private void init() {
-
+ if (policySet != null) {
+ for (Object policyObject : policySet.getPolicies()){
+ if (policyObject instanceof BasicAuthenticationPolicy){
+ policy = (BasicAuthenticationPolicy)policyObject;
+ break;
+ }
+ }
+ }
}
public Message invoke(Message msg) {
@@ -60,35 +66,17 @@ public class BasicAuthenticationServicePolicyInterceptor implements Interceptor
Subject subject = SecurityUtil.getSubject(msg);
BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
BasicAuthenticationPrincipal.class);
- boolean authenticated = false;
-
+
if (principal != null){
- System.out.println("Authenticating user: " +
- principal.getName());
+ System.out.println("Username: " +
+ principal.getName() +
+ " Password: " +
+ principal.getPassword());
// could call out here to some 3rd party system to do whatever you
- // need to do do with username and password. For this very simple
- // interceptor just check that the credentials match crendentials in
- // the policy
-
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof BasicAuthenticationPolicy){
- BasicAuthenticationPolicy policy = (BasicAuthenticationPolicy)policyObject;
-
- if (policy.getUserName().equals(principal.getName())){
- if (policy.getPassword().equals(principal.getPassword())){
- authenticated = true;
- }
- }
- }
- }
- }
- }
-
- if (authenticated == false){
- throw new ServiceRuntimeException("User: " + principal.getName() + " cannot be authenticated");
+ // need to do do with username and password
+
}
return getNext().invoke(msg);