public interface SecretsService
SecretsService
.Modifier and Type | Method and Description |
---|---|
<S extends Secret> |
createReference(Purpose<S> purpose)
Create a
SecretReference for the given Purpose . |
<S extends Secret> |
getActiveSecret(Purpose<S> purpose)
Gets the currently active secret for the given purpose.
|
<S extends Secret> |
getNamedSecret(Purpose<S> purpose,
String id)
Gets the secret for the given purpose with the given stable secret id.
|
<S extends Secret> |
getValidSecrets(Purpose<S> purpose)
Returns all secrets for the given purpose which have not yet expired.
|
<S extends Secret> Promise<S,NoSuchSecretException> getActiveSecret(Purpose<S> purpose)
NoSuchSecretException
is thrown instead.
The active secret is found by first consulting the currently active store for the purpose label. If no active stores exist for the purpose, all default stores are consulted, and the first matching secret is used.
This method is usually used for encryption and signature operations, where you need to use the active (not rotated) crypto material.
S
- the type of secret to return.purpose
- the purpose for which the secret is intended to be used.NoSuchSecretException
if
one cannot be found.<S extends Secret> Promise<S,NoSuchSecretException> getNamedSecret(Purpose<S> purpose, String id)
This method is usually used for decryption and signature verification operations, where you may have a hint for selecting the crypto material to use for the operation. Because the verified signature may have been generated with a rotated secret (at time of verification), #getActiveSecret cannot be used.
S
- the type of secret to returnpurpose
- the purpose for which the secret is intended to be used.id
- the stable id of the particular secret to get.Secret.getStableId()
<S extends Secret> Promise<Stream<S>,NeverThrowsException> getValidSecrets(Purpose<S> purpose)
S
- the type of secret to return.purpose
- the purpose for which the secrets are intended for.<S extends Secret> SecretReference<S> createReference(Purpose<S> purpose)
SecretReference
for the given Purpose
.S
- The type of the SecretReference to return.purpose
- The Purpose
for the SecretReference
.Copyright 2011-2017 ForgeRock AS.