Package org.apache.archiva.redback.keys
Interface KeyManager
-
- All Known Implementing Classes:
AbstractKeyManager
,CachedKeyManager
,JpaKeyManager
,MemoryKeyManager
public interface KeyManager
KeyManager- Author:
- Joakim Erdfelt
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AuthenticationKey
addKey(AuthenticationKey key)
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.void
removeExpiredKeys()
Remove all keys that are expired.
-
-
-
Method Detail
-
getId
String getId()
String identifying the key manager implementation.- Returns:
- the key manager implementation id.
-
findKey
AuthenticationKey findKey(String key) throws KeyNotFoundException, KeyManagerException
Attempt to find a specific key in the store. NOTE: Implementations of this interface should never return an expired key.- 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.
-
createKey
AuthenticationKey createKey(String principal, String purpose, int expirationMinutes) throws KeyManagerException
Create a key (and save it to the store) for the specified principal.- 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
void deleteKey(AuthenticationKey key) throws KeyManagerException
Delete a key from the underlying store.- Parameters:
key
- the key to delete.- Throws:
KeyManagerException
-
deleteKey
void deleteKey(String key) throws KeyManagerException
Delete a key from the underlying store.- Parameters:
key
- the key to delete.- Throws:
KeyManagerException
-
getAllKeys
List<AuthenticationKey> getAllKeys()
-
addKey
AuthenticationKey addKey(AuthenticationKey key)
-
eraseDatabase
void eraseDatabase()
-
removeExpiredKeys
void removeExpiredKeys() throws KeyManagerException
Remove all keys that are expired.- Throws:
KeyManagerException
-
-