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
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the JWT Claims Set.Returns the JOSE header(s).static Jwt.BuilderwithTokenValue(String tokenValue) Return aJwt.BuilderMethods inherited from class org.springframework.security.oauth2.core.AbstractOAuth2Token
equals, getExpiresAt, getIssuedAt, getTokenValue, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.oauth2.core.ClaimAccessor
containsClaim, getClaim, getClaimAsBoolean, getClaimAsInstant, getClaimAsMap, getClaimAsString, getClaimAsStringList, getClaimAsURL, hasClaimMethods 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 aJwtusing 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
Mapof the JOSE header(s)
-
getClaims
Returns the JWT Claims Set.- Specified by:
getClaimsin interfaceClaimAccessor- Returns:
- a
Mapof the JWT Claims Set
-
withTokenValue
Return aJwt.Builder- Returns:
- A
Jwt.Builder
-