Class CachedKeyManager
- java.lang.Object
-
- org.apache.archiva.redback.keys.AbstractKeyManager
-
- org.apache.archiva.redback.keys.cached.CachedKeyManager
-
- All Implemented Interfaces:
KeyManager
@Service("keyManager#cached") public class CachedKeyManager extends AbstractKeyManager implements KeyManager
CachedKeyManager- Author:
- Joakim Erdfelt
-
-
Field Summary
-
Fields inherited from class org.apache.archiva.redback.keys.AbstractKeyManager
log
-
-
Constructor Summary
Constructors Constructor Description CachedKeyManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationKey
addKey(AuthenticationKey key)
void
clearCache()
AuthenticationKey
createKey(String principal, String purpose, int expirationMinutes)
Create a key (and save it to the store) for the specified principal.void
deleteKey(String key)
Delete a key from the underlying store.void
deleteKey(AuthenticationKey key)
Delete a key from the underlying store.void
eraseDatabase()
AuthenticationKey
findKey(String key)
Attempt to find a specific key in the store.List<AuthenticationKey>
getAllKeys()
String
getId()
String identifying the key manager implementation.KeyManager
getKeyImpl()
org.apache.archiva.components.cache.Cache
getKeysCache()
void
setKeyImpl(KeyManager keyImpl)
void
setKeysCache(org.apache.archiva.components.cache.Cache<String,AuthenticationKey> keysCache)
-
Methods inherited from class org.apache.archiva.redback.keys.AbstractKeyManager
assertNotExpired, generateUUID, getNowGMT, isRandomMode, removeExpiredKeys, setRandomMode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.archiva.redback.keys.KeyManager
removeExpiredKeys
-
-
-
-
Constructor Detail
-
CachedKeyManager
public CachedKeyManager()
-
-
Method Detail
-
addKey
public AuthenticationKey addKey(AuthenticationKey key)
- Specified by:
addKey
in interfaceKeyManager
-
createKey
public AuthenticationKey createKey(String principal, String purpose, int expirationMinutes) throws KeyManagerException
Description copied from interface:KeyManager
Create a key (and save it to the store) for the specified principal.- Specified by:
createKey
in interfaceKeyManager
- Parameters:
principal
- the principal to generate the key for.purpose
- the purpose of the key. (Example: "selfservice password reset", "new user validation", "remember me") This is a purely informational field .expirationMinutes
- the amount in minutes until this key expires. (-1 means no expiration)- Returns:
- the key created
- Throws:
KeyManagerException
- if there is a fundamental problem with the KeyManager implementation.
-
deleteKey
public void deleteKey(AuthenticationKey key) throws KeyManagerException
Description copied from interface:KeyManager
Delete a key from the underlying store.- Specified by:
deleteKey
in interfaceKeyManager
- Parameters:
key
- the key to delete.- Throws:
KeyManagerException
-
deleteKey
public void deleteKey(String key) throws KeyManagerException
Description copied from interface:KeyManager
Delete a key from the underlying store.- Specified by:
deleteKey
in interfaceKeyManager
- Parameters:
key
- the key to delete.- Throws:
KeyManagerException
-
eraseDatabase
public void eraseDatabase()
- Specified by:
eraseDatabase
in interfaceKeyManager
-
findKey
public AuthenticationKey findKey(String key) throws KeyManagerException
Description copied from interface:KeyManager
Attempt to find a specific key in the store. NOTE: Implementations of this interface should never return an expired key.- Specified by:
findKey
in interfaceKeyManager
- Parameters:
key
- the key to find.- Returns:
- the actual key found.
- Throws:
KeyNotFoundException
- when the requested, unexpired, key cannot be found.KeyManagerException
- when there is a fundamental problem with the KeyManager implementation.
-
getAllKeys
public List<AuthenticationKey> getAllKeys()
- Specified by:
getAllKeys
in interfaceKeyManager
-
getId
public String getId()
Description copied from interface:KeyManager
String identifying the key manager implementation.- Specified by:
getId
in interfaceKeyManager
- Returns:
- the key manager implementation id.
-
getKeyImpl
public KeyManager getKeyImpl()
-
setKeyImpl
public void setKeyImpl(KeyManager keyImpl)
-
getKeysCache
public org.apache.archiva.components.cache.Cache getKeysCache()
-
setKeysCache
public void setKeysCache(org.apache.archiva.components.cache.Cache<String,AuthenticationKey> keysCache)
-
clearCache
public void clearCache()
-
-