Sha256: 2494a43d6a63297913075dc9f12bb7b072e6fff55fb0b0a42aa063e519db8a93

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

module Authlogic
  module ControllerAdapters
    # = Merb Adapter
    #
    # Adapts authlogic to work with merb. The point is to close the gap between what authlogic expects and what the merb controller object
    # provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc.
    class MerbAdapter < AbstractAdapter
      # = Merb Implementation
      #
      # Lets Authlogic know about the controller object via a before filter, AKA "activates" authlogic.
      module MerbImplementation
        def self.included(klass) # :nodoc:
          klass.before :activate_authlogic
        end
        
        def cookie_domain
          Merb::Config[:session_cookie_domain]
        end

        private
          def activate_authlogic
            Authlogic::Session::Base.controller = MerbAdapter.new(self)
          end
      end
    end
  end
end
 
# make sure we're running inside Merb
if defined?(Merb::Plugins)
  Merb::BootLoader.before_app_loads do
    Merb::Controller.send(:include, Authlogic::ControllerAdapters::MerbAdapter::MerbImplementation)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authlogic-1.4.0 lib/authlogic/controller_adapters/merb_adapter.rb
authlogic-1.4.1 lib/authlogic/controller_adapters/merb_adapter.rb
authlogic-1.4.2 lib/authlogic/controller_adapters/merb_adapter.rb
authlogic-1.4.3 lib/authlogic/controller_adapters/merb_adapter.rb