Class Jwt
java.lang.Object
org.springframework.security.oauth2.core.AbstractOAuth2Token
org.springframework.security.oauth2.jwt.Jwt
- All Implemented Interfaces:
Serializable
,ClaimAccessor
,OAuth2Token
,JwtClaimAccessor
An implementation of an
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.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the JWT Claims Set.Returns the JOSE header(s).static Jwt.Builder
withTokenValue
(String tokenValue) Return aJwt.Builder
Methods inherited from class org.springframework.security.oauth2.core.AbstractOAuth2Token
equals, getExpiresAt, getIssuedAt, getTokenValue, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.security.oauth2.core.ClaimAccessor
containsClaim, getClaim, getClaimAsBoolean, getClaimAsInstant, getClaimAsMap, getClaimAsString, getClaimAsStringList, getClaimAsURL, hasClaim
Methods inherited from interface org.springframework.security.oauth2.jwt.JwtClaimAccessor
getAudience, getExpiresAt, getId, getIssuedAt, getIssuer, getNotBefore, getSubject
-
Constructor Details
-
Jwt
public Jwt(String tokenValue, Instant issuedAt, Instant expiresAt, Map<String, Object> headers, Map<String, Object> claims) Constructs aJwt
using the provided parameters.- 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 Set
-
-
Method Details
-
getHeaders
Returns the JOSE header(s).- Returns:
- a
Map
of the JOSE header(s)
-
getClaims
Returns the JWT Claims Set.- Specified by:
getClaims
in interfaceClaimAccessor
- Returns:
- a
Map
of the JWT Claims Set
-
withTokenValue
Return aJwt.Builder
- Returns:
- A
Jwt.Builder
-