Package akka.http.jwt.internal
Class JwtClaimsImpl
- java.lang.Object
-
- akka.http.jwt.internal.JwtClaimsImpl
-
public final class JwtClaimsImpl extends java.lang.Object implements JwtClaims, JwtClaims, scala.Product, java.io.Serializable
INTERNAL APIJwtClaims provides utilities to easily assert and extract claims from the JWT token
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JwtClaimsImpl(spray.json.JsObject claims)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract static R
apply(T1 v1)
scala.Option<java.lang.Object>
booleanClaim(java.lang.String name)
Extracts a boolean claim from the list of claims.spray.json.JsObject
claims()
scala.Option<java.lang.Object>
doubleClaim(java.lang.String name)
Extracts a double claim from the list of claims.java.util.Optional<java.lang.Object>
getBooleanClaim(java.lang.String name)
Extracts a boolean claim from the list of claims.java.util.Optional<java.lang.Object>
getDoubleClaim(java.lang.String name)
Extracts a double claim from the list of claims.java.util.Optional<java.lang.Object>
getIntClaim(java.lang.String name)
Extracts an integer claim from the list of claims.java.util.Optional<java.lang.Object>
getLongClaim(java.lang.String name)
Extracts a long claim from the list of claims.java.util.Optional<java.lang.String>
getRawClaim(java.lang.String name)
Extracts a raw claim from the list of claims.java.util.Optional<java.lang.String>
getStringClaim(java.lang.String name)
Extracts a string claim from the list of claims.java.util.List<java.lang.String>
getStringClaims(java.lang.String name)
Extracts a list of string claims from the list of claims.boolean
hasClaim(java.lang.String name)
Checks if a claim with the given name exists in the list of claims.scala.Option<java.lang.Object>
intClaim(java.lang.String name)
Extracts an integer claim from the list of claims.scala.Option<java.lang.Object>
longClaim(java.lang.String name)
Extracts a long claim from the list of claims.scala.Option<spray.json.JsValue>
rawClaim(java.lang.String name)
Extracts a raw claim from the list of claims.scala.Option<java.lang.String>
stringClaim(java.lang.String name)
Extracts a string claim from the list of claims.scala.collection.immutable.List<java.lang.String>
stringClaims(java.lang.String name)
Extracts a list of string claims from the list of claims.static java.lang.String
toString()
-
-
-
Method Detail
-
apply
public abstract static R apply(T1 v1)
-
toString
public static java.lang.String toString()
-
claims
public spray.json.JsObject claims()
-
hasClaim
public boolean hasClaim(java.lang.String name)
Description copied from interface:JwtClaims
Checks if a claim with the given name exists in the list of claims.
-
intClaim
public scala.Option<java.lang.Object> intClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts an integer claim from the list of claims.
-
longClaim
public scala.Option<java.lang.Object> longClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a long claim from the list of claims.
-
doubleClaim
public scala.Option<java.lang.Object> doubleClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a double claim from the list of claims.- Specified by:
doubleClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Option containing the double value of the claim if it exists and is a double, None otherwise.
-
stringClaim
public scala.Option<java.lang.String> stringClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a string claim from the list of claims.- Specified by:
stringClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Option containing the string value of the claim if it exists and is a string, None otherwise.
-
stringClaims
public scala.collection.immutable.List<java.lang.String> stringClaims(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a list of string claims from the list of claims.- Specified by:
stringClaims
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- a List containing the string values of the claim if it exists and is a list of strings, empty list otherwise.
-
booleanClaim
public scala.Option<java.lang.Object> booleanClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a boolean claim from the list of claims.- Specified by:
booleanClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Option containing the boolean value of the claim if it exists and is a boolean, None otherwise.
-
rawClaim
public scala.Option<spray.json.JsValue> rawClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a raw claim from the list of claims. This can be useful if you need to extract a claim that is not a primitive type but a complex one.
-
getIntClaim
public java.util.Optional<java.lang.Object> getIntClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts an integer claim from the list of claims.- Specified by:
getIntClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Optional containing the integer value of the claim if it exists and is an integer, Optional.empty otherwise.
-
getLongClaim
public java.util.Optional<java.lang.Object> getLongClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a long claim from the list of claims.- Specified by:
getLongClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Optional containing the long value of the claim if it exists and is a long, Optional.empty otherwise.
-
getDoubleClaim
public java.util.Optional<java.lang.Object> getDoubleClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a double claim from the list of claims.- Specified by:
getDoubleClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Optional containing the double value of the claim if it exists and is a double, Optional.empty otherwise.
-
getStringClaim
public java.util.Optional<java.lang.String> getStringClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a string claim from the list of claims.- Specified by:
getStringClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Optional containing the string value of the claim if it exists and is a string, Optional.empty otherwise.
-
getStringClaims
public java.util.List<java.lang.String> getStringClaims(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a list of string claims from the list of claims.- Specified by:
getStringClaims
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- a List containing the string values of the claim if it exists and is a list of strings, empty list otherwise.
-
getBooleanClaim
public java.util.Optional<java.lang.Object> getBooleanClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a boolean claim from the list of claims.- Specified by:
getBooleanClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Optional containing the boolean value of the claim if it exists and is a boolean, Optional.empty otherwise.
-
getRawClaim
public java.util.Optional<java.lang.String> getRawClaim(java.lang.String name)
Description copied from interface:JwtClaims
Extracts a raw claim from the list of claims. This can be useful if you need to extract a claim that is not a primitive type but a complex one.- Specified by:
getRawClaim
in interfaceJwtClaims
- Parameters:
name
- the name of the claim.- Returns:
- an Optional containing the raw JSON String value of the claim if it exists, Optional.empty otherwise.
-
-