【问题标题】:How to add HMAC Signature Authentication to your APIs in Kong API Gateway?如何在 Kong API Gateway 中为您的 API 添加 HMAC 签名认证?
【发布时间】:2017-02-17 07:30:26
【问题描述】:

我正在尝试使用 https://getkong.org/plugins/hmac-authentication/ 中的 date 标头进行 HMAC 身份验证

但我仍然收到错误

{
  "message": "HMAC signature cannot be verified, a valid date or x-date header is required for HMAC Authentication"
}

请提出一种使它起作用的方法。

【问题讨论】:

    标签: kong


    【解决方案1】:

    我认为不应使用日期标题。无论如何,我只是用 x-date 标题替换了它,问题就解决了。

    只需使用授权标头发出请求。

    Authorization : hmac username="<username>",algorithm="hmac-sha1",headers="X-Date",signature="Ee4Gv1at78U3f+bawoV0PucdF/Q="
    
    X-Date: Fri, 17 Feb 2017 10:28:40 GMT
    

    为了生成使用密钥签名的字符串,客户端必须按照它们出现的顺序获取由 headers 指定的每个 HTTP header 的值。这就是此处指定 X-Date 标头的原因。

    签名是Base64(HMAC-SHA1(signing string))

    客户端将在这里编写签名字符串:

    X-Date: Fri, 17 Feb 2017 10:28:40 GMT
    

    您还可以使用一个或多个标头来创建签名。不过这是最简单的。

    访问:https://getkong.org/plugins/hmac-authentication/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-25
      • 1970-01-01
      • 2021-09-14
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多