Class Jwt
java.lang.Object
com.codename1.backend.security.oauth2.jwt.Jwt
A JSON Web Token whose signature has been made or verified: its text, the headers of its signature and its claims.
Jwt jwt = decoder.decode(token);
String user = jwt.getSubject();
List<String> groups = jwt.getClaimAsStringList("groups");
Times are seconds since the epoch, as the token carries them. This is not
com.codename1.backend.Jwt, the helper for HS256 tokens a server issues to
itself.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaud: whom the token is for.A claim as the JSON had it: a String, a Long or Double, a Boolean, a List or a Map; null when the token has none of that name.getClaimAsBoolean(String claim) A claim that is true or false, or the text of either; null otherwise.getClaimAsLong(String claim) A numeric claim as a whole number; null when the token has none of that name or it is not a number.getClaimAsString(String claim) A claim as text; null when the token has none of that name.getClaimAsStringList(String claim) A claim that is a list, or one value standing for a list of one: every element as text.expin seconds since the epoch, or null.The JOSE header:alg, andkidandtypwhen the token has them.getId()jti: the token's own id.iatin seconds since the epoch, or null.iss: who issued the token.nbfin seconds since the epoch, or null.sub: whom the token is about.The token as it travels: three base64url parts joined by dots.booleantoString()Returns a string representation of the object.
-
Constructor Details
-
Jwt
-
-
Method Details
-
getTokenValue
The token as it travels: three base64url parts joined by dots. -
getHeaders
-
getClaims
-
getClaim
-
hasClaim
-
getClaimAsString
-
getClaimAsBoolean
-
getClaimAsLong
-
getClaimAsStringList
-
getIssuer
iss: who issued the token. -
getSubject
sub: whom the token is about. -
getAudience
-
getExpiresAt
expin seconds since the epoch, or null. -
getNotBefore
nbfin seconds since the epoch, or null. -
getIssuedAt
iatin seconds since the epoch, or null. -
getId
jti: the token's own id. -
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-