small medium large xlarge

 

Pt-I-4

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

Page History
  • V11: Cheng Long [over 1 year ago]
  • V10: Matt Gibson [about 2 years ago]
  • V9: Pierre Sugar [over 3 years ago]
  • V8: Pierre Sugar [over 3 years ago]
  • V7: Diego Kurisaki [almost 4 years ago]
  • V6: Diego Kurisaki [almost 4 years ago]
  • V5: Diego Kurisaki [almost 4 years ago]
  • V4: Nick [over 4 years ago]
  • V3: Nick [over 4 years ago]
  • V2: Nick [over 4 years ago]