Interface JwtClaims
public interface JwtClaims
Representation of JWT claims that have been validated and extracted from the bearer token of a
request.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the names of all the claims in this request.asMap()Returns all the claims as a map of strings to strings.audience()Get the audience, that is, the aud claim, as described in RFC 7519 section 4.1.3.Get the expiration time, that is, the exp claim, as described in RFC 7519 section 4.1.4.getBoolean(String name) Get the boolean claim with the given name.getBooleanList(String name) Get the boolean list claim with the given name.Get the double claim with the given name.getDoubleList(String name) Get the double list claim with the given name.getInteger(String name) Get the integer claim with the given name.getIntegerList(String name) Get the integer list claim with the given name.Get the long claim with the given name.getLongList(String name) Get the long list claim with the given name.getNumericDate(String name) Get the numeric data claim with the given name.getNumericDateList(String name) Get the numeric date list claim with the given name.default Optional<com.fasterxml.jackson.databind.JsonNode> Get the object claim with the given name.getObjectList(String name) Get the object list claim with the given name.Get the string claim with the given name.getStringList(String name) Get the string list claim with the given name.default booleanDoes this request have any claims that have been validated?issuedAt()Get the issued at, that is, the iat claim, as described in RFC 7519 section 4.1.6.issuer()Get the issuer, that is, the iss claim, as described in RFC 7519 section 4.1.1.jwtId()Get the JWT ID, that is, the jti claim, as described in RFC 7519 section 4.1.7.Get the not before, that is, the nbf claim, as described in RFC 7519 section 4.1.5.subject()Get the subject, that is, the sub claim, as described in RFC 7519 section 4.1.2.
-
Method Details
-
allClaimNames
-
asMap
Returns all the claims as a map of strings to strings.If the claim is a String claim, the value will be the raw String. For all other types, it will be the value of the claim encoded to JSON.
- Returns:
- All the claims represented as a map of string claim names to string values.
-
hasClaims
default boolean hasClaims()Does this request have any claims that have been validated?- Returns:
- true if there are claims.
-
issuer
-
subject
-
audience
-
expirationTime
-
notBefore
-
issuedAt
-
jwtId
-
getString
-
getInteger
-
getLong
-
getDouble
-
getBoolean
-
getNumericDate
Get the numeric data claim with the given name.Numeric dates are expressed as a number of seconds since epoch, as described in RFC 7519 section 2.
- Parameters:
name- The name of the claim.- Returns:
- The numeric date claim, if present. Returns empty if the claim is not a numeric date or can't be parsed as a numeric date.
- See Also:
-
getObject
Get the object claim with the given name.This returns the claim as a Jackson JsonNode AST.
- Parameters:
name- The name of the claim.- Returns:
- The object claim, if present. Returns empty if the claim is not an object or can't be parsed as an object.
-
getStringList
-
getIntegerList
Get the integer list claim with the given name.- Parameters:
name- The name of the claim.- Returns:
- The integer list claim, if present. Returns empty if the claim is not a JSON array of integers or cannot be parsed as a JSON array of integers.
-
getLongList
-
getDoubleList
-
getBooleanList
Get the boolean list claim with the given name.- Parameters:
name- The name of the claim.- Returns:
- The boolean list claim, if present. Returns empty if the claim is not a JSON array of booleans or cannot be parsed as a JSON array of booleans.
-
getNumericDateList
Get the numeric date list claim with the given name.- Parameters:
name- The name of the claim.- Returns:
- The numeric date list claim, if present. Returns empty if the claim is not a JSON array of numeric dates or cannot be parsed as a JSON array of numeric dates.
-
getObjectList
Get the object list claim with the given name.- Parameters:
name- The name of the claim.- Returns:
- The object list claim, if present. Returns empty if the claim is not a JSON array of objects or cannot be parsed as a JSON array of objects.
-