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/02/20 18:31:44 UTC

git commit: More work on CXF-5572

Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 09c7b2f67 -> 4649faa2b


More work on CXF-5572

Conflicts:
	rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java


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

Branch: refs/heads/2.7.x-fixes
Commit: 4649faa2b868cf72ab785159a95955a42c2b2228
Parents: 09c7b2f
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Feb 20 17:01:52 2014 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Feb 20 17:31:31 2014 +0000

----------------------------------------------------------------------
 .../apache/cxf/ws/security/cache/EHCacheManagerHolder.java    | 2 +-
 .../cxf/ws/security/policy/interceptors/NegotiationUtils.java | 6 +++++-
 .../java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java     | 7 ++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4649faa2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/cache/EHCacheManagerHolder.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/cache/EHCacheManagerHolder.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/cache/EHCacheManagerHolder.java
index 5981d41..3b343b8 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/cache/EHCacheManagerHolder.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/cache/EHCacheManagerHolder.java
@@ -75,7 +75,7 @@ public final class EHCacheManagerHolder {
         CacheConfiguration cc = cacheManager.getConfiguration().getCacheConfigurations().get(key);
         if (cc == null && key.contains("-")) {
             cc = cacheManager.getConfiguration().getCacheConfigurations().get(
-                    key.substring(0, key.lastIndexOf('-') - 1));
+                    key.substring(0, key.lastIndexOf('-')));
         }
         if (cc == null) {
             cc = cacheManager.getConfiguration().getDefaultCacheConfiguration();

http://git-wip-us.apache.org/repos/asf/cxf/blob/4649faa2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
index 9358cf5..82aee34 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.ws.security.policy.interceptors;
 
+import java.math.BigInteger;
 import java.util.Collection;
 import java.util.List;
 
@@ -66,6 +67,7 @@ import org.apache.ws.security.conversation.ConversationException;
 import org.apache.ws.security.handler.WSHandlerConstants;
 import org.apache.ws.security.handler.WSHandlerResult;
 import org.apache.ws.security.message.token.SecurityContextToken;
+import org.apache.xml.security.utils.Base64;
 
 /**
  * This is a collection of utility methods for use in negotiation exchanges such as WS-SecureConversation 
@@ -112,7 +114,9 @@ public final class NegotiationUtils {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
                 String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
                 if (info.getName() != null) {
-                    cacheKey += "-" + info.getName().toString().hashCode();
+                    int hashCode = info.getName().toString().hashCode();
+                    cacheKey +=
+                        "-" + Base64.encode(BigInteger.valueOf((long)hashCode));
                 }
                 tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
                 info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);

http://git-wip-us.apache.org/repos/asf/cxf/blob/4649faa2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
index 8a3d2dd..5407a4e 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
@@ -18,9 +18,11 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -32,6 +34,7 @@ import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSSecurityEngineResult;
 import org.apache.ws.security.WSSecurityException;
 import org.apache.ws.security.cache.ReplayCache;
+import org.apache.xml.security.utils.Base64;
 
 /**
  * Some common functionality that can be shared between the WSS4JInInterceptor and the
@@ -97,7 +100,9 @@ public final class WSS4JUtils {
                     ReplayCacheFactory replayCacheFactory = ReplayCacheFactory.newInstance();
                     String cacheKey = instanceKey;
                     if (info.getName() != null) {
-                        cacheKey += "-" + info.getName().toString().hashCode();
+                        int hashCode = info.getName().toString().hashCode();
+                        cacheKey +=
+                            "-" + Base64.encode(BigInteger.valueOf((long)hashCode));
                     }
                     replayCache = replayCacheFactory.newReplayCache(cacheKey, message);
                     info.setProperty(instanceKey, replayCache);