You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2021/01/11 17:55:46 UTC

[GitHub] [knox] risdenk commented on a change in pull request #397: KNOX-2527 - Added support for HMAC signature/verification in JWT token authority

risdenk commented on a change in pull request #397:
URL: https://github.com/apache/knox/pull/397#discussion_r555234268



##########
File path: gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenAuthorityService.java
##########
@@ -78,17 +83,22 @@
   private GatewayConfig config;
 
   private char[] cachedSigningKeyPassphrase;
+  private byte[] cachedSigningHmacSecret;
   private RSAPrivateKey signingKey;
 
   static {
-      // Only standard RSA signature algorithms are accepted
+      // Only standard RSA and HMAC signature algorithms are accepted
       // https://tools.ietf.org/html/rfc7518
       SUPPORTED_SIG_ALGS.add("RS256");
       SUPPORTED_SIG_ALGS.add("RS384");
       SUPPORTED_SIG_ALGS.add("RS512");
       SUPPORTED_SIG_ALGS.add("PS256");
       SUPPORTED_SIG_ALGS.add("PS384");
       SUPPORTED_SIG_ALGS.add("PS512");
+      //HMAC
+      SUPPORTED_SIG_ALGS.add("HS256");
+      SUPPORTED_SIG_ALGS.add("HS384");
+      SUPPORTED_SIG_ALGS.add("HS512");

Review comment:
       Would it make sense to have two `SUPPORTED_SIG_ALGS` lists? One for PKI and the other for HMAC? Then can check and hopefully provide a better error message if the wrong signature algorithm is chosen for the wrong method? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org