Class VaultTokenRequest.VaultTokenRequestBuilder
java.lang.Object
org.springframework.vault.support.VaultTokenRequest.VaultTokenRequestBuilder
- Enclosing class:
- VaultTokenRequest
Builder to build a
VaultTokenRequest
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build a newVaultTokenRequest
instance.displayName
(String displayName) Configure a display name for the token, defaults to "token".explicitMaxTtl
(long explicitMaxTtl, TimeUnit timeUnit) Configure the explicit maximum TTL for the token.explicitMaxTtl
(Duration explicitMaxTtl) Configure the explicit maximum TTL for the token.Configure a the Id of the client token.Configure meta.Omit the default policy in the token's policy setnoDefaultPolicy
(boolean noDefaultPolicy) Configure whether the default policy should be part of the token's policy set.noParent()
Configure the token to not have the parent token of the caller.noParent
(boolean noParent) Configure the token to not have the parent token of the caller.numUses
(int numUses) Configure the maximum uses for the token.Configure policies.Enable TTL extension/renewal for the token.renewable
(boolean renewable) Configure TTL extension/renewal for the token.Configure a TTL (seconds) for the token.Configure a TTL for the token usingChronoUnit.SECONDS
resolution.withPolicy
(String policy) Add a policy.
-
Method Details
-
id
Configure a the Id of the client token. Can only be specified by a root token. Otherwise, the token Id is a randomly generated UUID.- Parameters:
id
- the token Id.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
policies
Configure policies. Replaces previously configured policies.- Parameters:
policies
- must not be null.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
withPolicy
Add a policy.- Parameters:
policy
- must not be empty or null.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
meta
Configure meta. Replaces previously meta.- Parameters:
meta
- must not be null.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
noParent
Configure the token to not have the parent token of the caller. This creates a token with no parent. Requires a root caller.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
noParent
Configure the token to not have the parent token of the caller. This creates a token with no parent. Requires a root caller.- Parameters:
noParent
- true to not have the parent token of the caller.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
noDefaultPolicy
Omit the default policy in the token's policy set- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
noDefaultPolicy
Configure whether the default policy should be part of the token's policy set.- Parameters:
noDefaultPolicy
- true to omit the default policy in the token's policy set.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
renewable
Enable TTL extension/renewal for the token.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
renewable
Configure TTL extension/renewal for the token.- Parameters:
renewable
- false to disable the ability of the token to be renewed past its initial TTL. true, or omitting this option, will allow the token to be renewable up to the system/mount maximum TTL.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
ttl
Configure a TTL (seconds) for the token.- Parameters:
ttl
- the time to live, must not be negative.timeUnit
- the time to live time unit, must not be null.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
ttl
Configure a TTL for the token usingChronoUnit.SECONDS
resolution.- Parameters:
ttl
- the time to live, must not be null or negative.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.- Since:
- 2.0
-
explicitMaxTtl
public VaultTokenRequest.VaultTokenRequestBuilder explicitMaxTtl(long explicitMaxTtl, TimeUnit timeUnit) Configure the explicit maximum TTL for the token. This maximum token TTL cannot be changed later, and unlike with normal tokens, updates to the system/mount max TTL value will have no effect at renewal time - the token will never be able to be renewed or used past the value set at issue time.- Parameters:
explicitMaxTtl
- the time to live, must not be negative.timeUnit
- the time to live, must not be null.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
explicitMaxTtl
Configure the explicit maximum TTL for the token. This maximum token TTL cannot be changed later, and unlike with normal tokens, updates to the system/mount max TTL value will have no effect at renewal time - the token will never be able to be renewed or used past the value set at issue time.- Parameters:
explicitMaxTtl
- the time to live, must not be null or negative.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.- Since:
- 2.0
-
numUses
Configure the maximum uses for the token. This can be used to create a one-time-token or limited use token. Defaults to 0, which has no limit to the number of uses.- Parameters:
numUses
- number of uses, must not be negative.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
displayName
Configure a display name for the token, defaults to "token".- Parameters:
displayName
- must not be empty or null.- Returns:
this
VaultTokenRequest.VaultTokenRequestBuilder
.
-
build
Build a newVaultTokenRequest
instance.- Returns:
- a new
VaultCertificateRequest
.
-