Package akka.javasdk
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.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.boolean
Does 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
Returns the names of all the claims in this request.- Returns:
- The names of all the claims in this request.
-
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
boolean hasClaims()Does this request have any claims that have been validated?- Returns:
- true if there are claims.
-
issuer
Get the issuer, that is, the iss claim, as described in RFC 7519 section 4.1.1.- Returns:
- the issuer, if present.
- See Also:
-
subject
Get the subject, that is, the sub claim, as described in RFC 7519 section 4.1.2.- Returns:
- the subject, if present.
- See Also:
-
audience
Get the audience, that is, the aud claim, as described in RFC 7519 section 4.1.3.- Returns:
- the audience, if present.
- See Also:
-
expirationTime
Get the expiration time, that is, the exp claim, as described in RFC 7519 section 4.1.4.- Returns:
- the expiration time, if present. Returns empty if the value is not a numeric date.
- See Also:
-
notBefore
Get the not before, that is, the nbf claim, as described in RFC 7519 section 4.1.5.- Returns:
- the not before, if present. Returns empty if the value is not a numeric date.
- See Also:
-
issuedAt
Get the issued at, that is, the iat claim, as described in RFC 7519 section 4.1.6.- Returns:
- the issued at, if present. Returns empty if the value is not a numeric date.
- See Also:
-
jwtId
Get the JWT ID, that is, the jti claim, as described in RFC 7519 section 4.1.7.- Returns:
- the JWT ID, if present.
- See Also:
-
getString
Get the string claim with the given name.Note that if the claim with the given name is not a string claim, this will return the JSON encoding of it.
- Parameters:
name
- The name of the claim.- Returns:
- The string claim, if present.
-
getInteger
Get the integer claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The integer claim, if present. Returns empty if the claim is not an integer or can't be parsed as an integer.
-
getLong
Get the long claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The long claim, if present. Returns empty if the claim is not a long or can't be parsed as an long.
-
getDouble
Get the double claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The double claim, if present. Returns empty if the claim is not a double or can't be parsed as an double.
-
getBoolean
Get the boolean claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The boolean claim, if present. Returns empty if the claim is not a boolean or can't be parsed as a boolean.
-
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
Get the string list claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The string list claim, if present. Returns empty if the claim is not a JSON array of strings or cannot be parsed as a JSON array of strings.
-
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
Get the long list claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The long list claim, if present. Returns empty if the claim is not a JSON array of longs or cannot be parsed as a JSON array of longs.
-
getDoubleList
Get the double list claim with the given name.- Parameters:
name
- The name of the claim.- Returns:
- The double list claim, if present. Returns empty if the claim is not a JSON array of doubles or cannot be parsed as a JSON array of doubles.
-
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.
-