Satish / restful-authentication

Generates common user authentication code for Rails/Merb, with a full test/unit and rspec suite and optional Acts as State Machine support built-in.
http://weblog.techno-weenie.net
MIT License
82 stars 19 forks source link

h1. "Restful Authentication Generator":http://github.com/Satish/restful-authentication

This widely-used plugin provides a foundation for securely managing user authentication:

Several features were updated in May, 2008.

!! important: if you upgrade your site, existing user account !! !! passwords will stop working unless you use @--old-passwords@ !!

h2. Issue Tracker

Please submit any bugs or annoyances at

h2. Documentation

This page has notes on

See the "wiki":http://github.com/technoweenie/restful-authentication/wikis/home (or the notes/ directory) if you want to learn more about:

These best version of the release notes are in the notes/ directory in the "source code":http://github.com/technoweenie/restful-authentication/tree/master -- look there for the latest version. The wiki versions are taken (manually) from there.

h2(#AWESOME). Exciting new features

h3. Stories

There are now "Cucumber":http://wiki.github.com/aslakhellesoy/cucumber/home features that allow expressive, enjoyable tests for the authentication code. The flexible code for resource testing in stories was extended from "Ben Mabey's.":http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/

h3. Modularize to match security design patterns:

h3. Other

h2. Non-backwards compatible Changes

Here are a few changes in the May 2008 release that increase "Defense in Depth" but may require changes to existing accounts

h3. Passwords

The new password encryption (using a site key salt and stretching) will break existing user accounts' passwords. We recommend you use the @--old-passwords@ option or write a migration tool and submit it as a patch. See the "Tradeoffs":http://wiki.github.com/technoweenie/restful-authentication/tradeoffs note for more information.

h3. Validations

By default, email and usernames are validated against a somewhat strict pattern; your users' values may be now illegal. Adjust to suit.

h2(#INSTALL). Installation

This is a basic restful authentication generator for rails, taken from acts as authenticated. Currently it requires Rails3 beta.

IMPORTANT FOR RAILS > 2.1 USERS To avoid a @NameError@ exception ("lighthouse tracker ticket":http://rails_security.lighthouseapp.com/projects/15332-restful_authentication/tickets/2-not-a-valid-constant-name-errors#ticket-2-2), check out the code to have an underscore and not dash in its name:

If you're using git as your source control, you have three options.

"git-submodule docs":http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html

To use the generator:


  rails g authenticated user sessions \
    --include-activation \
    --stateful \
    --rspec \
    --skip-migration \
    --skip-routes \
    --old-passwords

h2(#POST-INSTALL). After installing

The below assumes a Model named 'User' and a Controller named 'Session'; please alter to suit. There are additional security minutae in @notes/README-Tradeoffs@ -- only the paranoid or the curious need bother, though.