Package org.keycloak.vault
Interface VaultProvider
-
- All Superinterfaces:
Provider
- All Known Implementing Classes:
AbstractVaultProvider
,FilesPlainTextVaultProvider
public interface VaultProvider extends Provider
Provider interface for a vault. The only purpose of a vault is retrieval of secrets.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VaultRawSecret
obtainSecret(String vaultSecretId)
Retrieves a secret from vault.
-
-
-
Method Detail
-
obtainSecret
VaultRawSecret obtainSecret(String vaultSecretId)
Retrieves a secret from vault. The implementation should respect at least the realm ID to separate the secrets within the vault. If the secret is retrieved successfully, it is returned; otherwise this method results into an emptyVaultRawSecret.get()
. This method is intended to be used within a try-with-resources block so that the secret is destroyed immediately after use. Note that it is responsibility of the implementor to provide a way to destroy the secret in the returnedVaultRawSecret.close()
method.- Parameters:
vaultSecretId
- Identifier of the secret. It corresponds to the value entered by user in the respective configuration, which in turn is obtained from the vault when storing the secret.- Returns:
- Always a non-
null
value with the raw secret. Within the returned value, the secret ornull
is stored in theVaultRawSecret.get()
return value if the secret was successfully resolved, or an emptyOptional
if the secret has not been found in the vault.
-
-