Taken from http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Basic.html – Simple Digest example

In products_controller.rb:

class ProductsController < ApplicationController skip_before_filter :authorize, :only => [:who_bought] before_filter :authorize_digest, :only => [:who_bought] ...

In application_controller.rb:

require ‘digest/md5’ class ApplicationController < ActionController::Base REALM = “SuperSecret” USERS = { “test1” => “1234”, #plain text password “test2” => Digest::MD5.hexdigest([“test2”, REALM, “1234USERS[username] end end