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