From 5793e985e4c3ef18f4e2d203b3aa84a83fc18ff0 Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Wed, 18 Sep 2024 15:00:00 +0530 Subject: [PATCH] apply suggestion --- apisix/plugins/hmac-auth.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apisix/plugins/hmac-auth.lua b/apisix/plugins/hmac-auth.lua index 43c40c3e329e..b4cd5ed76545 100644 --- a/apisix/plugins/hmac-auth.lua +++ b/apisix/plugins/hmac-auth.lua @@ -164,7 +164,7 @@ local function generate_signature(ctx, secret_key, params) end else core.table.insert(signing_string_items, - h .. ": " .. canonical_header) + h .. ": " .. canonical_header) core.log.info("canonical_header name:", core.json.delay_encode(h)) core.log.info("canonical_header value: ", core.json.delay_encode(canonical_header)) @@ -290,7 +290,7 @@ local function retrieve_hmac_fields(ctx) return nil, "missing Authorization header" end - if not auth_string:match("^Signature") then + if not core.string.has_prefix(auth_string,"Signature") then return nil, "Authorization header does not start with 'Signature'" end @@ -339,6 +339,7 @@ function _M.rewrite(conf, ctx) local consumer_conf = consumer.plugin(plugin_name) consumer.attach_consumer(ctx, validated_consumer, consumer_conf) + core.log.info("hit hmac-auth rewrite") end