At the Forge - Authenticating to a Rails Application
acts_as_authenticated is good enough for many sites as it currently stands. However, there are a number of plugins, suggestions and modifications that you can use with acts_as_authenticated.
For example, many registrations systems want to stop bots from automatically creating user names or e-mail addresses, which can be used to send spam. Thus, it's common for the registration system to ask that users confirm their membership requests via e-mail. So, you enter your information at the site and receive a message that asks you to click on a link. Only after clicking on that link is your account actually activated.
This functionality, although not an obvious part of the core acts_as_authenticated plugin, comes with it and is easy to use. Basically, we use the other generator that comes with acts_as_authenticated. This creates the templates and most of the logic that we need for people to confirm their login status.
There are a wide variety of other things you can do with acts_as_authenticated. For example, you can set it so that passwords are encrypted, but in a way such that it would be reversible. Another common task is to let users change their personal information, such as e-mail addresses and telephone numbers.
This whole discussion of acts_as_authenticated began because I wanted to use OpenID in a Rails application. However, I also wanted to integrate OpenID with an existing authentication mechanism, which brought me to acts_as_authenticated. Now that we have a working, if bare-bones, authentication system on our Web site, we can move on to the next step.
Even if you are not using acts_as_authenticated in your Rails application, it's useful to see how plugins work, how you interact with them and how you can use them to build your Rails application out of parts that have been contributed by other programmers.
Next month, we will look at how we can integrate OpenID into our login system—namely, allowing people to log in using either a user name/password combination or OpenID.
If you're still new to Rails, I strongly recommend The Rails Way by Obie Fernandez. I have found it to be both clear and comprehensive, and one chapter in the book is dedicated to acts_as_authenticated.
There are a number of good resources about acts_as_authenticated on the Web. However, the most comprehensive is the author's Wiki, at technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated.
Reuven M. Lerner, a longtime Web/database developer and consultant, is a PhD candidate in learning sciences at Northwestern University, studying on-line learning communities. He recently returned (with his wife and three children) to their home in Modi'in, Israel, after four years in the Chicago area.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Server Hardening
- BitTorrent Inc.'s Sync
- The Humble Hacker?
- The Death of RoboVM
- A Memory-Efficient Doubly Linked List
- EnterpriseDB's EDB Postgres Advanced Server and EDB Postgres Enterprise Manager
- The US Government and Open-Source Software
- Open-Source Project Secretly Funded by CIA
- New Container Image Standard Promises More Portable Apps
- ACI Worldwide's UP Retail Payments
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide