Skip to content

Commit

Permalink
feat(authentication-webhook): change way to retrieve algorithm, more …
Browse files Browse the repository at this point in the history
…flexible 3
  • Loading branch information
mathias-vandaele committed Jan 13, 2025
1 parent d69fcfe commit 2209944
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,14 @@ private static DecodedJWT verifyJWT(String jwtToken, JwkProvider jwkProvider)

private static Algorithm getAlgorithm(String algorithm, PublicKey publicKey)
throws InvalidPublicKeyException {
LOGGER.debug("Using algorithm: " + algorithm);
return switch (algorithm) {
case "RS256" -> Algorithm.RSA256((RSAPublicKey) publicKey);
case "RS384" -> Algorithm.RSA384((RSAPublicKey) publicKey);
case "RS512" -> Algorithm.RSA512((RSAPublicKey) publicKey);
case "ES256" -> Algorithm.ECDSA256((ECPublicKey) publicKey, null);
case "ES384" -> Algorithm.ECDSA384((ECPublicKey) publicKey, null);
case "ES512" -> Algorithm.ECDSA512((ECPublicKey) publicKey, null);
default -> throw new RuntimeException("Unknown algorithm!");
default -> throw new RuntimeException("Unknown algorithm: " + algorithm);
};
}

Expand Down

0 comments on commit 2209944

Please sign in to comment.