Rails 身份验证
嘿,我再次需要一些关于 Rails 的帮助!最后是关于 Authlogic.. 好吧,我有点落后了.. 我的意思是,Authlogic 不是我喜欢的 Authentcate 系统.. 所以现在我不想你们告诉我你们认为最好的是什么!
我将把它用在我的一个项目中。那里必须有一些角色,如管理员、用户和访客..所以你们可以告诉我什么是好的,什么是坏..?
Hey, i need some help with rails, again! Last it was about Authlogic.. Well I'm gone a bit backward since.. I mean, Authlogic isn't a Authentcate system i like.. So now i wan't you guys to tell me what you think is the best!
I going to use it to a project of mine. Where there has to be a few roles like Admin, User and Guest.. So might you guys can tell me what is good and what is bad..?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将身份验证与授权分开。
身份验证涵盖登录/注销过程。授权与查看/使用资源的权限直接相关。
Authlogic 是一个非常好的身份验证宝石。
对于授权,您可以查看 Ryan Bates 的 CanCan,集成起来非常简单与 authlogic (只是模型文件夹中名为ability.rb 的单个文件,您可以在其中配置所有应用程序授权)。
编辑:您也可以采用更简单的解决方案,但您会失去灵活性
You need to split authentication from authorization.
Authentication covers the login/logout process. Authorization is directly linked to permission to see/use resources.
Authlogic is a very good authentication gem.
For authorization you can check CanCan from Ryan Bates, which is very simple to integrate with authlogic (just a single file in the models folder called ability.rb in which you configure all the app authorizations).
EDIT: You can also go with a simpler solution but you will lose flexibility
我使用了 Devise,效果很好,但它没有满足我的需求......
然而,您可能需要的东西看起来非常简单,如下所示: http://railscasts .com/episodes/21-super-simple-authentication
I used Devise and it worked quite well, however it did not met my needs...
What you might need however looks like something super simple, something like this: http://railscasts.com/episodes/21-super-simple-authentication
我使用 Authlogic 进行身份验证,使用 DocSavage 的 Rails 授权插件来满足授权需求。它是一个简单但功能强大的插件。
Rails 授权插件: http://github.com/DocSavage/rails-authorization-plugin< /a>
I use Authlogic for authentication and DocSavage's Rails Authorisation plug-in for authorisation needs. Its a simple yet powerful plug-in.
Rails authorisation plug-in: http://github.com/DocSavage/rails-authorization-plugin