cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1346937 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/ rt/ws/secur...
Date Wed, 06 Jun 2012 15:16:48 GMT
Author: coheigea
Date: Wed Jun  6 15:16:47 2012
New Revision: 1346937

URL: http://svn.apache.org/viewvc?rev=1346937&view=rev
Log:
[CXF-4364] - Keep TokenStore and ReplayCache instances per-endpoint instead of per-bus

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/KerberosTokenInterceptorProvider.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
    cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
    cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/SecurityTestUtil.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
Wed Jun  6 15:16:47 2012
@@ -100,10 +100,11 @@ public class IssuedTokenInterceptorProvi
             }
             if (tokenStore == null) {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
-                tokenStore = 
-                    tokenStoreFactory.newTokenStore(
-                        SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, message
-                    );
+                String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+                if (info.getName() != null) {
+                    cacheKey += "-" + info.getName().toString().hashCode();
+                }
+                tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
                 info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
             }
             return tokenStore;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/KerberosTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/KerberosTokenInterceptorProvider.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/KerberosTokenInterceptorProvider.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/KerberosTokenInterceptorProvider.java
Wed Jun  6 15:16:47 2012
@@ -85,10 +85,11 @@ public class KerberosTokenInterceptorPro
             }
             if (tokenStore == null) {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
-                tokenStore = 
-                    tokenStoreFactory.newTokenStore(
-                        SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, message
-                    );
+                String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+                if (info.getName() != null) {
+                    cacheKey += "-" + info.getName().toString().hashCode();
+                }
+                tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
                 info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
             }
             return tokenStore;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
Wed Jun  6 15:16:47 2012
@@ -105,10 +105,11 @@ final class NegotiationUtils {
             }
             if (tokenStore == null) {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
-                tokenStore = 
-                    tokenStoreFactory.newTokenStore(
-                        SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, message
-                    );
+                String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+                if (info.getName() != null) {
+                    cacheKey += "-" + info.getName().toString().hashCode();
+                }
+                tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
                 info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
             }
             return tokenStore;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
Wed Jun  6 15:16:47 2012
@@ -133,10 +133,11 @@ public class STSTokenValidator implement
             }
             if (tokenStore == null) {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
-                tokenStore = 
-                    tokenStoreFactory.newTokenStore(
-                        SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, message
-                    );
+                String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+                if (info.getName() != null) {
+                    cacheKey += "-" + info.getName().toString().hashCode();
+                }
+                tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
                 info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
             }
             return tokenStore;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
Wed Jun  6 15:16:47 2012
@@ -747,7 +747,11 @@ public class WSS4JInInterceptor extends 
                 }
                 if (replayCache == null) {
                     ReplayCacheFactory replayCacheFactory = ReplayCacheFactory.newInstance();
-                    replayCache = replayCacheFactory.newReplayCache(instanceKey, message);
+                    String cacheKey = instanceKey;
+                    if (info.getName() != null) {
+                        cacheKey += "-" + info.getName().toString().hashCode();
+                    }
+                    replayCache = replayCacheFactory.newReplayCache(cacheKey, message);
                     info.setProperty(instanceKey, replayCache);
                 }
                 return replayCache;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Wed Jun  6 15:16:47 2012
@@ -369,10 +369,11 @@ public abstract class AbstractBindingBui
             }
             if (tokenStore == null) {
                 TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
-                tokenStore = 
-                    tokenStoreFactory.newTokenStore(
-                        SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, message
-                    );
+                String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+                if (info.getName() != null) {
+                    cacheKey += "-" + info.getName().toString().hashCode();
+                }
+                tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
                 info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
             }
             return tokenStore;

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
(original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
Wed Jun  6 15:16:47 2012
@@ -120,13 +120,14 @@ public abstract class AbstractSecurityTe
     public static void cleanup() {
         String tmpDir = System.getProperty("java.io.tmpdir");
         if (tmpDir != null) {
-            File nonceFile = new File(tmpDir + File.separator + "ws-security.nonce.cache.instance.data");
-            if (nonceFile.exists()) {
-                nonceFile.delete();
-            }
-            File tsFile = new File(tmpDir + File.separator + "ws-security.timestamp.cache.instance.data");
-            if (tsFile.exists()) {
-                tsFile.delete();
+            File[] tmpFiles = new File(tmpDir).listFiles();
+            if (tmpFiles != null) {
+                for (File tmpFile : tmpFiles) {
+                    if (tmpFile.exists() && (tmpFile.getName().startsWith("ws-security.nonce.cache.instance")
+                            || tmpFile.getName().startsWith("ws-security.timestamp.cache.instance")))
{
+                        tmpFile.delete();
+                    }
+                }
             }
         }
     }

Modified: cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/SecurityTestUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/SecurityTestUtil.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/SecurityTestUtil.java
(original)
+++ cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/common/SecurityTestUtil.java
Wed Jun  6 15:16:47 2012
@@ -32,13 +32,14 @@ public final class SecurityTestUtil {
     public static void cleanup() {
         String tmpDir = System.getProperty("java.io.tmpdir");
         if (tmpDir != null) {
-            File nonceFile = new File(tmpDir + File.separator + "ws-security.nonce.cache.instance.data");
-            if (nonceFile.exists()) {
-                nonceFile.delete();
-            }
-            File tsFile = new File(tmpDir + File.separator + "ws-security.timestamp.cache.instance.data");
-            if (tsFile.exists()) {
-                tsFile.delete();
+            File[] tmpFiles = new File(tmpDir).listFiles();
+            if (tmpFiles != null) {
+                for (File tmpFile : tmpFiles) {
+                    if (tmpFile.exists() && (tmpFile.getName().startsWith("ws-security.nonce.cache.instance")
+                            || tmpFile.getName().startsWith("ws-security.timestamp.cache.instance")))
{
+                        tmpFile.delete();
+                    }
+                }
             }
         }
     }

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java?rev=1346937&r1=1346936&r2=1346937&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
Wed Jun  6 15:16:47 2012
@@ -32,13 +32,14 @@ public final class SecurityTestUtil {
     public static void cleanup() {
         String tmpDir = System.getProperty("java.io.tmpdir");
         if (tmpDir != null) {
-            File nonceFile = new File(tmpDir + File.separator + "ws-security.nonce.cache.instance.data");
-            if (nonceFile.exists()) {
-                nonceFile.delete();
-            }
-            File tsFile = new File(tmpDir + File.separator + "ws-security.timestamp.cache.instance.data");
-            if (tsFile.exists()) {
-                tsFile.delete();
+            File[] tmpFiles = new File(tmpDir).listFiles();
+            if (tmpFiles != null) {
+                for (File tmpFile : tmpFiles) {
+                    if (tmpFile.exists() && (tmpFile.getName().startsWith("ws-security.nonce.cache.instance")
+                            || tmpFile.getName().startsWith("ws-security.timestamp.cache.instance")))
{
+                        tmpFile.delete();
+                    }
+                }
             }
         }
     }



Mime
View raw message