尝试连接到“摘要式身份验证”使用 HTTParty 或 Net:HTTP(或等)的 Web 服务
我一直在尝试连接到使用摘要身份验证的 Web 服务。
我可以使用以下用户在 Safari 中进行连接:[电子邮件受保护]/endpoint
我曾尝试在 Ruby 和 Rails 中使用 HTTParty 和 Net:HTTP 使用“basic”auth”选项进行连接,但没有任何运气。
想知道 HTTParty/Net:HTTP“basic_auth”选项是否与“摘要身份验证”服务?
如果没有,还有其他方式可以连接吗?
I have been trying to connect to a web service that is using digest authentication.
I am able to connect in Safari using user:[email protected]/endpoint
I have tried in Ruby and Rails to connect using HTTParty and Net:HTTP using the "basic"auth" options, but have not had any luck.
Wondering if the HTTParty/Net:HTTP "basic_auth" option is not going to be compatible with a "digest auth" service?
If not, is there another way that I might connect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HTTParty basic auth 显然与digest_auth 不兼容。我找到了这个 Net:HTTP 扩展: https://codesnippets.joyent.com/posts/show/ 1075 并正在编写一个方法来处理这个问题,在 Crack gem http://github 的帮助下.com/jnunemaker/crack:
HTTParty basic auth is apparently not compatible with digest_auth. I found this Net:HTTP extension: https://codesnippets.joyent.com/posts/show/1075 and am writing a method to handle this, with the help of the Crack gem http://github.com/jnunemaker/crack:
今天无法访问上面给出的 codenippets 链接,但代码也可以在此处 https://gist.github .com/73102。我已经成功地使用它进行摘要身份验证,但遇到了多个请求的问题,出现“过时的客户端随机数”错误 - 通过在每次调用时在digest_auth函数中生成新的随机数来解决。我看的时候没有发现太多,所以希望这对某人有帮助。
Wasn't able to get to the codesnippets link given above today, but code is also available here https://gist.github.com/73102. I've used this successfully for digest authentication, but ran into problems with multiple request, getting 'Stale client nonce' errors - resolved by generating a new nonce within the digest_auth function each time it was called. Didn't find much on that when I looked, so hope this helps someone.