Rails 2.0 offers an extremely easy way to do HTTP basic authentication. See how in this episode.
# products_controller.rb
before_filter :authenticate
protected
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "foo" && password == "bar"
end
end
本篇介绍Rails2.0中实现HTTP基本认证的方法。通过一个简单的示例展示了如何使用before_filter进行用户验证。
1262

被折叠的 条评论
为什么被折叠?



