Sha256: 07de5e5e64726cd5b143327e6bac3028f53c0f5c54a7d5b6b44c7bb006da98fc

Contents?: true

Size: 996 Bytes

Versions: 4

Compression:

Stored size: 996 Bytes

Contents

module Authlogic
  module ControllerAdapters # :nodoc:
    # = Abstract Adapter
    # Allows you to use Authlogic in any framework you want, not just rails. See tha RailsAdapter for an example of how to adapter 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 params
        controller.params
      end
      
      def request
        controller.request
      end
      
      def request_content_type
        request.content_type
      end
      
      def session
        controller.session
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authlogic-1.1.1 lib/authlogic/controller_adapters/abstract_adapter.rb
authlogic-1.1.2 lib/authlogic/controller_adapters/abstract_adapter.rb
authlogic-1.2.0 lib/authlogic/controller_adapters/abstract_adapter.rb
authlogic-1.2.1 lib/authlogic/controller_adapters/abstract_adapter.rb