Package org.forgerock.secrets
Class Secret
- java.lang.Object
- 
- org.forgerock.secrets.Secret
 
- 
- All Implemented Interfaces:
- AutoCloseable
 - Direct Known Subclasses:
- CryptoKey,- GenericSecret
 
 public abstract class Secret extends Object implements AutoCloseable A secret is any piece of data that should be kept confidential. This includes connection passwords and API keys, as well as cryptographic key material.Secrets are thread-safe and are immutable until destroyed (closed). 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedSecret(SecretBuilder builder)Constructs the secret using the given builder.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanequals(Object that)InstantgetExpiryTime()The expiry time of this secret.StringgetStableId()A stable identifier for this particular secret that can be used to lookup the same secret in future.inthashCode()booleanisClosed()Indicates whether this secret has been closed by calling theclose()method.booleanisExpired(Clock clock)Indicates whether the secret has expired according to the given clock.StringtoString()
 
- 
- 
- 
Constructor Detail- 
Secretprotected Secret(SecretBuilder builder) Constructs the secret using the given builder.- Parameters:
- builder- the secret builder.
 
 
- 
 - 
Method Detail- 
getExpiryTimepublic final Instant getExpiryTime() The expiry time of this secret. The secret should not be used beyond this time without being re-fetched from theSecretsProvider.- Returns:
- the expiry time.
 
 - 
isExpiredpublic final boolean isExpired(Clock clock) Indicates whether the secret has expired according to the given clock.- Parameters:
- clock- the clock to use to determine the current time.
- Returns:
- true if the secret has expired and should be re-fetched from the SecretsProvider.
 
 - 
getStableIdpublic final String getStableId() A stable identifier for this particular secret that can be used to lookup the same secret in future. This value is guaranteed (with high probability) to be unique to this particular secret and the same across all server instances that share the same secret store.- Returns:
- the stable identifier for this secret.
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
 
 - 
isClosedpublic boolean isClosed() Indicates whether this secret has been closed by calling theclose()method. A secret that has been closed should be considered invalid and re-fetched from the SecretsProvider.- Returns:
- trueif the secret has been closed.
 
 
- 
 
-