public class JWT extends Object
From RFC 7519 Section 1. Introduction:
The suggested pronunciation of JWT is the same as the English word "jot".
The JWT is not Thread-Safe and should not be re-used.| Modifier and Type | Field and Description |
|---|---|
Object |
audience
Registered Claim
aud as defined by RFC 7519 Section 4.1.3. |
Map<String,Object> |
claims |
java.time.ZonedDateTime |
expiration
Registered Claim
exp as defined by RFC 7519 Section 4.1.4. |
java.time.ZonedDateTime |
issuedAt
Registered Claim
iat as defined by RFC 7519 Section 4.1.6. |
String |
issuer
Registered Claim
iss as defined by RFC 7519 Section 4.1.1. |
java.time.ZonedDateTime |
notBefore
Registered Claim
nbf as defined by RFC 7519 Section 4.1.5. |
String |
subject
Registered Claim
sub as defined by RFC 7519 Section 4.1.2. |
String |
uniqueId
Registered Claim
jti as defined by RFC 7519 Section 4.1.7. |
| Constructor and Description |
|---|
JWT() |
| Modifier and Type | Method and Description |
|---|---|
JWT |
addClaim(String name,
Object value)
Add a claim to this JWT.
|
Map<String,Object> |
anyGetter()
Special getter used to flatten the claims into top level properties.
|
boolean |
equals(Object o) |
Boolean |
getBoolean(String key) |
static JWTDecoder |
getDecoder()
Return a singleton instance of the JWT Decoder.
|
static JWTEncoder |
getEncoder()
Return a singleton instance of the JWT encoder.
|
Integer |
getInteger(String key) |
List<String> |
getList(String key) |
Long |
getLong(String key) |
Object |
getObject(String key) |
String |
getString(String key) |
int |
hashCode() |
boolean |
isExpired()
Return true if this JWT is expired.
|
boolean |
isUnavailableForProcessing()
Return true if this JWT is un-available for processing.
|
JWT |
setAudience(Object audience) |
JWT |
setExpiration(java.time.ZonedDateTime expiration) |
JWT |
setIssuedAt(java.time.ZonedDateTime issuedAt) |
JWT |
setIssuer(String issuer) |
JWT |
setNotBefore(java.time.ZonedDateTime notBefore) |
JWT |
setSubject(String subject) |
JWT |
setUniqueId(String uniqueId) |
public Object audience
aud as defined by RFC 7519 Section 4.1.3. Use of this claim is OPTIONAL.
The audience claim identifies the recipients that the JWT is intended for. This may be an array of strings or a
single string, in either case if the string value contains a : it must be a URI.
public java.time.ZonedDateTime expiration
exp as defined by RFC 7519 Section 4.1.4. Use of this claim is OPTIONAL.
The expiration time claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. The expiration time is expected to provided in UNIX time, or the number of seconds since Epoch.
public java.time.ZonedDateTime issuedAt
iat as defined by RFC 7519 Section 4.1.6. Use of this claim is OPTIONAL.
The issued at claim identifies the time at which the JWT was issued. The issued at time is expected to provided in UNIX time, or the number of seconds since Epoch.
public String issuer
iss as defined by RFC 7519 Section 4.1.1. Use of this claim is OPTIONAL.
The issuer claim identifies the principal that issued the JWT. If the value contains a : it must be a
URI.
public java.time.ZonedDateTime notBefore
nbf as defined by RFC 7519 Section 4.1.5. Use of this claim is OPTIONAL.
This claim identifies the time before which the JWT MUST NOT be accepted for processing. The not before value is expected to provided in UNIX time, or the number of seconds since Epoch.
public String subject
sub as defined by RFC 7519 Section 4.1.2. Use of this claim is OPTIONAL.
The subject claim identifies the principal that is the subject of the JWT. If the value contains a :
it must be a URI.
public String uniqueId
jti as defined by RFC 7519 Section 4.1.7. Use of this claim is OPTIONAL.
The JWT unique ID claim provides a unique identifier for the JWT.
public static JWTDecoder getDecoder()
public static JWTEncoder getEncoder()
public JWT addClaim(String name, Object value)
name - The name of the JWT claim.value - The value of the JWT claim. This value is an object and is expected to properly serialize.public Map<String,Object> anyGetter()
public boolean isExpired()
public boolean isUnavailableForProcessing()
public JWT setExpiration(java.time.ZonedDateTime expiration)
public JWT setIssuedAt(java.time.ZonedDateTime issuedAt)
public JWT setNotBefore(java.time.ZonedDateTime notBefore)
Copyright © 2017. All rights reserved.