cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] git commit: More work on CXF-5572
Date Thu, 20 Feb 2014 17:02:23 GMT
More work on CXF-5572


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

Branch: refs/heads/master
Commit: 3085f0fb44f1b7655bcc83019be20890aa9337a3
Parents: 1823faf
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Feb 20 17:01:52 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Feb 20 17:01:52 2014 +0000

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/WSS4JUtils.java       | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3085f0fb/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 c4dca26..4f11167 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
@@ -19,6 +19,7 @@
 package org.apache.cxf.ws.security.wss4j;
 
 import java.io.IOException;
+import java.math.BigInteger;
 import java.net.URL;
 import java.security.Key;
 import java.util.Date;
@@ -43,6 +44,7 @@ import org.apache.wss4j.common.cache.ReplayCacheFactory;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.utils.Base64;
 
 /**
  * Some common functionality that can be shared between the WSS4JInInterceptor and the
@@ -92,12 +94,9 @@ public final class WSS4JUtils {
                 if (replayCache == null) {
                     String cacheKey = instanceKey;
                     if (info.getName() != null) {
-                        int hashcode = info.getName().toString().hashCode();
-                        if (hashcode < 0) {
-                            cacheKey += info.getName().toString().hashCode();
-                        } else {
-                            cacheKey += "-" + info.getName().toString().hashCode();
-                        }
+                        int hashCode = info.getName().toString().hashCode();
+                        cacheKey +=
+                            "-" + Base64.encode(BigInteger.valueOf((long)hashCode));
                     }
                     URL configFile = getConfigFileURL(message);
 
@@ -160,12 +159,9 @@ public final class WSS4JUtils {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
                 String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
                 if (info.getName() != null) {
-                    int hashcode = info.getName().toString().hashCode();
-                    if (hashcode < 0) {
-                        cacheKey += info.getName().toString().hashCode();
-                    } else {
-                        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);


Mime
View raw message