HMAC auth plugin for httpie.
httpie-hmac-auth的Python项目详细描述
将使用hmac使用共享密钥对http请求进行签名。要签名的字符串格式为:
<Method>\n <Content-MD5>\n <Content-Type>\n <Date>\n <URL>
要签名的示例字符串
POST vVqHE1k/uBRCoWe0FAh95g== application/json Tue, 12 Jan 201614:57:28 GMT /api/v1/avatars
带有hmac签名的授权头示例
Authorization: HMAC XH+v0qhV4i/89y/DT2OOJx9Kjf3f/0j+w2aGZk625nU=
安装
$ pip install httpie-hmac-auth
现在应该可以在$ http --help输出中的--auth-type下看到hmac。
用法
$ http --auth-type=hmac --auth='client:secret' example.org
示例
当服务器需要访问密钥来查找共享密钥时,对客户端请求进行身份验证:
$ http --auth-type=hmac --auth="client:secret" example.org
在不需要客户端提供访问密钥时验证客户端请求:
$ http --auth-type=hmac --auth=":secret" example.org
许可证
版权所有(c)2016《卫报》。根据麻省理工学院的许可证。