Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Http Auth

Http Auth

Simplifies management of HTTP AUTHENTICATION requests

Example:

class AdminController < ApplicationController
   before_filter :auth_user
def index
  ...
end
protected
def auth_user
  http_authenticate("Shopify Feeds") do |user, passwd|      
    @user = shop.users.auth(user, passwd)
  end      
end
end

Alternative more manual approach:

class AdminController < ApplicationController
  before_filter :auth_user
end
def index
  ...
end
protected
def auth_user
  return true if request.authorized? and @user = User.auth( request.http_user, request.http_password )      
end
@response.headers["WWW-Authenticate"] = 'Basic realm="Admin Interface"' 
render :text => 'Could not authenticate you...', :status => "401 Unauthorized" and return false

NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly

Users


See all details


Membership

+ Join this railsplugin

Record Maintainer

'None'