使用curl使用摘要测试基本的http身份验证

时间:2012-09-10 12:16:45

标签: ruby-on-rails ruby-on-rails-3 authentication curl basic-authentication

我们如何使用curl?

按照here解释的digest测试身份验证

我可以通过将Authorization标题设置为Basic {SECRET}来测试Simple Basic示例,其中SECRETBase64::encode64("username:password"),如所解释here

我尝试使用相同的值发送Authentication标题,但是NoMethodError (undefined method 'unpack' for nil:NilClass)在线调用authenticate_or_request_with_http_digest

有人可以解释我在这里做错了吗?

1 个答案:

答案 0 :(得分:18)

最后我能够解决问题。以下是我使用curl来测试带有摘要

的http基本身份验证的方法
curl --data {"red":"00"} --digest -u "username:password" "http://localhost:3000/api/statistics"
相关问题