Package org.forgerock.secrets
Class Secret
java.lang.Object
org.forgerock.secrets.Secret
- Direct Known Subclasses:
CryptoKey
,GenericSecret
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 Summary
ModifierConstructorDescriptionprotected
Secret
(SecretBuilder builder) Constructs the secret using the given builder. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
final Instant
The expiry time of this secret.final String
A stable identifier for this particular secret that can be used to lookup the same secret in future.final int
hashCode()
final boolean
Indicates whether the secret has expired according to the given clock.toString()
-
Constructor Details
-
Secret
Constructs the secret using the given builder.Under the hood, this method will inject a handle to the builder to force its own expiration. This process is meant to restrict this forced expiry feature to the creator of the secret.
- Parameters:
builder
- the secret builder.- See Also:
-
-
Method Details
-
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.
-
isExpired
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
.
-
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.
-
equals
-
hashCode
public final int hashCode() -
toString
-