Author: coheigea
Date: Mon Feb 3 16:58:27 2014
New Revision: 1563978
URL: http://svn.apache.org/r1563978
Log:
Make ReplayCaches closeable
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/ReplayCache.java
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java?rev=1563978&r1=1563977&r2=1563978&view=diff
==============================================================================
---
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
(original)
+++
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
Mon Feb 3 16:58:27 2014
@@ -19,7 +19,6 @@
package org.apache.wss4j.common.cache;
-import java.io.Closeable;
import java.net.URL;
import net.sf.ehcache.Cache;
@@ -32,7 +31,7 @@ import net.sf.ehcache.config.CacheConfig
* An in-memory EHCache implementation of the ReplayCache interface. The
default TTL is 60 minutes and the
* max TTL is 12 hours.
*/
-public class EHCacheReplayCache implements ReplayCache, Closeable {
+public class EHCacheReplayCache implements ReplayCache {
public static final long DEFAULT_TTL = 3600L;
public static final long MAX_TTL = DEFAULT_TTL * 12L;
@@ -121,13 +120,13 @@ public class EHCacheReplayCache implemen
return false;
}
+ @Override
public synchronized void close() {
if (cacheManager != null) {
EHCacheManagerHolder.releaseCacheManger(cacheManager);
cacheManager = null;
cache = null;
}
-
}
public void initComplete() {
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java?rev=1563978&r1=1563977&r2=1563978&view=diff
==============================================================================
---
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
(original)
+++
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
Mon Feb 3 16:58:27 2014
@@ -19,6 +19,7 @@
package org.apache.wss4j.common.cache;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -109,4 +110,10 @@ public class MemoryReplayCache implement
}
}
}
+
+ @Override
+ public synchronized void close() throws IOException {
+ cache.clear();
+ ids.clear();
+ }
}
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/ReplayCache.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/ReplayCache.java?rev=1563978&r1=1563977&r2=1563978&view=diff
==============================================================================
---
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/ReplayCache.java
(original)
+++
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/cache/ReplayCache.java
Mon Feb 3 16:58:27 2014
@@ -19,12 +19,13 @@
package org.apache.wss4j.common.cache;
+import java.io.Closeable;
/**
* A cache to store (String) identifiers to avoid replay attacks. An example
of such an identifier
* is a UsernameToken nonce.
*/
-public interface ReplayCache {
+public interface ReplayCache extends Closeable {
/**
* Add the given identifier to the cache. It will be cached for a default
amount of time.