public final class PropertyResolverSecretStore extends Object implements SecretStore<Secret>
SecretStore
implementation that resolves secrets as base64-encoded strings from an underlying
PropertyResolver
. This provides a devops-friendly deployment option, resolving secrets from environment
variables or properties files.
We assume that secrets loaded this way are stable for the life of the process and will not be rotated without a restart. In addition, the property name is used as the stable identifier for all loaded secrets so rotation would need to use fresh property names if it is desirable to maintain access to previous values over a long period of time.
CLOCK, LEASE_EXPIRY_DURATION
Constructor and Description |
---|
PropertyResolverSecretStore(PropertyResolver propertyResolver)
Initialises the property resolver secret store using base64-encoded properties.
|
PropertyResolverSecretStore(PropertyResolver propertyResolver,
SecretPropertyFormat propertyFormat)
Initialises the property resolver secret store.
|
Modifier and Type | Method and Description |
---|---|
<S extends Secret> |
getActive(Purpose<S> purpose)
Returns the active secret for the given purpose.
|
<S extends Secret> |
getNamed(Purpose<S> purpose,
String name)
Returns the named secret from this store.
|
Class<Secret> |
getStoredType()
The top-level class that this store is capable of storing.
|
<S extends Secret> |
getValid(Purpose<S> purpose)
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
retire, revoke, rotate
public PropertyResolverSecretStore(PropertyResolver propertyResolver, SecretPropertyFormat propertyFormat)
propertyResolver
- the resolver to use to read secrets from configuration.propertyFormat
- the format that the secret properties are in.public PropertyResolverSecretStore(PropertyResolver propertyResolver)
propertyResolver
- the resolver to use to read secrets from configuration.public Class<Secret> getStoredType()
SecretStore
getStoredType
in interface SecretStore<Secret>
CryptoKey
for key-stores, GenericSecret
for password stores, or
Secret
if the store is capable of storing any type of secret.public <S extends Secret> Promise<S,NoSuchSecretException> getActive(Purpose<S> purpose)
SecretStore
getActive
in interface SecretStore<Secret>
S
- the type of secret.purpose
- the purpose for which a secret is required.public <S extends Secret> Promise<S,NoSuchSecretException> getNamed(Purpose<S> purpose, String name)
SecretStore
getNamed
in interface SecretStore<Secret>
S
- the type of secret.purpose
- the secret purpose.name
- the name (stable id) of the secret.Optional.empty()
if no such secret exists.public <S extends Secret> Promise<Stream<S>,NeverThrowsException> getValid(Purpose<S> purpose)
SecretStore
getValid
in interface SecretStore<Secret>
S
- the type of secret.purpose
- the purpose.public void refresh()
SecretStore
refresh
in interface SecretStore<Secret>
Copyright © 2010-2018, ForgeRock All Rights Reserved.