Class JwtValidatorVertxImpl

java.lang.Object
uk.co.spudsoft.jwtvalidatorvertx.impl.JwtValidatorVertxImpl
All Implemented Interfaces:
JwtValidatorVertx

public class JwtValidatorVertxImpl extends Object implements JwtValidatorVertx
Token validation for vertx - implementation of JwtValidatorVertx.
Author:
Jim Talbut
  • Constructor Details

    • JwtValidatorVertxImpl

      public JwtValidatorVertxImpl(JsonWebKeySetHandler openIdDiscoveryHandler)
      Constructor.
      Parameters:
      openIdDiscoveryHandler - Handler for obtaining OpenIdDiscovery data and JWKs
  • Method Details

    • getPermittedAlgorithms

      public EnumSet<JsonWebAlgorithm> getPermittedAlgorithms()
      Description copied from interface: JwtValidatorVertx
      Get a copy of the current set of permitted algorithms.
      Specified by:
      getPermittedAlgorithms in interface JwtValidatorVertx
      Returns:
      a copy of the current set of permitted algorithms.
    • setPermittedAlgorithms

      public JwtValidatorVertx setPermittedAlgorithms(EnumSet<JsonWebAlgorithm> algorithms)
      Description copied from interface: JwtValidatorVertx
      Replace the current set of permitted algorithms with a new set.
      Specified by:
      setPermittedAlgorithms in interface JwtValidatorVertx
      Parameters:
      algorithms - The new set of permitted algorithms.
      Returns:
      this for fluent configuration.
    • addPermittedAlgorithm

      public JwtValidatorVertx addPermittedAlgorithm(JsonWebAlgorithm algorithm)
      Description copied from interface: JwtValidatorVertx
      Add a single algorithm to the current set of permitted algorithms.
      Specified by:
      addPermittedAlgorithm in interface JwtValidatorVertx
      Parameters:
      algorithm - The algorithm to add to the current set of permitted algorithms.
      Returns:
      this for fluent configuration.
    • setTimeLeewaySeconds

      public JwtValidatorVertx setTimeLeewaySeconds(long timeLeewaySeconds)
      Set the maximum amount of time that can pass between the exp and now.
      Specified by:
      setTimeLeewaySeconds in interface JwtValidatorVertx
      Parameters:
      timeLeewaySeconds - the maximum amount of time that can pass between the exp and now.
      Returns:
      this for fluent configuration.
    • setRequireExp

      public JwtValidatorVertx setRequireExp(boolean requireExp)
      Set to true if the token is required to have an exp claim.
      Specified by:
      setRequireExp in interface JwtValidatorVertx
      Parameters:
      requireExp - true if the token is required to have an exp claim.
      Returns:
      this for fluent configuration.
    • setRequireNbf

      public JwtValidatorVertx setRequireNbf(boolean requireNbf)
      Set to true if the token is required to have an nbf claim.
      Specified by:
      setRequireNbf in interface JwtValidatorVertx
      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 interface JwtValidatorVertx
      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.