Class JwksSignatureUtils
- java.lang.Object
-
- io.micronaut.security.token.jwt.signature.jwks.JwksSignatureUtils
-
@Internal public final class JwksSignatureUtils extends java.lang.ObjectUtility class to verify signatures with aJWKSet.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<com.nimbusds.jose.jwk.JWK>matches(com.nimbusds.jwt.SignedJWT jwt, com.nimbusds.jose.jwk.JWKSet jwkSet, com.nimbusds.jose.jwk.KeyType keyType)Calculates a list of JWK matches for a JWT.static java.lang.StringsupportedAlgorithmsMessage(com.nimbusds.jose.jwk.JWKSet jwkSet)static java.lang.StringsupportedAlgorithmsMessage(java.util.List<com.nimbusds.jose.jwk.JWK> keys)static booleansupports(com.nimbusds.jose.JWSAlgorithm algorithm, com.nimbusds.jose.jwk.JWKSet jwkSet)Whether this signature configuration supports this algorithm.static booleansupports(com.nimbusds.jose.JWSAlgorithm algorithm, java.util.List<com.nimbusds.jose.jwk.JWK> keys)Whether this signature configuration supports this algorithm.static booleanverify(com.nimbusds.jwt.SignedJWT jwt, com.nimbusds.jose.jwk.JWKSet jwkSet, JwkValidator jwkValidator)Verify a signed JWT.static booleanverify(JwkValidator jwkValidator, java.util.List<com.nimbusds.jose.jwk.JWK> matches, com.nimbusds.jwt.SignedJWT jwt)returns true if any JWK match is able to verify the JWT signature.
-
-
-
Method Detail
-
verify
public static boolean verify(com.nimbusds.jwt.SignedJWT jwt, com.nimbusds.jose.jwk.JWKSet jwkSet, JwkValidator jwkValidator) throws com.nimbusds.jose.JOSEExceptionVerify a signed JWT.- Parameters:
jwkSet- JSON Web Key Setjwt- the signed JWTjwkValidator- JWK Validator- Returns:
- whether the signed JWT is verified
- Throws:
com.nimbusds.jose.JOSEException- exception when verifying the JWT
-
supports
public static boolean supports(com.nimbusds.jose.JWSAlgorithm algorithm, com.nimbusds.jose.jwk.JWKSet jwkSet)Whether this signature configuration supports this algorithm.- Parameters:
jwkSet- JSON Web Key Setalgorithm- the signature algorithm- Returns:
- whether this signature configuration supports this algorithm
-
supports
public static boolean supports(com.nimbusds.jose.JWSAlgorithm algorithm, java.util.List<com.nimbusds.jose.jwk.JWK> keys)Whether this signature configuration supports this algorithm.- Parameters:
keys- JSON Web Keysalgorithm- the signature algorithm- Returns:
- whether this signature configuration supports this algorithm
-
supportedAlgorithmsMessage
public static java.lang.String supportedAlgorithmsMessage(com.nimbusds.jose.jwk.JWKSet jwkSet)
- Parameters:
jwkSet- JSON Web Key Set- Returns:
- A message indicating the supported algorithms.
-
supportedAlgorithmsMessage
public static java.lang.String supportedAlgorithmsMessage(java.util.List<com.nimbusds.jose.jwk.JWK> keys)
- Parameters:
keys- JSON Web Keys- Returns:
- A message indicating the supported algorithms.
-
verify
public static boolean verify(JwkValidator jwkValidator, java.util.List<com.nimbusds.jose.jwk.JWK> matches, com.nimbusds.jwt.SignedJWT jwt)
returns true if any JWK match is able to verify the JWT signature.- Parameters:
jwkValidator- JWK Validatormatches- A List of JSON Web key matches.jwt- A JWT to be verified.- Returns:
- true if the JWT signature could be verified.
-
matches
public static java.util.List<com.nimbusds.jose.jwk.JWK> matches(com.nimbusds.jwt.SignedJWT jwt, @Nullable com.nimbusds.jose.jwk.JWKSet jwkSet, @Nullable com.nimbusds.jose.jwk.KeyType keyType)Calculates a list of JWK matches for a JWT.- Parameters:
jwt- A Signed JWTjwkSet- A JSON Web Key SetkeyType- Key Type- Returns:
- a List of JSON Web Keys
-
-