Class SecretService

java.lang.Object
org.saidone.component.BaseComponent
org.saidone.service.SecretService
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service public class SecretService extends BaseComponent
Service class for interacting with Vault to retrieve secrets.

This service uses Spring Vault's versioned key-value operations to fetch secrets from a configured Vault path and key. It supports retrieving secrets by specific version or the latest version if none is specified.

  • Constructor Details

    • SecretService

      public SecretService()
  • Method Details

    • init

      public void init()
      Description copied from class: BaseComponent
      Called after dependency injection is complete. Logs a startup message indicating that the component is ready.
      Overrides:
      init in class BaseComponent
    • getSecret

      public org.apache.commons.lang3.tuple.Pair<byte[],Integer> getSecret(Integer version)
      Retrieves the secret from Vault for the specified version.
      Parameters:
      version - the version of the secret to retrieve; if null, retrieves the latest version
      Returns:
      a Pair containing the secret bytes and the version number
      Throws:
      RuntimeException - if unable to retrieve the secret or if an error occurs during retrieval