This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new a29568daa refactor(jwt-auth): remove unused parameter (#9716)
a29568daa is described below

commit a29568daad75d7441761dfb9fca310b33035a733
Author: Reid <[email protected]>
AuthorDate: Tue Jun 27 15:05:45 2023 +0800

    refactor(jwt-auth): remove unused parameter (#9716)
---
 apisix/plugins/jwt-auth.lua | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/apisix/plugins/jwt-auth.lua b/apisix/plugins/jwt-auth.lua
index f195830a6..26211b98d 100644
--- a/apisix/plugins/jwt-auth.lua
+++ b/apisix/plugins/jwt-auth.lua
@@ -220,7 +220,7 @@ local function fetch_jwt_token(conf, ctx)
     return val
 end
 
-local function get_secret(conf, consumer_name)
+local function get_secret(conf)
     local secret = conf.secret
 
     if conf.base64_secret then
@@ -231,7 +231,7 @@ local function get_secret(conf, consumer_name)
 end
 
 
-local function get_rsa_or_ecdsa_keypair(conf, consumer_name)
+local function get_rsa_or_ecdsa_keypair(conf)
     local public_key = conf.public_key
     local private_key = conf.private_key
 
@@ -261,7 +261,7 @@ end
 
 
 local function sign_jwt_with_HS(key, consumer, payload)
-    local auth_secret, err = get_secret(consumer.auth_conf, consumer.username)
+    local auth_secret, err = get_secret(consumer.auth_conf)
     if not auth_secret then
         core.log.error("failed to sign jwt, err: ", err)
         core.response.exit(503, "failed to sign jwt")
@@ -286,7 +286,7 @@ end
 
 local function sign_jwt_with_RS256_ES256(key, consumer, payload)
     local public_key, private_key, err = get_rsa_or_ecdsa_keypair(
-        consumer.auth_conf, consumer.username
+        consumer.auth_conf
     )
     if not public_key then
         core.log.error("failed to sign jwt, err: ", err)
@@ -321,13 +321,13 @@ local function algorithm_handler(consumer, method_only)
             return sign_jwt_with_HS
         end
 
-        return get_secret(consumer.auth_conf, consumer.username)
+        return get_secret(consumer.auth_conf)
     elseif consumer.auth_conf.algorithm == "RS256" or 
consumer.auth_conf.algorithm == "ES256"  then
         if method_only then
             return sign_jwt_with_RS256_ES256
         end
 
-        local public_key, _, err = 
get_rsa_or_ecdsa_keypair(consumer.auth_conf, consumer.username)
+        local public_key, _, err = get_rsa_or_ecdsa_keypair(consumer.auth_conf)
         return public_key, err
     end
 end

Reply via email to