【问题标题】:How do I send a digest auth request using curl?如何使用 curl 发送摘要身份验证请求?
【发布时间】:2020-11-21 15:56:58
【问题描述】:

在搜索指南时,我在 Wikipedia 上找到了这个示例

GET /dir/index.html HTTP/1.0
Host: localhost
Authorization: Digest username="Mufasa", realm="testrealm@host.com", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", uri="/dir/index.html",
qop=auth,
nc=00000001,
cnonce="0a4f113b",
response="6629fae49393a05397450978507c4ef1",
opaque="5ccc069c403ebaf9f0171e9517f40e41"

(如果有一个工具/站点可以将来自这种形式的原始请求的请求转换为 curl 命令,那就太好了)

当我尝试向网站发送正常的获取请求时,这是领域和随机数。

 WWW-Authenticate: Digest realm="device1",nonce="3c5d8f92f03d9f1afd5dd55a7b172ee8", qop="auth", algorithm="MD5"

the response but from a network capture screen shot

再次上网搜索了一下,发现命令应该是这样的

curl "url" --digest -u {username}:{pass} -vv -d @4.xml -H "Content-Type: text/xml;charset=utf-8" 

但我不知道在哪里放置 nonce 或领域或 qop 或 algorithm="MD5"

虽然 .xml 文件包含发布数据(在我的情况下,它是一个肥皂动作)

【问题讨论】:

    标签: xml curl soap digest-authentication nonce


    【解决方案1】:

    您不必在任何地方指定所有这些值。您唯一需要做的就是用户名/密码对。 CURL 负责为您计算客户端响应。这正是“支持摘要式身份验证”对任何客户端的意义。

    【讨论】:

      猜你喜欢
      • 2020-11-18
      • 1970-01-01
      • 2012-11-10
      • 2013-05-23
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多