Class MemoryTokenStore
- java.lang.Object
-
- org.apache.cxf.ws.security.tokenstore.MemoryTokenStore
-
- All Implemented Interfaces:
TokenStore
public class MemoryTokenStore extends Object implements TokenStore
A simple HashMap-based TokenStore. The default TTL is 5 minutes and the max TTL is 1 hour.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_TTLstatic longMAX_TTL
-
Constructor Summary
Constructors Constructor Description MemoryTokenStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String identifier, SecurityToken token)Add the given token to the cache under the given identifiervoidadd(SecurityToken token)Add the given token to the cache.SecurityTokengetToken(String id)Returns theTokenof the given identifierCollection<String>getTokenIdentifiers()Return the list of all valid token identifiers.protected voidprocessTokenExpiry()voidremove(String identifier)Remove an existing token by its identifiervoidsetTTL(long newTtl)Set a new (default) TTL value in seconds
-
-
-
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
-
-
Method Detail
-
add
public void add(SecurityToken token)
Description copied from interface:TokenStoreAdd the given token to the cache. The SecurityTokens getId() identifier will be used to key it in the cache.- Specified by:
addin interfaceTokenStore- Parameters:
token- The token to be added
-
add
public void add(String identifier, SecurityToken token)
Description copied from interface:TokenStoreAdd the given token to the cache under the given identifier- Specified by:
addin interfaceTokenStore- Parameters:
identifier- The identifier to use to key the SecurityToken in the cachetoken- The token to be added
-
setTTL
public void setTTL(long newTtl)
Set a new (default) TTL value in seconds- Parameters:
newTtl- a new (default) TTL value in seconds
-
remove
public void remove(String identifier)
Description copied from interface:TokenStoreRemove an existing token by its identifier- Specified by:
removein interfaceTokenStore
-
getTokenIdentifiers
public Collection<String> getTokenIdentifiers()
Description copied from interface:TokenStoreReturn the list of all valid token identifiers.- Specified by:
getTokenIdentifiersin interfaceTokenStore- Returns:
- As array of (valid) token identifiers
-
getToken
public SecurityToken getToken(String id)
Description copied from interface:TokenStoreReturns theTokenof the given identifier- Specified by:
getTokenin interfaceTokenStore- Returns:
- The requested
Tokenidentified by the given identifier
-
processTokenExpiry
protected void processTokenExpiry()
-
-