Rails 3 authentication solutions

2019-02-01 03:59发布

问题:

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?

回答1:

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

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

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.



回答2:

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



回答3:

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



回答4:

devise, devise, devise



回答5:

I am surprised OminAuth did 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)

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

Under the hood, OmniAuth uses 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.

Of course, Devise works very well with OmniAuth so It should not be a major headache for those already using Devise



回答6:

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.



回答7:

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.



回答8:

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

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

I will typically use it in conjunction with CanCan and Rolify