Class Secret<T extends SecretConfig>
- Type Parameters:
T- the type ofSecretConfigassociated with this Secret
Helper class which aids in retrieving the current Plaintext value of a secret without having to be
concerned with the implementation details of embedded vs referenced secrets.
To create a new instance of Secret, call create(GatewayContext, SecretConfig) and pass in a
GatewayContext and a SecretConfig.
To get the current Plaintext value from the Secret, call getPlaintext().
-
Method Summary
Modifier and TypeMethodDescriptionstatic Secret<?>create(GatewayContext context, SecretConfig config) Factory method to create a new instance of a Secretabstract PlaintextGet the currentPlaintextvalue of the configured secret.
-
Method Details
-
getContext
- Returns:
- the
GatewayContext. never null.
-
getConfig
- Returns:
- the
SecretConfig. never null.
-
getPlaintext
Get the current
Plaintextvalue of the configured secret.If the configured secret is embedded, the Plaintext value is retrieved by passing the embedded ciphertext to the
SystemEncryptionServiceretrieved from theGatewayContext.If the configured secret is referenced, the Plaintext value is retrieved by getting the
SecretProviderManagerfrom theGatewayContext, then getting theSecretProviderwith the configured name from the SecretProviderManager, and finallyreadingthe Plaintext value of the secret with the configured name from the SecretProvider.- Returns:
- the current
Plaintextvalue of the configured secret. never null. - Throws:
SecretException- if there is a problem getting the current Plaintext value of the configured secret
-
create
Factory method to create a new instance of a Secret- Parameters:
context- the currentGatewayContext. cannot be null.config- theSecretConfigof the secret. cannot be null.- Returns:
- a new instance of Secret
- Throws:
IllegalArgumentException- if the provided config is not an embedded or referenced secretNullPointerException- if either context or config arguments are null
-