Sha256: 894be88f12ff001f7ec2b64a968e39a9a82056fcaec0c0239ee8e7d063332239
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 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
3 entries across 3 versions & 1 rubygems