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 18:01:35 UTC
[1/4] cxf git commit: Recording .gitmergeinfo Changes
Repository: cxf
Updated Branches:
refs/heads/2.7.x-fixes 43334cb81 -> 986cae31a
Recording .gitmergeinfo Changes
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a8dbdc4d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a8dbdc4d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a8dbdc4d
Branch: refs/heads/2.7.x-fixes
Commit: a8dbdc4d838f295be4aa44a5532a462d2d89c542
Parents: 43334cb
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Aug 21 16:55:20 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Aug 21 16:55:20 2015 +0100
----------------------------------------------------------------------
.gitmergeinfo | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/a8dbdc4d/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 25cf4b6..2be1028 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -1771,6 +1771,7 @@ B c7b9638cf60cc38342828192f5ce80e4a81ce9a3
B c7ba4fe2ee916c54b542e4b33466b4db0aef24be
B c7bf868270c0cdf6f794d3e2227f16649ece82fa
B c7f4ce23ac7454dc383eb5f0c5d3f6f55aee95e8
+B c81e8d440a5300e3b9390e2b8bb7b3aa8c70ad61
B c86b32063506fe346c6b9c435647f6ced93bdc67
B c8847b7463f4f7beec2995458cdb58173c672f57
B c886ce37f9bbbb441b97a8a01f7b02a67396f1a2
@@ -2124,6 +2125,7 @@ B ed0fc365473d395c241232dfa4d10f15d8f90c3c
B ed23f73ee4ba3f0e2066c62d892aaabf2fae14ad
B ed66e7d56758e60c96091b208c81c2f2b26bb61f
B ed8ac50116f225ad4a71b888b7e4f44c1f81991a
+B edbadd5a9e980694106979e85221714e600f8b7c
B eec9d19c2bd836b28d60ec826f3ed0bd9e67e977
B eecaebb4b0ea89fc2aa94acb6464f0e913b8b223
B ef319d587510c92c693abe5d4c7f565ff84a1490
@@ -2132,6 +2134,7 @@ B ef89633ac7154afad1d3f17dc438e3dcbd7c3633
B efa91109b8d80999b64aaab98c31f2cc85f85e81
B efbfc2fa90b21e7766f85cb36445146e5c516061
B efc7e27a5c4f368d7f54a8053504026d71d722a6
+B efe0365564cf7c7f3d759e0a139bb38a5fc481ef
B f01417a170b12d3c43d370dad551f84869501254
B f019b583f4a7b3e8e2de074cb454e5629a85b530
B f0939c91e9adaee10baac0b8960135b96e35843c
[3/4] cxf git commit: Recording .gitmergeinfo Changes
Posted by co...@apache.org.
Recording .gitmergeinfo Changes
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7e6f1e0d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7e6f1e0d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7e6f1e0d
Branch: refs/heads/2.7.x-fixes
Commit: 7e6f1e0d57d842d365a3ff0e75c1f036ef8f3867
Parents: 90c0089
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Aug 21 16:56:00 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Aug 21 16:56:00 2015 +0100
----------------------------------------------------------------------
.gitmergeinfo | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/7e6f1e0d/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 2be1028..63e8c3d 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -2556,6 +2556,7 @@ M 59549505ff5b4baa6e82ad5a1df65445616c18ea
M 596988d7376970130594e2dbd42f9e354b78b4e6
M 5995149d449ebbfdc4d22717409fe9d5e86da48b
M 59e67563adce861d6b2a723b5c6526fd7374184b
+M 5a5d71988c723e70a810ae7aba1b07706473ffb6
M 5a5dbe76f2e2263e1e9c524088ce92bdf61293f6
M 5a9bcf36ea3c15e89357a61161c51830583ac526
M 5ae494dc9868552ea70b7fdac70e59c066d64317
[4/4] cxf git commit: Fixing merge
Posted by co...@apache.org.
Fixing merge
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/986cae31
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/986cae31
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/986cae31
Branch: refs/heads/2.7.x-fixes
Commit: 986cae31ac3532fcdbd375a7bdd1fc7fb5477dd7
Parents: 7e6f1e0
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Aug 21 17:01:27 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Aug 21 17:01:27 2015 +0100
----------------------------------------------------------------------
.../cxf/sts/cache/AbstractIdentityCache.java | 147 -------------------
.../cxf/sts/cache/EHCacheIdentityCache.java | 10 ++
.../cxf/sts/cache/MemoryIdentityCache.java | 10 ++
3 files changed, 20 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/986cae31/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
deleted file mode 100644
index d98d161..0000000
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.cxf.sts.cache;
-
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.management.ManagedComponent;
-import org.apache.cxf.sts.IdentityMapper;
-import org.apache.wss4j.common.principal.CustomTokenPrincipal;
-
-public abstract class AbstractIdentityCache implements IdentityCache, IdentityMapper, ManagedComponent {
-
- private static final Logger LOG = LogUtils.getL7dLogger(AbstractIdentityCache.class);
-
- private final IdentityMapper identityMapper;
- private final Bus bus;
- private MemoryIdentityCacheStatistics statistics;
-
- public AbstractIdentityCache(IdentityMapper identityMapper) {
- this(null, identityMapper);
- }
-
- public AbstractIdentityCache(Bus bus, IdentityMapper identityMapper) {
- this.identityMapper = identityMapper;
- this.bus = bus;
- }
-
- public Principal mapPrincipal(String sourceRealm,
- Principal sourcePrincipal, String targetRealm) {
-
- Principal targetPrincipal = null;
- Map<String, String> identities = this.get(sourcePrincipal.getName(), sourceRealm);
- if (identities != null) {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.fine("Identities found for '" + sourcePrincipal.getName() + "@" + sourceRealm + "'");
- }
- // Identities object found for key sourceUser@sourceRealm
- String targetUser = identities.get(targetRealm);
- if (targetUser == null) {
- getStatistics().increaseCacheMiss();
- if (LOG.isLoggable(Level.FINE)) {
- LOG.fine("No mapping found for realm " + targetRealm + " of user '"
- + sourcePrincipal.getName() + "@" + sourceRealm + "'");
- }
- // 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());
-
- // Verify whether target user has cached some identities already
- Map<String, String> cachedItem = this.get(targetPrincipal.getName(), targetRealm);
- if (cachedItem != null) {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.fine("Merging mappings for '" + sourcePrincipal.getName() + "@" + sourceRealm + "'");
- }
- //Identities already cached for targetUser@targetRealm key pair
- //Merge into identities object
- this.mergeMap(identities, cachedItem);
- }
- this.add(targetPrincipal.getName(), targetRealm, identities);
- } else {
- getStatistics().increaseCacheHit();
- if (LOG.isLoggable(Level.INFO)) {
- LOG.info("Mapping '" + sourcePrincipal.getName() + "@" + sourceRealm + "' to '"
- + targetUser + "@" + targetRealm + "' cached");
- }
- targetPrincipal = new CustomTokenPrincipal(targetUser);
- }
-
- } else {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.fine("No mapping found for realm " + targetRealm + " of user '"
- + sourcePrincipal.getName() + "@" + sourceRealm + "'");
- }
- getStatistics().increaseCacheMiss();
-
- // Identities object NOT found for key sourceUser@sourceRealm
- targetPrincipal = this.identityMapper.mapPrincipal(
- sourceRealm, sourcePrincipal, targetRealm);
- identities = new HashMap<String, String>();
- identities.put(sourceRealm, sourcePrincipal.getName());
- identities.put(targetRealm, targetPrincipal.getName());
- this.add(targetPrincipal.getName(), targetRealm, identities);
- this.add(sourcePrincipal.getName(), sourceRealm, identities);
- }
- return targetPrincipal;
- }
-
- public MemoryIdentityCacheStatistics getStatistics() {
- if (statistics == null) {
- this.statistics = new MemoryIdentityCacheStatistics(bus, this);
- }
- return statistics;
- }
-
- public void setStatistics(MemoryIdentityCacheStatistics stats) {
- this.statistics = stats;
- }
-
- private void mergeMap(Map<String, String> to, Map<String, String> from) {
- for (Map.Entry<String, String> entry : from.entrySet()) {
- to.put(entry.getKey(), entry.getValue());
- }
- for (Map.Entry<String, String> entry : to.entrySet()) {
- from.put(entry.getKey(), entry.getValue());
- }
- }
-
- protected Bus getBus() {
- return bus;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/cxf/blob/986cae31/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/EHCacheIdentityCache.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/EHCacheIdentityCache.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/EHCacheIdentityCache.java
index 64a825f..28be384 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/EHCacheIdentityCache.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/EHCacheIdentityCache.java
@@ -176,6 +176,16 @@ public class EHCacheIdentityCache
// 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/986cae31/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/MemoryIdentityCache.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/MemoryIdentityCache.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/MemoryIdentityCache.java
index e10665e..72d08e1 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/MemoryIdentityCache.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/MemoryIdentityCache.java
@@ -158,6 +158,16 @@ public class MemoryIdentityCache implements IdentityCache, IdentityMapper, Manag
// 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());
[2/4] cxf git commit: Make sure a null mapped principal is not stored
in the IdentityCache
Posted by co...@apache.org.
Make sure a null mapped principal is not stored in the IdentityCache
Conflicts:
services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/90c0089c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/90c0089c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/90c0089c
Branch: refs/heads/2.7.x-fixes
Commit: 90c0089cdd13ae7a1269f20d248f6704aa1d4c43
Parents: a8dbdc4
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:56:00 2015 +0100
----------------------------------------------------------------------
.../cxf/sts/cache/AbstractIdentityCache.java | 147 +++++++++++++++++++
.../apache/cxf/sts/claims/ClaimsManager.java | 3 +-
2 files changed, 148 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/90c0089c/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
new file mode 100644
index 0000000..d98d161
--- /dev/null
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/AbstractIdentityCache.java
@@ -0,0 +1,147 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.sts.cache;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.management.ManagedComponent;
+import org.apache.cxf.sts.IdentityMapper;
+import org.apache.wss4j.common.principal.CustomTokenPrincipal;
+
+public abstract class AbstractIdentityCache implements IdentityCache, IdentityMapper, ManagedComponent {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(AbstractIdentityCache.class);
+
+ private final IdentityMapper identityMapper;
+ private final Bus bus;
+ private MemoryIdentityCacheStatistics statistics;
+
+ public AbstractIdentityCache(IdentityMapper identityMapper) {
+ this(null, identityMapper);
+ }
+
+ public AbstractIdentityCache(Bus bus, IdentityMapper identityMapper) {
+ this.identityMapper = identityMapper;
+ this.bus = bus;
+ }
+
+ public Principal mapPrincipal(String sourceRealm,
+ Principal sourcePrincipal, String targetRealm) {
+
+ Principal targetPrincipal = null;
+ Map<String, String> identities = this.get(sourcePrincipal.getName(), sourceRealm);
+ if (identities != null) {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Identities found for '" + sourcePrincipal.getName() + "@" + sourceRealm + "'");
+ }
+ // Identities object found for key sourceUser@sourceRealm
+ String targetUser = identities.get(targetRealm);
+ if (targetUser == null) {
+ getStatistics().increaseCacheMiss();
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("No mapping found for realm " + targetRealm + " of user '"
+ + sourcePrincipal.getName() + "@" + sourceRealm + "'");
+ }
+ // 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());
+
+ // Verify whether target user has cached some identities already
+ Map<String, String> cachedItem = this.get(targetPrincipal.getName(), targetRealm);
+ if (cachedItem != null) {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Merging mappings for '" + sourcePrincipal.getName() + "@" + sourceRealm + "'");
+ }
+ //Identities already cached for targetUser@targetRealm key pair
+ //Merge into identities object
+ this.mergeMap(identities, cachedItem);
+ }
+ this.add(targetPrincipal.getName(), targetRealm, identities);
+ } else {
+ getStatistics().increaseCacheHit();
+ if (LOG.isLoggable(Level.INFO)) {
+ LOG.info("Mapping '" + sourcePrincipal.getName() + "@" + sourceRealm + "' to '"
+ + targetUser + "@" + targetRealm + "' cached");
+ }
+ targetPrincipal = new CustomTokenPrincipal(targetUser);
+ }
+
+ } else {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("No mapping found for realm " + targetRealm + " of user '"
+ + sourcePrincipal.getName() + "@" + sourceRealm + "'");
+ }
+ getStatistics().increaseCacheMiss();
+
+ // Identities object NOT found for key sourceUser@sourceRealm
+ targetPrincipal = this.identityMapper.mapPrincipal(
+ sourceRealm, sourcePrincipal, targetRealm);
+ identities = new HashMap<String, String>();
+ identities.put(sourceRealm, sourcePrincipal.getName());
+ identities.put(targetRealm, targetPrincipal.getName());
+ this.add(targetPrincipal.getName(), targetRealm, identities);
+ this.add(sourcePrincipal.getName(), sourceRealm, identities);
+ }
+ return targetPrincipal;
+ }
+
+ public MemoryIdentityCacheStatistics getStatistics() {
+ if (statistics == null) {
+ this.statistics = new MemoryIdentityCacheStatistics(bus, this);
+ }
+ return statistics;
+ }
+
+ public void setStatistics(MemoryIdentityCacheStatistics stats) {
+ this.statistics = stats;
+ }
+
+ private void mergeMap(Map<String, String> to, Map<String, String> from) {
+ for (Map.Entry<String, String> entry : from.entrySet()) {
+ to.put(entry.getKey(), entry.getValue());
+ }
+ for (Map.Entry<String, String> entry : to.entrySet()) {
+ from.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ protected Bus getBus() {
+ return bus;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cxf/blob/90c0089c/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 e536036..26a91d7 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
@@ -195,8 +195,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()