Sha256: 69be76454f184479b57f90b45c21e15fa24985b9e7eb60c571d88db9f6eee72c

Contents?: true

Size: 1.63 KB

Versions: 14

Compression:

Stored size: 1.63 KB

Contents

module Authlogic
  module ControllerAdapters # :nodoc:
    # Allows you to use Authlogic in any framework you want, not just rails. See the RailsAdapter or MerbAdapter
    # for an example of how to adapt Authlogic to work with your framework.
    class AbstractAdapter
      attr_accessor :controller

      def initialize(controller)
        self.controller = controller
      end

      def authenticate_with_http_basic(&block)
        @auth = Rack::Auth::Basic::Request.new(controller.request.env)
        if @auth.provided? and @auth.basic?
          block.call(*@auth.credentials)
        else
          false
        end
      end

      def cookies
        controller.cookies
      end

      def cookie_domain
        raise NotImplementedError.new("The cookie_domain method has not been implemented by the controller adapter")
      end

      def params
        controller.params
      end

      def request
        controller.request
      end

      def request_content_type
        request.content_type
      end

      def session
        controller.session
      end

      def responds_to_single_access_allowed?
        controller.respond_to?(:single_access_allowed?, true)
      end

      def single_access_allowed?
        controller.send(:single_access_allowed?)
      end

      def responds_to_last_request_update_allowed?
        controller.respond_to?(:last_request_update_allowed?, true)
      end

      def last_request_update_allowed?
        controller.send(:last_request_update_allowed?)
      end

      private
        def method_missing(id, *args, &block)
          controller.send(id, *args, &block)
        end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
refinerycms-0.9.6.34 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.33 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.32 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.31 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.30 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.29 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.28 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.27 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.26 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.25 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.24 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.23 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.22 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb
refinerycms-0.9.6.21 vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb