At the Forge - Authenticating to a Rails Application
Last month, we began to look at OpenID, the open standard for distributed identification on the Internet. OpenID allows you to have a single user profile, authenticated against a provider you trust, and to use that profile with many different Web sites and Internet applications. OpenID has been growing in popularity during the past few years, after it was first developed and used by blogging company LiveJournal. Since then, it has become a more popular and open standard, and is now supported by many Web sites, as well as all popular programming languages.
I was hoping to use this month's column to show how easy it is to make a Web application compliant with OpenID—or in OpenID terminology, to make it into an OpenID consumer. It turns out that adding OpenID capabilities isn't actually that complicated or difficult, particularly with a popular framework like Ruby on Rails, for which there are many established plugins.
However, I also found that the OpenID plugin for Rails works especially well with a plugin called acts_as_authenticated. This plugin provides a simple, secure and highly customizable authentication system for Rails applications. So this month, we are taking a slight detour, looking at how we can use acts_as_authenticated in Rails applications. Along the way, we can see how to download and use Rails plugins, an important part of Web development with Rails. Next month, we'll build on what we have created, adding OpenID to our application for a truly flexible set of login options for our users.
Although Rails provides a great deal of functionality for developers, it offers few application-level features. Rather, most of its functionality is in the form of objects and methods that programmers can use to create new applications. But, there are no built-in applications, or application fragments, or even a centralized database schema that developers can expect to find in every Rails installation.
The Rails core developers have said that this is done on purpose, because every application has different needs, and it would be impossible to please everyone. And indeed, I understand their point. Each of my applications always has needed to keep a slightly different type of information about users, let alone other types of data. Any choice the developers might make will be wrong for some people.
I happen to think there is a middle ground here. Perhaps the Rails core doesn't need to include a complete solution for users, groups and permissions. But, given the overwhelming number of applications that do define and use such objects, it would make sense to include an easily extensible skeleton within the framework itself.
Such extensions are unlikely to appear in the near future, given the strong feelings the Rails core team has expressed about them in the past. However, all is not lost. Rails includes a “plugin” system that makes it possible to download collections of code—including models, views, controllers and more—and to install them into an application. If you can find and install an appropriate plugin, you get something of a compromise solution. Once installed, the code acts as if it were an integral part of your application. And, of course, you can add only those plugins that are important to your particular application.
Because so many applications require users to register and authenticate, it should come as no surprise that there are a number of available plugins. One of the most popular is acts_as_authenticated, a plugin written by Rails core team member Rick Olson. The name does not refer to an actual declaration, but is rather a playful way of saying that it was designed to work with Rails. And, although the README file (displayed when you install the plugin) indicates that it has been deprecated (in favor of restful_authentication), acts_as_authenticated is popular and stable enough, and plays well enough with OpenID, that it is worth a look.
Rails plugins are installed with the built-in plugin tool, located in script/plugin. You can list the plugins that are available:
But, this will list only those plugins located at one of the sources known to the system. To see a list of these sources, simply type:
To add a new source to the list, simply say:
script/plugin source http://svn.techno-weenie.net/projects/plugins/
Sure enough, after doing this, running script/plugin sources shows the new URL. And, of course, now typing script/plugin list shows many new plugins, from both the old source and the new one.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- Managing Linux Using Puppet
- Control Your Linux Desktop with D-Bus
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide