Class JWTSignatureValidationUtil
java.lang.Object
net.shibboleth.oidc.security.impl.JWTSignatureValidationUtil
Generic utility class for helping JWT signature validation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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.
-
Field Details
-
log
@Nonnull private static org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
JWTSignatureValidationUtil
private JWTSignatureValidationUtil()Private constructor.
-
-
Method Details
-
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.JOSEException Initializes 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.
-