Class GenericWrapperSecretStore
java.lang.Object
org.forgerock.openig.tools.secrets.GenericWrapperSecretStore
- All Implemented Interfaces:
SecretStore<CryptoKey>
A
SecretStore
that maps GenericSecret
s from an underlying SecretsProvider
to
CryptoKey
s.
This implementation is very basic. It could be enhanced by caching created secrets instead of recreating them.
-
Field Summary
Fields inherited from interface org.forgerock.secrets.SecretStore
CLOCK, LEASE_EXPIRY_DURATION
-
Method Summary
Modifier and TypeMethodDescriptionThe top-level class that this store is capable of storing.<S extends CryptoKey>
Promise<Stream<S>,NeverThrowsException> Returns all valid secrets for the given purpose from this store.void
refresh()
Indicates that the store should refresh its secrets from the backing storage mechanism.static GenericWrapperSecretStore
secretKey
(SecretsProvider secretsProvider, String algorithm, Clock clock) Creates aGenericWrapperSecretStore
that maps generic secrets to a Secret Key based crypto key.
-
Method Details
-
secretKey
public static GenericWrapperSecretStore secretKey(SecretsProvider secretsProvider, String algorithm, Clock clock) Creates aGenericWrapperSecretStore
that maps generic secrets to a Secret Key based crypto key.- Parameters:
secretsProvider
- theSecretsProvider
containing generic secretsclock
- the Clock used to build the new secretalgorithm
- the algorithm to associate with the secret when creating aKey
.- Returns:
- a new instance of a
GenericWrapperSecretStore
.
-
getStoredType
Description copied from interface:SecretStore
The top-level class that this store is capable of storing. This is a reification of the type parameter and can be used to lookup stores for a given type.- Specified by:
getStoredType
in interfaceSecretStore<CryptoKey>
- Returns:
- the top-most type that this store is capable of storing, typically either
CryptoKey
for key-stores,GenericSecret
for password stores, orSecret
if the store is capable of storing any type of secret.
-
getValid
Description copied from interface:SecretStore
Returns all valid secrets for the given purpose from this store.- Specified by:
getValid
in interfaceSecretStore<CryptoKey>
- Type Parameters:
S
- the type of secret.- Parameters:
purpose
- the purpose.- Returns:
- a stream of all valid secrets of the given type from this store, or an empty stream if none exist.
-
refresh
public void refresh()Description copied from interface:SecretStore
Indicates that the store should refresh its secrets from the backing storage mechanism. This can be used to cause reload of a store after a secret rotation if the backend does not automatically detect such changes. Refresh may be an asynchronous operation and no guarantees are made about when clients of this secret store may see updated secrets after a call to refresh.- Specified by:
refresh
in interfaceSecretStore<CryptoKey>
-