You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2014/12/17 11:50:57 UTC
cxf git commit: Pass roles through to the ClaimsHandler if available
Repository: cxf
Updated Branches:
refs/heads/master b37a59a6a -> a40441153
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/a4044115
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a4044115
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a4044115
Branch: refs/heads/master
Commit: a404411535fd27d16cbfa7a14891f9db3d90d567
Parents: b37a59a
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Dec 17 10:50:35 2014 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Dec 17 10:50:35 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/a4044115/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/a4044115/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/a4044115/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