Package org.opencastproject.security.jwt
Class JWTVerifier
java.lang.Object
org.opencastproject.security.jwt.JWTVerifier
Helper class to verify JWTs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.nimbusds.jwt.SignedJWTverify(com.nimbusds.jwt.SignedJWT jwt, List<String> claimConstraints, com.nimbusds.jose.JWSVerifier... verifiers) static com.nimbusds.jwt.SignedJWTVerifies a given JWT string with a secret and given claim constraints.static com.nimbusds.jwt.SignedJWTverify(String token, JWKSetProvider retriever, List<String> claimConstraints) Verifies a given JWT string with a given JWK provider and given claim constraints.
-
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
-