Class Jwt
java.lang.Object
org.springframework.security.oauth2.core.AbstractOAuth2Token
org.springframework.security.oauth2.jwt.Jwt
- All Implemented Interfaces:
Serializable, org.springframework.security.oauth2.core.ClaimAccessor, org.springframework.security.oauth2.core.OAuth2Token, JwtClaimAccessor
public class Jwt
extends org.springframework.security.oauth2.core.AbstractOAuth2Token
implements 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.
- Since:
- 5.0
- See Also:
-
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 Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.oauth2.core.ClaimAccessor
getClaim, getClaimAsBoolean, getClaimAsInstant, getClaimAsMap, getClaimAsString, getClaimAsStringList, getClaimAsURL, hasClaimMethods inherited from interface JwtClaimAccessor
getAudience, getExpiresAt, getId, getIssuedAt, getIssuer, getNotBefore, getSubject
-
Constructor Details
-
Jwt
public Jwt(String tokenValue, @Nullable Instant issuedAt, @Nullable 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 issued, may benullexpiresAt- the expiration time on or after which the JWT MUST NOT be accepted, may benullheaders- the JOSE header(s)claims- the JWT Claims Set
-
-
Method Details
-
getHeaders
-
getClaims
-
withTokenValue
Return aJwt.Builder- Returns:
- A
Jwt.Builder
-