Where do I start with authentication in Rails?
I am learning Rails by building applications.
I want to make my first authenticated application: registering users, logging in, making some changes to the models that they have access to and logging out.
I did a google search, but it's pretty confusing: many plugins, many tutorials. I don’t know where to start.
Is there a modern authentication method for Rails? What do you use in Production to authenticate your users?
Any help on this would be helpful. Thanks to
a source to share
+1 to Jason, -1 to NSD and sparks. An authentication system is not something you want to build on your own, at least if you are aiming for production. It's like developing your own encryption algorithm - it's much safer to use something widely tested and well developed.
I also use authlogic, but there are some alternatives out there - like good old calm authentication , and devise , which I think is more modern, so to speak. BTW the last two railscasts are dedicated to development.
a source to share
If your application is simple and just needs a simple and secure login page, you can look into the Restful Authentication plugin . It's very easy to use, and if you don't have special authentication requirements, it should do well.
script/plugin install git://github.com/technoweenie/restful-authentication.git
script/generate authenticated user sessions
rake db:migrate
You can find out more by checking out the excellent railscast .
a source to share
As a newbie, I would recommend Restful Authentication as its easy to set up and you should be able to run it without running
The following is a step by step guid
http://avnetlabs.com/rails/restful-authentication-with-rails-2
and authlogic - ( http://github.com/binarylogic/authlogic ) is another great plugin that's more flexible but requires some work to implement user registration and the like
cheers, sameera
a source to share
One of the most modern authentication systems is another useless heap of garbage. After all, you are almost always better off rolling your own. The O'Reilly Ruby Cookbook has some basic examples to get you in the right general direction so you can decide if other human solutions are right for you.
a source to share
I agree with NSD. Figuring out the plugins and how they should be connecting your app to me takes longer than creating an auth system in my last app.
My advice is to create a user_sessions controller and use normal CRUD methods to handle create / destroy (i.e. login and logout). Create another model for the user - it can handle account creation and updating (i.e. changing passwords). Attach: before_filter on every controller that needs protection.
a source to share