public class JWTDecoder extends Object
Constructor and Description |
---|
JWTDecoder() |
Modifier and Type | Method and Description |
---|---|
JWT |
decode(String encodedJWT,
java.util.function.Function<String,Verifier> verifierFunction)
Decode the JWT using one of they provided verifiers.
|
JWT |
decode(String encodedJWT,
java.util.function.Function<String,Verifier> verifierFunction,
java.util.function.Function<Header,String> keyFunction)
Decode the JWT using one of they provided verifiers.
|
JWT |
decode(String encodedJWT,
Map<String,Verifier> verifiers)
Decode the JWT using one of they provided verifiers.
|
JWT |
decode(String encodedJWT,
Map<String,Verifier> verifiers,
java.util.function.Function<Header,String> keyFunction)
Decode the JWT using one of they provided verifiers.
|
JWT |
decode(String encodedJWT,
Verifier... verifiers)
Decode the JWT using one of they provided verifiers.
|
protected java.time.ZonedDateTime |
now() |
JWTDecoder |
withClockSkew(int clockSkew)
Specify the number of seconds allowed for clock skew used for calculating the expiration and not before instants of a JWT.
|
public JWT decode(String encodedJWT, Verifier... verifiers)
A JWT that is expired or not yet valid will not be decoded, instead a JWTExpiredException
or JWTUnavailableForProcessingException
exception will be thrown respectively.
encodedJWT
- The encoded JWT in string format.verifiers
- A map of verifiers.public JWTDecoder withClockSkew(int clockSkew)
The default value is 0
.
clockSkew
- the number of seconds allowed for clock skew.public JWT decode(String encodedJWT, Map<String,Verifier> verifiers)
kid
is expected to
contain the key to look up the correct verifier.
A JWT that is expired or not yet valid will not be decoded, instead a JWTExpiredException
or JWTUnavailableForProcessingException
exception will be thrown respectively.
encodedJWT
- The encoded JWT in string format.verifiers
- A map of verifiers.public JWT decode(String encodedJWT, java.util.function.Function<String,Verifier> verifierFunction)
kid
is expected to
contain the key to look up the correct verifier.
A JWT that is expired or not yet valid will not be decoded, instead a JWTExpiredException
or JWTUnavailableForProcessingException
exception will be thrown respectively.
encodedJWT
- The encoded JWT in string format.verifierFunction
- A function that takes a key identifier and returns a verifier.public JWT decode(String encodedJWT, java.util.function.Function<String,Verifier> verifierFunction, java.util.function.Function<Header,String> keyFunction)
kid
is expected to
contain the key to look up the correct verifier.
A JWT that is expired or not yet valid will not be decoded, instead a JWTExpiredException
or JWTUnavailableForProcessingException
exception will be thrown respectively.
encodedJWT
- The encoded JWT in string format.verifierFunction
- A function that takes a key identifier returns a verifier.keyFunction
- A function used to look up the verifier key from the header.public JWT decode(String encodedJWT, Map<String,Verifier> verifiers, java.util.function.Function<Header,String> keyFunction)
keyFunction
. The key function is provided the JWT header and is expected to return a string key to
look up the correct verifier.
A JWT that is expired or not yet valid will not be decoded, instead a JWTExpiredException
or JWTUnavailableForProcessingException
exception will be thrown respectively.
encodedJWT
- The encoded JWT in string format.verifiers
- A map of verifiers.keyFunction
- A function used to look up the verifier key from the header.protected java.time.ZonedDateTime now()
Copyright © 2022. All rights reserved.