Package com.auth0.jwt
Class JWT
- java.lang.Object
-
- com.auth0.jwt.JWT
-
public class JWT extends Object
-
-
Constructor Summary
Constructors Constructor Description JWT()
Constructs a new instance of the JWT library.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JWTCreator.Builder
create()
Returns a Json Web Token builder used to create and sign tokensstatic DecodedJWT
decode(String token)
Decode a given Json Web Token.DecodedJWT
decodeJwt(String token)
Decode a given Json Web Token.static Verification
require(Algorithm algorithm)
Returns aJWTVerifier
builder with the algorithm to be used to validate token signature.
-
-
-
Method Detail
-
decodeJwt
public DecodedJWT decodeJwt(String token) throws JWTDecodeException
Decode a given Json Web Token.Note that this method doesn't verify the token's signature! Use it only if you trust the token or you already verified it.
- Parameters:
token
- with jwt format as string.- Returns:
- a decoded JWT.
- Throws:
JWTDecodeException
- if any part of the token contained an invalid jwt or JSON format of each of the jwt parts.
-
decode
public static DecodedJWT decode(String token) throws JWTDecodeException
Decode a given Json Web Token.Note that this method doesn't verify the token's signature! Use it only if you trust the token or you already verified it.
- Parameters:
token
- with jwt format as string.- Returns:
- a decoded JWT.
- Throws:
JWTDecodeException
- if any part of the token contained an invalid jwt or JSON format of each of the jwt parts.
-
require
public static Verification require(Algorithm algorithm)
Returns aJWTVerifier
builder with the algorithm to be used to validate token signature.- Parameters:
algorithm
- that will be used to verify the token's signature.- Returns:
JWTVerifier
builder- Throws:
IllegalArgumentException
- if the provided algorithm is null.
-
create
public static JWTCreator.Builder create()
Returns a Json Web Token builder used to create and sign tokens- Returns:
- a token builder.
-
-