15 Authenticating

Goal

You need to build a system to restrict registered users’ access to certain resources. In short, you need users to log in.

Solution

Use the restful_authentication Rails plug-in, with the default Rails cookie session storage, to make sure an authenticated user exists before allowing access to certain controllers.

Authenticating Users

Sooner or later, just about every web app needs to track users and restrict access to certain resources based on whether users are logged in or not. Luckily, a tried-and-true Rails plug-in called restful_authentication helps us with all those things with just a few commands and a bit of configuration.

Starting a few versions ago, the default session store for Rails became ...

Get Flex on Rails: Building Rich Internet Applications with Adobe Flex 3 and Rails 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.