Skip to content

Commit

Permalink
apply suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolyssup committed Sep 18, 2024
1 parent ee595ab commit 5793e98
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apisix/plugins/hmac-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 5793e98

Please sign in to comment.