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 2015/08/21 17:35:41 UTC
cxf git commit: Make sure a null mapped principal is not stored in
the IdentityCache
Repository: cxf
Updated Branches:
refs/heads/master c7a8af405 -> 95a74475c
Make sure a null mapped principal is not stored in the IdentityCache
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/95a74475
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/95a74475
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/95a74475
Branch: refs/heads/master
Commit: 95a74475cdab11e77bcfc179709561bb2ae1cff3
Parents: c7a8af4
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Aug 21 16:35:00 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Aug 21 16:35:36 2015 +0100
----------------------------------------------------------------------
.../org/apache/cxf/sts/cache/AbstractIdentityCache.java | 10 ++++++++++
.../java/org/apache/cxf/sts/claims/ClaimsManager.java | 3 +--
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/95a74475/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
index 4c3ef25..bd8fda7 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
@@ -68,6 +68,16 @@ public abstract class AbstractIdentityCache implements IdentityCache, IdentityMa
// User identity of target realm not cached yet
targetPrincipal = this.identityMapper.mapPrincipal(
sourceRealm, sourcePrincipal, targetRealm);
+
+ if (targetPrincipal == null || targetPrincipal.getName() == null) {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Failed to map user '" + sourcePrincipal.getName()
+ + "' [" + sourceRealm + "] to realm '"
+ + targetRealm + "'");
+ }
+ return null;
+ }
+
// Add the identity for target realm to the cached entry
identities.put(targetRealm, targetPrincipal.getName());
http://git-wip-us.apache.org/repos/asf/cxf/blob/95a74475/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
index b22ecfc..14a4cf2 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
@@ -196,8 +196,7 @@ public class ClaimsManager {
LOG.log(Level.WARNING, "Null. Failed to map user '" + parameters.getPrincipal().getName()
+ "' [" + parameters.getRealm() + "] to realm '"
+ handlerRealmSupport.getHandlerRealm() + "'");
- throw new STSException("Failed to map user for claims handler",
- STSException.REQUEST_FAILED);
+ continue;
}
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Principal '" + targetPrincipal.getName()