Package org.saidone.service
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 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 Summary
Constructors -
Method Summary
Methods inherited from class org.saidone.component.BaseComponent
setApplicationContext, shutDown, stop
-
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 classBaseComponent
-
getSecret
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
-