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.auth0.jwt.interfaces.DecodedJWTverify(com.auth0.jwt.interfaces.DecodedJWT jwt, List<String> claimConstraints, com.auth0.jwt.algorithms.Algorithm... algorithms) Verifies a given decoded JWT with the given claim constraints and algorithms.static com.auth0.jwt.interfaces.DecodedJWTverify(com.auth0.jwt.interfaces.DecodedJWT jwt, List<String> claimConstraints, List<com.auth0.jwt.algorithms.Algorithm> algorithms) Verifies a given decoded JWT with the given claim constraints and algorithms.static com.auth0.jwt.interfaces.DecodedJWTVerifies a given JWT string with a secret and given claim constraints.static com.auth0.jwt.interfaces.DecodedJWTverify(String token, GuavaCachedUrlJwkProvider provider, List<String> claimConstraints) Verifies a given JWT string with a given JWK provider and given claim constraints.
-
Method Details
-
verify
public static com.auth0.jwt.interfaces.DecodedJWT verify(String token, GuavaCachedUrlJwkProvider provider, List<String> claimConstraints) throws com.auth0.jwk.JwkException Verifies a given JWT string with a given JWK provider and given claim constraints.- Parameters:
token- The JWT string.provider- The JWK provider.claimConstraints- The claim constraints.- Returns:
- The decoded and verified JWT.
- Throws:
com.auth0.jwk.JwkException- If the JWT cannot be verified successfully.
-
verify
public static com.auth0.jwt.interfaces.DecodedJWT verify(String token, String secret, List<String> claimConstraints) throws com.auth0.jwt.exceptions.JWTVerificationException 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.auth0.jwt.exceptions.JWTVerificationException- If the JWT cannot be verified successfully.
-
verify
public static com.auth0.jwt.interfaces.DecodedJWT verify(com.auth0.jwt.interfaces.DecodedJWT jwt, List<String> claimConstraints, List<com.auth0.jwt.algorithms.Algorithm> algorithms) throws com.auth0.jwt.exceptions.JWTVerificationException Verifies a given decoded JWT with the given claim constraints and algorithms. The verification has to be successful with at least one provided algorithm. Otherwise aJWTVerificationExceptionis thrown.- Parameters:
jwt- The decoded JWT.claimConstraints- The claim constraints.algorithms- The algorithms.- Returns:
- The decoded and verified JWT.
- Throws:
com.auth0.jwt.exceptions.JWTVerificationException- If the JWT cannot be verified successfully.
-
verify
public static com.auth0.jwt.interfaces.DecodedJWT verify(com.auth0.jwt.interfaces.DecodedJWT jwt, List<String> claimConstraints, com.auth0.jwt.algorithms.Algorithm... algorithms) throws com.auth0.jwt.exceptions.JWTVerificationException Verifies a given decoded JWT with the given claim constraints and algorithms. The verification has to be successful with at least one provided algorithm. Otherwise aJWTVerificationExceptionis thrown.- Parameters:
jwt- The decoded JWT.claimConstraints- The claim constraints.algorithms- The algorithms.- Returns:
- The decoded and verified JWT.
- Throws:
com.auth0.jwt.exceptions.JWTVerificationException- If the JWT cannot be verified successfully.
-