Class JWTVerifier

java.lang.Object
org.opencastproject.security.jwt.JWTVerifier

public final class JWTVerifier extends Object
Helper class to verify JWTs.
  • Method Details

    • verify

      public static com.nimbusds.jwt.SignedJWT verify(String token, JWKSetProvider retriever, List<String> claimConstraints) throws com.nimbusds.jose.JOSEException, ParseException
      Verifies a given JWT string with a given JWK provider and given claim constraints.
      Parameters:
      token - The JWT string.
      retriever - The JWK provider.
      claimConstraints - The claim constraints.
      Returns:
      The decoded and verified JWT.
      Throws:
      com.nimbusds.jose.JOSEException - If the JWT cannot be verified successfully.
      ParseException - If some part of the JWT cannot be parsed successfully.
    • verify

      public static com.nimbusds.jwt.SignedJWT verify(String token, String secret, List<String> claimConstraints) throws com.nimbusds.jose.JOSEException, ParseException
      Verifies a given JWT string with a secret and given claim constraints.
      Parameters:
      token - The JWT string.
      secret - The secret.
      claimConstraints - The claim constraints.
      Returns:
      The decoded and verified JWT.
      Throws:
      com.nimbusds.jose.JOSEException - If the JWT cannot be verified successfully.
      ParseException
    • verify

      public static com.nimbusds.jwt.SignedJWT verify(com.nimbusds.jwt.SignedJWT jwt, List<String> claimConstraints, com.nimbusds.jose.JWSVerifier... verifiers) throws com.nimbusds.jose.JOSEException
      Throws:
      com.nimbusds.jose.JOSEException