Class Jwt
- java.lang.Object
-
- org.springframework.security.oauth2.core.AbstractOAuth2Token
-
- org.springframework.security.oauth2.jwt.Jwt
-
- All Implemented Interfaces:
java.io.Serializable
,ClaimAccessor
,JwtClaimAccessor
public class Jwt extends AbstractOAuth2Token implements JwtClaimAccessor
An implementation of anAbstractOAuth2Token
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:
AbstractOAuth2Token
,JwtClaimAccessor
, JSON Web Token (JWT), JSON Web Signature (JWS), JSON Web Encryption (JWE), Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Jwt.Builder
Helps configure aJwt
-
Constructor Summary
Constructors Constructor 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 aJwt
using the provided parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 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
-
Methods inherited from interface org.springframework.security.oauth2.jwt.JwtClaimAccessor
getAudience, getExpiresAt, getId, getIssuedAt, getIssuer, getNotBefore, getSubject
-
-
-
-
Constructor Detail
-
Jwt
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)
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 Detail
-
getHeaders
public java.util.Map<java.lang.String,java.lang.Object> getHeaders()
Returns the JOSE header(s).- Returns:
- a
Map
of the JOSE header(s)
-
getClaims
public java.util.Map<java.lang.String,java.lang.Object> getClaims()
Returns the JWT Claims Set.- Specified by:
getClaims
in interfaceClaimAccessor
- Returns:
- a
Map
of the JWT Claims Set
-
withTokenValue
public static Jwt.Builder withTokenValue(java.lang.String tokenValue)
Return aJwt.Builder
- Returns:
- A
Jwt.Builder
-
-