java.lang.Object
de.stklcode.jvault.connector.model.Token.Builder
- Enclosing class:
- Token
A builder for vault tokens.
- Since:
- 0.4.0, 0.9 Moved into subclass of
Token
. - Author:
- Stefan Kalscheuer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasOrphan()
Create token without parent.build()
Build the token based on given parameters.Set token to be not renewable.Set token to be renewable.Attach default policy to token.withDisplayName
(String displayName) Add display name.withEntityAlias
(String entityAlias) Set entity alias for token.withExplicitMaxTtl
(Integer explicitMaxTtl) Set desired explicit maximum time to live.Add token ID.Add meta data.Add meta data.withNoDefaultPolicy
(boolean noDefaultPolicy) Set TRUE if the default policy should not be part of this token.withNoParent
(boolean noParent) Set TRUE if the token should be created without parent.withNumUses
(Integer numUses) Set desired number of uses.Do not attach default policy to token.Create token with parent.withPeriod
(Integer period) Set token period (former lease time).withPolicies
(String... policies) Add given policies.withPolicies
(List<String> policies) Add given policies.withPolicy
(String policy) Add a single policy.withRenewable
(Boolean renewable) Set if token is renewable.Set desired time to live.withType
(Token.Type type) Specify token type.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withId
Add token ID. (optional)- Parameters:
id
- the ID- Returns:
- self
-
withType
Specify token type.- Parameters:
type
- the type- Returns:
- self
- Since:
- 0.9
-
withDisplayName
Add display name.- Parameters:
displayName
- the display name- Returns:
- self
-
withTtl
Set desired time to live.- Parameters:
ttl
- the ttl- Returns:
- self
-
withExplicitMaxTtl
Set desired explicit maximum time to live.- Parameters:
explicitMaxTtl
- the explicit max. TTL- Returns:
- self
-
withNumUses
Set desired number of uses.- Parameters:
numUses
- the number of uses- Returns:
- self
-
withNoParent
Set TRUE if the token should be created without parent.- Parameters:
noParent
- if TRUE, token is created as orphan- Returns:
- self
-
asOrphan
Create token without parent. Convenience method for withNoParent()- Returns:
- self
-
withParent
Create token with parent. Convenience method for withNoParent()- Returns:
- self
-
withNoDefaultPolicy
Set TRUE if the default policy should not be part of this token.- Parameters:
noDefaultPolicy
- if TRUE, default policy is not attached- Returns:
- self
-
withDefaultPolicy
Attach default policy to token. Convenience method for withNoDefaultPolicy()- Returns:
- self
-
withoutDefaultPolicy
Do not attach default policy to token. Convenience method for withNoDefaultPolicy()- Returns:
- self
-
withPolicies
Add given policies.- Parameters:
policies
- the policies- Returns:
- self
- Since:
- 0.5.0
-
withPolicies
Add given policies.- Parameters:
policies
- the policies- Returns:
- self
-
withPolicy
Add a single policy.- Parameters:
policy
- the policy- Returns:
- self
-
withMeta
Add meta data.- Parameters:
meta
- the metadata- Returns:
- self
-
withMeta
Add meta data.- Parameters:
key
- the keyvalue
- the value- Returns:
- self
-
withRenewable
Set if token is renewable.- Parameters:
renewable
- TRUE, if renewable- Returns:
- self
-
renewable
Set token to be renewable. Convenience method for withRenewable()- Returns:
- self
-
notRenewable
Set token to be not renewable. Convenience method for withRenewable()- Returns:
- self
-
withPeriod
Set token period (former lease time).- Parameters:
period
- Period in seconds.- Returns:
- self
-
withEntityAlias
Set entity alias for token. Only works in combination with an associated token role.- Parameters:
entityAlias
- Entity alias.- Returns:
- self
-
build
Build the token based on given parameters.- Returns:
- the token
-