cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Make sure a null mapped principal is not stored in the IdentityCache
Date Fri, 21 Aug 2015 15:50:03 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 636424b0b -> 5a5d71988


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/5a5d7198
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5a5d7198
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5a5d7198

Branch: refs/heads/3.0.x-fixes
Commit: 5a5d71988c723e70a810ae7aba1b07706473ffb6
Parents: 636424b
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Aug 21 16:35:00 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Aug 21 16:44:31 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/5a5d7198/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 53d7df8..d98d161 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/5a5d7198/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 26739c8..f169e39 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()


Mime
View raw message