Sha256: 85f3cb62540fb82604e8dcb281b26947bba865e6896c3c1cf35449d64a102d7c
Contents?: true
Size: 1.11 KB
Versions: 9
Compression:
Stored size: 1.11 KB
Contents
module Authlogic module ControllerAdapters # = Rails Adapter # Adapts authlogic to work with rails. The point is to close the gap between what authlogic expects and what the rails controller object # provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc. class RailsAdapter < AbstractAdapter def authenticate_with_http_basic(&block) controller.authenticate_with_http_basic(&block) end def cookies controller.send(:cookies) end def request_content_type request.format.to_s end # = Rails Implementation # Lets Authlogic know about the controller object, AKA "activates" authlogic. module RailsImplementation def self.included(klass) # :nodoc: klass.prepend_before_filter :activate_authlogic end private def activate_authlogic Authlogic::Session::Base.controller = RailsAdapter.new(self) end end end end end ActionController::Base.send(:include, Authlogic::ControllerAdapters::RailsAdapter::RailsImplementation)
Version data entries
9 entries across 9 versions & 1 rubygems