Apache CXF API

org.apache.cxf.ws.security.tokenstore
Class EHCacheTokenStore

java.lang.Object
  extended by org.apache.cxf.ws.security.tokenstore.EHCacheTokenStore
All Implemented Interfaces:
Closeable, BusLifeCycleListener, TokenStore
Direct Known Subclasses:
DefaultInMemoryTokenStore

public class EHCacheTokenStore
extends Object
implements TokenStore, Closeable, BusLifeCycleListener

An in-memory EHCache implementation of the TokenStore interface. The default TTL is 60 minutes and the max TTL is 12 hours.


Field Summary
static long DEFAULT_TTL
           
static long MAX_TTL
           
 
Constructor Summary
EHCacheTokenStore(String key, Bus b, URL configFileURL)
           
 
Method Summary
 void add(SecurityToken token)
          Add the given token to the cache.
 void add(String identifier, SecurityToken token)
          Add the given token to the cache under the given identifier
 void close()
           
 SecurityToken getToken(String identifier)
          Returns the Token of the given identifier
 Collection<String> getTokenIdentifiers()
          Return the list of all valid token identifiers.
 void initComplete()
          Invoked when the Bus has been initialized.
 void postShutdown()
          Invoked after the Bus is shutdown.
 void preShutdown()
          Invoked before the Bus is shutdown.
 void remove(String identifier)
          Remove an existing token by its identifier
 void setTTL(long newTtl)
          Set a new (default) TTL value in seconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TTL

public static final long DEFAULT_TTL
See Also:
Constant Field Values

MAX_TTL

public static final long MAX_TTL
See Also:
Constant Field Values
Constructor Detail

EHCacheTokenStore

public EHCacheTokenStore(String key,
                         Bus b,
                         URL configFileURL)
Method Detail

setTTL

public void setTTL(long newTtl)
Set a new (default) TTL value in seconds

Parameters:
newTtl - a new (default) TTL value in seconds

add

public void add(SecurityToken token)
Description copied from interface: TokenStore
Add the given token to the cache. The SecurityTokens getId() identifier will be used to key it in the cache.

Specified by:
add in interface TokenStore
Parameters:
token - The token to be added

add

public void add(String identifier,
                SecurityToken token)
Description copied from interface: TokenStore
Add the given token to the cache under the given identifier

Specified by:
add in interface TokenStore
Parameters:
identifier - The identifier to use to key the SecurityToken in the cache
token - The token to be added

remove

public void remove(String identifier)
Description copied from interface: TokenStore
Remove an existing token by its identifier

Specified by:
remove in interface TokenStore

getTokenIdentifiers

public Collection<String> getTokenIdentifiers()
Description copied from interface: TokenStore
Return the list of all valid token identifiers.

Specified by:
getTokenIdentifiers in interface TokenStore
Returns:
As array of (valid) token identifiers

getToken

public SecurityToken getToken(String identifier)
Description copied from interface: TokenStore
Returns the Token of the given identifier

Specified by:
getToken in interface TokenStore
Returns:
The requested Token identified by the given identifier

close

public void close()
Specified by:
close in interface Closeable

initComplete

public void initComplete()
Description copied from interface: BusLifeCycleListener
Invoked when the Bus has been initialized.

Specified by:
initComplete in interface BusLifeCycleListener

preShutdown

public void preShutdown()
Description copied from interface: BusLifeCycleListener
Invoked before the Bus is shutdown.

Specified by:
preShutdown in interface BusLifeCycleListener

postShutdown

public void postShutdown()
Description copied from interface: BusLifeCycleListener
Invoked after the Bus is shutdown.

Specified by:
postShutdown in interface BusLifeCycleListener

Apache CXF API

Apache CXF