public class Jwt extends AbstractOAuth2Token implements JwtClaimAccessor
AbstractOAuth2Token
representing a JSON Web Token (JWT).
JWTs represent a set of "claims" as a JSON object that may be encoded in a
JSON Web Signature (JWS) and/or JSON Web Encryption (JWE) structure.
The JSON object, also known as the JWT Claims Set, consists of one or more claim name/value pairs.
The claim name is a String
and the claim value is an arbitrary JSON object.
AbstractOAuth2Token
,
JwtClaimAccessor
,
JSON Web Token (JWT),
JSON Web Signature (JWS),
JSON Web Encryption (JWE),
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
Jwt.Builder
Helps configure a
Jwt |
Constructor and Description |
---|
Jwt(java.lang.String tokenValue,
java.time.Instant issuedAt,
java.time.Instant expiresAt,
java.util.Map<java.lang.String,java.lang.Object> headers,
java.util.Map<java.lang.String,java.lang.Object> claims)
Constructs a
Jwt using the provided parameters. |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
getClaims()
Returns the JWT Claims Set.
|
java.util.Map<java.lang.String,java.lang.Object> |
getHeaders()
Returns the JOSE header(s).
|
static Jwt.Builder |
withTokenValue(java.lang.String tokenValue)
Return a
Jwt.Builder |
equals, getExpiresAt, getIssuedAt, getTokenValue, hashCode
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getAudience, getExpiresAt, getId, getIssuedAt, getIssuer, getNotBefore, getSubject
containsClaim, getClaimAsBoolean, getClaimAsInstant, getClaimAsMap, getClaimAsString, getClaimAsStringList, getClaimAsURL
public Jwt(java.lang.String tokenValue, java.time.Instant issuedAt, java.time.Instant expiresAt, java.util.Map<java.lang.String,java.lang.Object> headers, java.util.Map<java.lang.String,java.lang.Object> claims)
Jwt
using the provided parameters.tokenValue
- the token valueissuedAt
- the time at which the JWT was issuedexpiresAt
- the expiration time on or after which the JWT MUST NOT be acceptedheaders
- the JOSE header(s)claims
- the JWT Claims Setpublic java.util.Map<java.lang.String,java.lang.Object> getHeaders()
Map
of the JOSE header(s)public java.util.Map<java.lang.String,java.lang.Object> getClaims()
getClaims
in interface ClaimAccessor
Map
of the JWT Claims Setpublic static Jwt.Builder withTokenValue(java.lang.String tokenValue)
Jwt.Builder
Jwt.Builder