Class JWTSignatureValidationUtil
- java.lang.Object
-
- net.shibboleth.oidc.security.impl.JWTSignatureValidationUtil
-
public final class JWTSignatureValidationUtil extends Object
Generic utility class for helping JWT signature validation.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Modifier Constructor Description privateJWTSignatureValidationUtil()Private constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static com.nimbusds.jose.JWSVerifierinitializeVerifier(com.nimbusds.jose.Algorithm algorithm, Credential credential)Initializes aJWSVerifierfor the given algorithm, using the providedCredential.static StringvalidateSignature(List<JWKCredential> credentials, com.nimbusds.jwt.SignedJWT signedJwt, String invalidJwtEventId)Deprecated, for removal: This API element is subject to removal in a future version.static StringvalidateSignature(SecurityParametersContext secParamCtx, com.nimbusds.jwt.SignedJWT signedJwt, String invalidJwtEventId)Deprecated, for removal: This API element is subject to removal in a future version.static StringvalidateSignatureEx(Collection<? extends Credential> credentials, com.nimbusds.jwt.SignedJWT signedJwt, String invalidJwtEventId)Validates the signature of the given JWS against the given list of credentials.
-
-
-
Method Detail
-
validateSignature
@Deprecated(since="1.2.0", forRemoval=true) @Nullable public static String validateSignature(@Nullable SecurityParametersContext secParamCtx, @Nonnull com.nimbusds.jwt.SignedJWT signedJwt, @Nullable String invalidJwtEventId)
Deprecated, for removal: This API element is subject to removal in a future version.Validates the signature of the given JWT using the given security parameters context. If the validation fails for any reason, including insufficient prequisities in the context, an event identifier is returned. Successful validation produces a null result.Overloads
validateSignature(SecurityParametersContext, SignedJWT, String), but with a 'radically' different parameter.- Parameters:
secParamCtx- TheSecurityParametersContextto use for signature validation.signedJwt- The signed JWT to be validated.invalidJwtEventId- The event identifier describing the invalid JWT.- Returns:
- an event ID on failure, or null if validation succeeds.
-
validateSignature
@Deprecated(since="1.2.0", forRemoval=true) public static String validateSignature(@Nonnull List<JWKCredential> credentials, @Nonnull com.nimbusds.jwt.SignedJWT signedJwt, @Nullable String invalidJwtEventId)
Deprecated, for removal: This API element is subject to removal in a future version.Validates the signature of the given JWS against the given list of credentials. If the validation fails for any reason, including insufficient prequisities in the context, an event identifier is returned. Successful validation produces null result.- Parameters:
credentials- The list ofJWKCredentials to use for signature validation.signedJwt- The signed JWT to be validated.invalidJwtEventId- The event identifier describing the invalid JWT.- Returns:
- an event ID on failure, or null if validation succeeds.
-
validateSignatureEx
public static String validateSignatureEx(@Nonnull Collection<? extends Credential> credentials, @Nonnull com.nimbusds.jwt.SignedJWT signedJwt, @Nullable String invalidJwtEventId)
Validates the signature of the given JWS against the given list of credentials. If the validation fails for any reason, including insufficient prequisities in the context, an event identifier is returned. Successful validation produces null result.- Parameters:
credentials- The list ofCredentials to use for signature validation.signedJwt- The signed JWT to be validated.invalidJwtEventId- The event identifier describing the invalid JWT.- Returns:
- an event ID on failure, or null if validation succeeds.
-
initializeVerifier
private static com.nimbusds.jose.JWSVerifier initializeVerifier(com.nimbusds.jose.Algorithm algorithm, Credential credential) throws com.nimbusds.jose.JOSEExceptionInitializes aJWSVerifierfor the given algorithm, using the providedCredential.- Parameters:
algorithm- The algorithm used for deciding the verifier.credential- The credential to be used for the verifier.- Returns:
- A corresponding verifier, or null if no supported found.
- Throws:
com.nimbusds.jose.JOSEException- If the credential doesn't meet the verifier requirements.
-
-