Ruby-on-rails Rails 3 身份验证解决方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4236524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 23:40:51  来源:igfitidea点击:

Rails 3 authentication solutions

ruby-on-railsauthenticationpluginsrubygemsruby-on-rails-3

提问by jrdioko

I poked around StackOverflow and Google, but couldn't find anyone who has put together a comparison of authentication gems or plugins for Rails (I'm looking for something for Rails 3). What authentication solutions are available for Rails 3, which are most popular, and what are the differences between them?

我在 StackOverflow 和 Google 上闲逛,但找不到任何人对 Rails 的身份验证宝石或插件进行了比较(我正在寻找适用于 Rails 3 的东西)。Rails 3 有哪些可用的身份验证解决方案,哪些是最流行的,它们之间有什么区别?

采纳答案by mike

Ruby toolbox has a list of the most popular ones: http://ruby-toolbox.com/categories/rails_authentication.html

Ruby 工具箱列出了最流行的工具箱:http: //ruby-toolbox.com/categories/rails_authentication.html

You can see that Devise and Authlogic are definitely the most popular.

可以看到,Devise 和 Authlogic 绝对是最受欢迎的。

Personally I use Devise. It works well with Rails 3, is easily customizable, and makes it very easy to integrate Twitter and Facebook based auth.

我个人使用设计。它可以很好地与 Rails 3 配合使用,易于定制,并且可以非常轻松地集成基于 Twitter 和 Facebook 的身份验证。

回答by Hemanth

For a Rails3 App definitely Devise ;). Devise is the only authentication system which provides security on all the 3 stack layers of rails: - In 'M', 'v', and 'C' and hence the best to go with. But you got to learn more on how to customize devise to custom fit your application's need. You can find help on customizing in this page https://github.com/plataformatec/devise/wiki/_pages

对于 Rails3 应用程序绝对设计 ;)。Devise 是唯一一个在所有 3 个轨道堆栈层上提供安全性的身份验证系统: - 在“M”、“v”和“C”中,因此最好使用。但是您必须了解更多关于如何定制设计以满足您的应用程序需求的方法。您可以在此页面中找到有关自定义的帮助https://github.com/plataformatec/devise/wiki/_pages

回答by jamesc

In Rails authentication from scratch is dead simple to do. Ryan Bates covers this here http://railscasts.com/episodes/270-authentication-in-rails-3-1

在 Rails 中,从头开始进行身份验证非常简单。Ryan Bates 在这里介绍了这个http://railscasts.com/episodes/270-authentication-in-rails-3-1

回答by thenengah

回答by Litmus

I am surprised OminAuthdid not get a mention in any of the answers. (Agreed OmniAuth is more recent than this question is, but there are answers that came after)

我很惊讶OminAuth没有在任何答案中提及。(同意 OmniAuth 比这个问题更近,但后面有答案)

Undoubtedly, this is the most exhaustive authentication solution available currently for rails applications.

毫无疑问,这是目前可用于 Rails 应用程序的最详尽的身份验证解决方案。

Under the hood, OmniAuthuses OAuth2, which is evolving as the de-facto standard for authentication in web applications across platforms and frameworks. Almost all major internet players support OAuth2- Github, Google, Facebook, Twitter, LinkedIn are just a few to name.

幕后OmniAuth使用OAuth2,它正在发展成为跨平台和框架的 Web 应用程序中身份验证的事实上的标准。几乎所有主要的互联网公司都支持OAuth2——Github、谷歌、Facebook、Twitter、LinkedIn 只是其中的几个。

Of course, Deviseworks very well with OmniAuthso It should not be a major headache for those already using Devise

当然,DeviseOmniAuth配合得很好,所以对于那些已经在使用Devise 的人来说,这不应该是一个主要的问题

回答by jpgeek

Kinda late to the party, but I wrote something up for it here:

派对有点晚了,但我在这里写了一些东西:

http://zergsoft.blogspot.jp/2012/08/rails-3-authentication-compared-warden.html

I cover Warden, Devise and home grown.

我涵盖了 Warden、Devise 和土生土长的人。

回答by rickb

The tutorial by Michael Hartl is great for learning how to set up your own.

Michael Hartl 的教程非常适合学习如何设置自己的教程。

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

I have used that on multiple apps and love the flexibility of setting up my own Authentication Method.

我已经在多个应用程序上使用过它,并且喜欢设置我自己的身份验证方法的灵活性。

Though for the most part I use Devise and LOVE it. It is very quick/easy to implement, very secure, and does exactly what I need it do.

虽然在大多数情况下我使用设计并喜欢它。它非常快速/易于实施,非常安全,并且完全符合我的需要。

https://github.com/plataformatec/devise

https://github.com/plataformatec/devise

I will typically use it in conjunction with CanCan and Rolify

我通常将它与 CanCan 和 Rolify 结合使用

回答by loneaggie

I'm a big proponent of rolling your own. Depending on your requirements its fairly straight-forward and reduced dependency on a key component. Rails 3.1 makes it even easier.

我是滚动你自己的大力支持者。根据您的要求,它相当简单,并且减少了对关键组件的依赖。Rails 3.1 让它变得更容易。