cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Pass roles through to the ClaimsHandler if available
Date Wed, 17 Dec 2014 11:13:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 3c4055e82 -> 5000b9dd5


Pass roles through to the ClaimsHandler if available


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5000b9dd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5000b9dd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5000b9dd

Branch: refs/heads/3.0.x-fixes
Commit: 5000b9dd5e3396e491f08dac8cd947757fd77ca4
Parents: 3c4055e
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Dec 17 10:50:35 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Dec 17 10:54:42 2014 +0000

----------------------------------------------------------------------
 .../java/org/apache/cxf/sts/claims/ClaimsParameters.java | 10 ++++++++++
 .../org/apache/cxf/sts/operation/AbstractOperation.java  |  5 +++--
 .../java/org/apache/cxf/sts/request/ReceivedToken.java   | 11 ++++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5000b9dd/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
index 9bb2a58..32b30ea 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
@@ -22,6 +22,7 @@ package org.apache.cxf.sts.claims;
 
 import java.security.Principal;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.ws.WebServiceContext;
 
@@ -41,6 +42,7 @@ public class ClaimsParameters {
     private STSPropertiesMBean stsProperties;
     private EncryptionProperties encryptionProperties;
     private Principal principal;
+    private Set<Principal> roles;
     private WebServiceContext webServiceContext;
     private KeyRequirements keyRequirements;
     private TokenRequirements tokenRequirements;
@@ -113,6 +115,14 @@ public class ClaimsParameters {
         return principal;
     }
     
+    public Set<Principal> getRoles() {
+        return roles;
+    }
+
+    public void setRoles(Set<Principal> roles) {
+        this.roles = roles;
+    }
+    
     public void setAdditionalProperties(Map<String, Object> additionalProperties) {
         this.additionalProperties = additionalProperties;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/5000b9dd/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
index 973d189..997369f 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
@@ -616,9 +616,10 @@ public abstract class AbstractOperation {
                 try {
                     tokenResponse = tokenValidator.validateToken(validatorParameters);
                     token = tokenResponse.getToken();
-                    // The parsed principal is set if available. It's up to other components
to
-                    // deal with the STATE of the validation
+                    // The parsed principal/roles is set if available. It's up to other 
+                    // components to deal with the STATE of the validation
                     token.setPrincipal(tokenResponse.getPrincipal());
+                    token.setRoles(tokenResponse.getRoles());
                 } catch (RuntimeException ex) {
                     LOG.log(Level.WARNING, "Failed to validate the token", ex);
                     token.setState(STATE.INVALID);

http://git-wip-us.apache.org/repos/asf/cxf/blob/5000b9dd/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/ReceivedToken.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/ReceivedToken.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/ReceivedToken.java
index 4a80a0d..678b3ef 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/ReceivedToken.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/ReceivedToken.java
@@ -19,13 +19,13 @@
 package org.apache.cxf.sts.request;
 
 import java.security.Principal;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.sts.QNameConstants;
 import org.apache.cxf.ws.security.sts.provider.STSException;
@@ -45,6 +45,7 @@ public class ReceivedToken {
     private String tokenContext; // WS-Security, OnBehalfOf, ActAs
     private STATE state = STATE.NONE;
     private Principal principal;
+    private Set<Principal> roles;
     
     public enum STATE { VALID, INVALID, CANCELLED, EXPIRED, NONE };
     
@@ -134,4 +135,12 @@ public class ReceivedToken {
         this.principal = principal;
     }
     
+    public Set<Principal> getRoles() {
+        return roles;
+    }
+
+    public void setRoles(Set<Principal> roles) {
+        this.roles = roles;
+    }
+    
 }
\ No newline at end of file


Mime
View raw message