删除 Warden 策略 - 如何确保原始 devise_authenticable 策略消失
我创建了自己的 Warden 策略以与 Devise 一起使用。它与 Devise::Strategies::DatabaseAuthenticatable 非常相似,实际上它继承自它并重新实现了authenticate!
但我的问题是我想确保原来的 devise_authenticable Warden 策略已经消失。这不在 Warden 将尝试的策略列表中,因为这实际上是一个安全问题。这可能吗?
I created my own Warden strategy for using with Devise. It's very similar to Devise::Strategies::DatabaseAuthenticatable and actually it inherits from it and re-implements authenticate!
My issue though is that I want to make sure the original devise_authenticable Warden strategy is gone. That is not in the list of strategies Warden will try because it's actually a security problem. Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据我的手动检查和测试, devise.rb 初始化程序中的这一点实现了目标:
并且该策略是这样实现的(不是这个问题的一部分,但我发现那里存在冲突的信息,而这个信息对我有用使用 Rails 3.1、devise 1.4.7 和 Warden 1.0.5):
According to my manual inspection and tests, this in the devise.rb initializer achieves the goal:
And the strategy is implemented this way (not part of this question, but I found conflicting information out there and this one is the one that worked for me using Rails 3.1, devise 1.4.7 and warden 1.0.5):
我也刚刚实现了这个。 Devise 将尝试其列表中的每一种策略,直到其中一种策略成功为止。
对我来说,我没有替换 :database_authenticatable 策略,而是将我的策略添加到列表的开头,并将 :database_authenticatable 从现有列表的末尾弹出。
I just implemented this as well. Devise will try each strategy in its list until one succeeds.
For me, rather than replace the :database_authenticatable strategy in place, I just added my strategy to the beginning of the list and popped :database_authenticatable off the end of the existing list.