spacewander commented on a change in pull request #2594:
URL: https://github.com/apache/apisix/pull/2594#discussion_r518460652



##########
File path: apisix/plugins/jwt-auth.lua
##########
@@ -280,14 +295,9 @@ local function gen_token()
 
     core.log.info("consumer: ", core.json.delay_encode(consumer))
 
-    if not consumer.auth_conf.algorithm or consumer.auth_conf.algorithm == 
"HS256"
-            or consumer.auth_conf.algorithm == "HS512" then
-        local jwt_token = sign_jwt_with_HS(key,consumer.auth_conf)
-        core.response.exit(200, jwt_token)
-    end
-
-    if consumer.auth_conf.algorithm == "RS256" then
-        local jwt_token = sign_jwt_with_RS256(key,consumer.auth_conf)
+    local sign_handler, _ = algorithm_handler(consumer)
+    local jwt_token = sign_handler(key, consumer.auth_conf)
+    if jwt_token then
         core.response.exit(200, jwt_token)

Review comment:
       Better to add a `return` before it.




----------------------------------------------------------------
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:
[email protected]


Reply via email to