T
- the type of secret that this reference stores.public final class SecretReference<T extends Secret> extends Object
A secret reference is thread-safe.
Constructor and Description |
---|
SecretReference(SecretsProvider provider,
Purpose<T> purpose)
Constructs the secret reference from the given provider and purpose using the system clock to check for expiry.
|
SecretReference(SecretsProvider provider,
Purpose<T> purpose,
Clock clock)
Constructs the secret reference from the given provider and purpose.
|
Modifier and Type | Method and Description |
---|---|
static <T extends Secret> |
constant(T secret)
Create a constant
SecretReference for the given secret, that will never expire. |
T |
get()
Gets the current active secret object, refreshing it if necessary.
|
Promise<T,NoSuchSecretException> |
getAsync()
Gets the current active secret object asynchronously, refreshing it if necessary.
|
public SecretReference(SecretsProvider provider, Purpose<T> purpose, Clock clock)
provider
- the secrets provider to obtain the secret value from.purpose
- the purpose for which a secret is required.clock
- the clock to use when checking if the secret has expired.public SecretReference(SecretsProvider provider, Purpose<T> purpose)
provider
- the secrets provider to obtain the secret value from.purpose
- the purpose for which a secret is required.public T get() throws NoSuchSecretException
NoSuchSecretException
- if no active secret is available for the configured purpose.public Promise<T,NoSuchSecretException> getAsync()
public static <T extends Secret> SecretReference<T> constant(T secret)
SecretReference
for the given secret, that will never expire.T
- The type of the secret.secret
- The secret.Copyright © 2010-2018, ForgeRock All Rights Reserved.