Class Verifier

java.lang.Object
net.pincette.jwt.Verifier

public class Verifier extends Object
Verifies JTWs using the Auth0 library. It selects the algorithm based on the given public key.
Author:
Werner Donné
  • Constructor Details

    • Verifier

      public Verifier(String publicKey)
      Creates a JWT verifier with a public key in PEM format. Only RSA and ECDSA are supported.
      Parameters:
      publicKey - the given public key of type RSA or ECDSA.
    • Verifier

      public Verifier(PublicKey publicKey)
      Creates a JWT verifier with a public key. Only RSA and ECDSA are supported.
      Parameters:
      publicKey - the given public key of type RSA or ECDSA.
  • Method Details

    • verify

      public Optional<DecodedJWT> verify(String jwt)
      Verifies the given JWT.
      Parameters:
      jwt - the given JWT.
      Returns:
      An optional value that will be empty when the JWT can't be verified.
    • verify

      public Optional<DecodedJWT> verify(DecodedJWT jwt)
      Verifies the given JWT.
      Parameters:
      jwt - the given JWT.
      Returns:
      An optional value that will be empty when the JWT can't be verified.