Skip to content

help request: hmac Authorization 如何拼接? #7756

Description

@cnn007

Description

https://apisix.apache.org/zh/docs/apisix/plugins/hmac-auth/

参考: 签名可以放到请求头 Authorization 字段中:
curl http://127.0.0.1:9080/index.html \ -H 'Authorization: hmac-auth-v1# + ACCESS_KEY + # + base64_encode(SIGNATURE) + # + ALGORITHM + # + DATE + # + SIGNED_HEADERS' -i
问题:
参考的就是这个链接,
1、Authorization 格式是什么,
2、'# + ' 真实字串中需要吗,有空格吗?
3、SIGNED_HEADERS 是怎么拼接的,只需要拼接名称,值不需要拼接是吗。

下面是我的一个请求示例(看下格式是否正确):
curl -i "http://127.0.0.1:9080/index.html?name=james&age=36" \ -H 'Authorization: hmac-auth-v1#user-key#8XV1GB7Tq23OJcoz6wjqTs4ZLxr9DiLoY4PxzScWGYg=#hmac-sha256#Tue, 19 Jan 2021 11:33:20 GMT#User-Agent;x-custom-a'

Environment

  • APISIX version (run apisix version):2.15
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    docDocumentation things

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions