Class JwtValidatorVertxImpl
java.lang.Object
uk.co.spudsoft.jwtvalidatorvertx.impl.JwtValidatorVertxImpl
- All Implemented Interfaces:
JwtValidatorVertx
Token validation for vertx - implementation of
JwtValidatorVertx
.- Author:
- Jim Talbut
-
Constructor Summary
ConstructorsConstructorDescriptionJwtValidatorVertxImpl
(JsonWebKeySetHandler openIdDiscoveryHandler) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddPermittedAlgorithm
(JsonWebAlgorithm algorithm) Add a single algorithm to the current set of permitted algorithms.Get a copy of the current set of permitted algorithms.setPermittedAlgorithms
(EnumSet<JsonWebAlgorithm> algorithms) Replace the current set of permitted algorithms with a new set.setRequireExp
(boolean requireExp) Set to true if the token is required to have an exp claim.setRequireNbf
(boolean requireNbf) Set to true if the token is required to have an nbf claim.setTimeLeewaySeconds
(long timeLeewaySeconds) Set the maximum amount of time that can pass between the exp and now.io.vertx.core.Future<JWT>
validateToken
(String token, List<String> requiredAudList, boolean ignoreRequiredAud) Validate the token and either throw an exception or return it's constituent parts.
-
Constructor Details
-
JwtValidatorVertxImpl
Constructor.- Parameters:
openIdDiscoveryHandler
- Handler for obtaining OpenIdDiscovery data and JWKs
-
-
Method Details
-
getPermittedAlgorithms
Description copied from interface:JwtValidatorVertx
Get a copy of the current set of permitted algorithms.- Specified by:
getPermittedAlgorithms
in interfaceJwtValidatorVertx
- Returns:
- a copy of the current set of permitted algorithms.
-
setPermittedAlgorithms
Description copied from interface:JwtValidatorVertx
Replace the current set of permitted algorithms with a new set.- Specified by:
setPermittedAlgorithms
in interfaceJwtValidatorVertx
- Parameters:
algorithms
- The new set of permitted algorithms.- Returns:
- this for fluent configuration.
-
addPermittedAlgorithm
Description copied from interface:JwtValidatorVertx
Add a single algorithm to the current set of permitted algorithms.- Specified by:
addPermittedAlgorithm
in interfaceJwtValidatorVertx
- Parameters:
algorithm
- The algorithm to add to the current set of permitted algorithms.- Returns:
- this for fluent configuration.
-
setTimeLeewaySeconds
Set the maximum amount of time that can pass between the exp and now.- Specified by:
setTimeLeewaySeconds
in interfaceJwtValidatorVertx
- Parameters:
timeLeewaySeconds
- the maximum amount of time that can pass between the exp and now.- Returns:
- this for fluent configuration.
-
setRequireExp
Set to true if the token is required to have an exp claim.- Specified by:
setRequireExp
in interfaceJwtValidatorVertx
- Parameters:
requireExp
- true if the token is required to have an exp claim.- Returns:
- this for fluent configuration.
-
setRequireNbf
Set to true if the token is required to have an nbf claim.- Specified by:
setRequireNbf
in interfaceJwtValidatorVertx
- Parameters:
requireNbf
- true if the token is required to have an nbf claim.- Returns:
- this for fluent configuration.
-
validateToken
public io.vertx.core.Future<JWT> validateToken(String token, List<String> requiredAudList, boolean ignoreRequiredAud) Validate the token and either throw an exception or return it's constituent parts.- Specified by:
validateToken
in interfaceJwtValidatorVertx
- Parameters:
token
- The token.requiredAudList
- List of audiences, all of which must be claimed by the token. If null the defaultRequiredAud is used.ignoreRequiredAud
- Do not check for required audiences.- Returns:
- The token's parts.
-