Package org.springframework.vault.core
Class VaultWrappingTemplate
java.lang.Object
org.springframework.vault.core.VaultWrappingTemplate
- All Implemented Interfaces:
VaultWrappingOperations
- Author:
- Mark Paluch
-
Constructor Summary
ConstructorDescriptionVaultWrappingTemplate
(VaultOperations vaultOperations) Create a newVaultWrappingTemplate
givenVaultOperations
. -
Method Summary
Modifier and TypeMethodDescriptionlookup
(VaultToken token) Looks upmetadata
for the given token containing a wrapped response.read
(VaultToken token) Read a wrapped secret.<T> VaultResponseSupport<T>
read
(VaultToken token, Class<T> responseType) Read a wrapped secret of typeresponseType
.rewrap
(VaultToken token) Rewraps a response-wrapped token.Wraps the given user-supplied data inside a response-wrapped token.
-
Constructor Details
-
VaultWrappingTemplate
Create a newVaultWrappingTemplate
givenVaultOperations
.- Parameters:
vaultOperations
- must not be null.
-
-
Method Details
-
lookup
Description copied from interface:VaultWrappingOperations
Looks upmetadata
for the given token containing a wrapped response.- Specified by:
lookup
in interfaceVaultWrappingOperations
- Parameters:
token
- must not be null.- Returns:
- the
WrappedMetadata
thetoken
or null if the token was invalid or expired.
-
read
Description copied from interface:VaultWrappingOperations
Read a wrapped secret.- Specified by:
read
in interfaceVaultWrappingOperations
- Parameters:
token
- must not be null.- Returns:
- the data or null if the token was invalid or expired.
-
read
Description copied from interface:VaultWrappingOperations
Read a wrapped secret of typeresponseType
.- Specified by:
read
in interfaceVaultWrappingOperations
- Parameters:
token
- must not be null.responseType
- must not be null.- Returns:
- the data or null if the token was invalid or expired.
-
rewrap
Description copied from interface:VaultWrappingOperations
Rewraps a response-wrapped token. The new token will use the same creation TTL as the original token and contain the same response. The old token will be invalidated. This can be used for long-term storage of a secret in a response-wrapped token when rotation is a requirement. Rewrapping with an invalid token throwsVaultException
.- Specified by:
rewrap
in interfaceVaultWrappingOperations
- Parameters:
token
- must not be null.- Returns:
- the
WrappedMetadata
for this wrapping operation.
-
wrap
Description copied from interface:VaultWrappingOperations
Wraps the given user-supplied data inside a response-wrapped token.- Specified by:
wrap
in interfaceVaultWrappingOperations
- Parameters:
body
- must not be null.duration
- must not be null.- Returns:
- the
WrappedMetadata
for this wrapping operation.
-