public static class Auth.TokenRequest
extends java.lang.Object
implements java.io.Serializable
A container for all of the options that can be passed to the createToken(TokenRequest) method, to
avoid that method having an excessive number of parameters (with null typically passed to most
of them).
All properties here are optional. Use of this class resembles a builder pattern (i.e. call the mutator method
for each property you wish to set), but this class lacks a final build() method as no
post-initialization logic is necessary.
| Constructor and Description |
|---|
TokenRequest() |
| Modifier and Type | Method and Description |
|---|---|
Auth.TokenRequest |
displayName(java.lang.String displayName) |
Auth.TokenRequest |
id(java.util.UUID id) |
Auth.TokenRequest |
meta(java.util.Map<java.lang.String,java.lang.String> meta) |
Auth.TokenRequest |
noDefaultPolicy(java.lang.Boolean noDefaultPolicy) |
Auth.TokenRequest |
noParent(java.lang.Boolean noParent) |
Auth.TokenRequest |
numUses(java.lang.Long numUses) |
Auth.TokenRequest |
polices(java.util.List<java.lang.String> polices) |
Auth.TokenRequest |
role(java.lang.String role) |
Auth.TokenRequest |
ttl(java.lang.String ttl) |
public Auth.TokenRequest id(java.util.UUID id)
id - (optional) The ID of the client token. Can only be specified by a root token. Otherwise, the token ID is a randomly generated UUID.public Auth.TokenRequest polices(java.util.List<java.lang.String> polices)
polices - (optional) A list of policies for the token. This must be a subset of the policies belonging to the tokenpublic Auth.TokenRequest meta(java.util.Map<java.lang.String,java.lang.String> meta)
meta - (optional) A map of string to string valued metadata. This is passed through to the audit backends.public Auth.TokenRequest noParent(java.lang.Boolean noParent)
noParent - (optional) If true and set by a root caller, the token will not have the parent token of the caller. This creates a token with no parent.public Auth.TokenRequest noDefaultPolicy(java.lang.Boolean noDefaultPolicy)
noDefaultPolicy - (optional) If true the default policy will not be a part of this token's policy set.public Auth.TokenRequest ttl(java.lang.String ttl)
ttl - (optional) The TTL period of the token, provided as "1h", where hour is the largest suffix. If not provided, the token is valid for the default lease TTL, or indefinitely if the root policy is used.public Auth.TokenRequest displayName(java.lang.String displayName)
displayName - (optional) The display name of the token. Defaults to "token".public Auth.TokenRequest numUses(java.lang.Long numUses)
numUses - (optional) The maximum uses for the given 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.public Auth.TokenRequest role(java.lang.String role)
role - (optional) The role the token will be created with. Default is no role.