| Modifier and Type | Field and Description |
|---|---|
static Duration |
DEFAULT_LIFETIME
Token lifetime, unless a specific lifetime is explicitly set.
|
| Modifier and Type | Method and Description |
|---|---|
JwtBuilder |
algorithm(SigningAlgorithm alg)
Sets the algorithm (alg) jws header.
|
JwtBuilder |
audience(Iterable<String> aud)
Sets the audience (aud) claim.
|
JwtBuilder |
audience(String... aud)
Sets the audience (aud) claim.
|
Jwt |
build() |
static JwtBuilder |
copyJwt(Jwt prototype)
Returns a builder initialised to make an identical copy of the given original Jwt.
|
JwtBuilder |
customClaims(javax.json.JsonObject customClaims)
Sets the custom claims for this jwt.
|
JwtBuilder |
expirationTime(Instant expiry)
Sets the expiration time (exp) claim.
|
JwtBuilder |
issuedAt(Instant iat)
Set the issued at (iat) claim.
|
JwtBuilder |
issuer(String iss)
Set the issuer (iss) claim.
|
JwtBuilder |
jwtId(String jti)
Set the jwt id (jti) claim.
|
JwtBuilder |
keyId(String keyId)
Sets the key id jws header.
|
static JwtBuilder |
newFromPrototype(Jwt jwtPrototype)
Construct a JWT builder initialised from a prototype JWT.
|
static JwtBuilder |
newJwt()
Construct a simple jwt builder initialised with default claim values as follows:
nbf, iat claim set to current system time
exp claim set current time plus default expiry as defined in
DEFAULT_LIFETIME
jti claim set to a random UUID. |
JwtBuilder |
notBefore(Optional<Instant> nbf)
Set the not before (nbf) claim.
|
JwtBuilder |
subject(Optional<String> sub)
Sets the subject (sub) claim for this jwt.
|
public static final Duration DEFAULT_LIFETIME
public static JwtBuilder newJwt()
DEFAULT_LIFETIME SigningAlgorithm.RS256. public static JwtBuilder newFromPrototype(Jwt jwtPrototype)
jwtPrototype - Jwt to use as prototypepublic static JwtBuilder copyJwt(Jwt prototype)
prototype - Jwt to use as originalpublic JwtBuilder keyId(String keyId)
keyId - the key id for the jws header of this jwtpublic JwtBuilder algorithm(SigningAlgorithm alg)
alg - the alg for the jws header of this jwtpublic JwtBuilder audience(Iterable<String> aud)
aud - an iterable containing one or more audiences for the jwtpublic JwtBuilder audience(String... aud)
aud - one or more audiences for the jwtpublic JwtBuilder expirationTime(Instant expiry)
expiry - the expiration timepublic JwtBuilder issuedAt(Instant iat)
iat - the issued at timepublic JwtBuilder issuer(String iss)
iss - the issuerpublic JwtBuilder jwtId(String jti)
jti - a unique id for the jwtpublic JwtBuilder notBefore(Optional<Instant> nbf)
nbf - the not before datepublic JwtBuilder subject(Optional<String> sub)
sub - the subjectpublic JwtBuilder customClaims(javax.json.JsonObject customClaims)
customClaims - the custom claimspublic Jwt build()
NullPointerException - if some required parameter has not been specifiedCopyright © 2017 Atlassian. All rights reserved.