2

尝试在 Rails ApplicationController 中实现 HTTP 摘要身份验证,但在调用以下命令时出现预期异常authenticate_or_request_with_http_digest(REALM)

undefined method `unpack' for nil:NilClass 

堆栈跟踪的顶部:

/Users/chadmiko/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/base64.rb:58:in
`decode64' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:301:in
`validate_nonce' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:188:in
`validate_digest_response' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:179:in
`authenticate' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:168:in
`authenticate_with_http_digest' actionpack (3.2.8)
lib/action_controller/metal/http_authentication.rb:163:in
`authenticate_or_request_with_http_digest'

其他输出(注意:我正在使用 rvm 并创建了一个项目 gemset):

chadmiko [ ~/Documents/Projects/msa-web ]$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
chadmiko [ ~/Documents/Projects/msa-web ]$ rails --version
Rails 3.2.8

另外,如果我启动 irb:

chadmiko [ ~/Documents/Projects/msa-web ]$ irb
1.9.2-p290 :001 > require 'base64'
 => true 

感觉这里有一个简单的解决方案,但我只是想念它。任何提示将不胜感激。谢谢。

4

0 回答 0