在 Rails 中创建 RSS 提要很容易。我需要一种简单的方法来密码保护 RSS 提要。我在想 http 基本身份验证。
我用谷歌搜索但找不到任何关于创建受密码保护的 RSS 的文章。
最佳答案
我的 ApplicationController 中有这个
def xml_authorize
if request.format == Mime::XML
authenticate_or_request_with_http_basic do |username, password|
username == 'foo' && password == 'bar'
end
end
end
然后我就申请了
before_filter :xml_authorize
我只想为 XML 请求密码保护的操作,但仍然希望使用 html 正常服务。Here这就是我获得灵感的地方。
关于ruby-on-rails - 如何在 Rails 中创建受密码保护的 RSS 提要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1964902/