Class SecretManagerTLC

java.lang.Object
dev.enola.common.secret.context.SecretManagerTLC
All Implemented Interfaces:
SecretManager

public class SecretManagerTLC extends Object implements SecretManager
SecretManagerTLC is a SecretManager implementation that looks up the current SecretManager from the TLC. If it's not found there, then it falls back to one passed to the constructor, which defaults to an UnavailableSecretManager.
  • Constructor Details

  • Method Details

    • store

      public void store(String key, char[] value) throws IOException
      Description copied from interface: SecretManager
      Stores a secret value associated with a unique key. The sensitive value is provided as a char array. Implementations will zero out the input value array immediately after calling this method for security. If a secret with the same key already exists, its value is overwritten.
      Specified by:
      store in interface SecretManager
      Parameters:
      key - The unique key (name) for the secret.
      value - The sensitive secret value as a character array.
      Throws:
      IOException - If an error occurs while storing the secret.
    • getOptional

      Description copied from interface: SecretManager
      Retrieves a secret by its key, with optionality.
      Specified by:
      getOptional in interface SecretManager
      Parameters:
      key - The unique key (name) of the secret to retrieve.
      Returns:
      An Optional containing the Secret, if found.
      Throws:
      IOException - If an error occurs while retrieving the secret.
    • get

      Description copied from interface: SecretManager
      Retrieves a secret by its key; throws if not found.
      Specified by:
      get in interface SecretManager
      Parameters:
      key - The unique key (name) of the secret to retrieve.
      Returns:
      An Optional containing the Secret, if found.
      Throws:
      IllegalStateException - if the secret is not found.
      IOException - If an error occurs while retrieving the secret.
    • delete

      public void delete(String key) throws IOException
      Description copied from interface: SecretManager
      Deletes a secret from the manager.
      Specified by:
      delete in interface SecretManager
      Parameters:
      key - The unique key (name) of the secret to delete.
      Throws:
      IOException - If an error occurs while deleting the secret.