Sha256: bfe76eed4c64b35f2bb20c02686082855de484bf95ae4232668a63b5e5ec2bdf

Contents?: true

Size: 735 Bytes

Versions: 41

Compression:

Stored size: 735 Bytes

Contents

require 'rack/request'

module Rack
  module Auth
    class AbstractRequest

      def initialize(env)
        @env = env
      end

      def request
        @request ||= Request.new(@env)
      end

      def provided?
        !authorization_key.nil?
      end

      def parts
        @parts ||= @env[authorization_key].split(' ', 2)
      end

      def scheme
        @scheme ||= parts.first.downcase
      end

      def params
        @params ||= parts.last
      end


      private

      AUTHORIZATION_KEYS = ['HTTP_AUTHORIZATION', 'X-HTTP_AUTHORIZATION', 'X_HTTP_AUTHORIZATION']

      def authorization_key
        @authorization_key ||= AUTHORIZATION_KEYS.detect { |key| @env.has_key?(key) }
      end

    end

  end
end

Version data entries

41 entries across 36 versions & 11 rubygems

Version Path
scout_realtime-0.5.5.pre lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-0.5.4 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-0.5.3 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-0.5.2 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-0.5.1 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
challah-1.0.0 vendor/bundle/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
torquebox-console-0.2.5 vendor/bundle/ruby/1.8/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
torquebox-console-0.2.3 vendor/bundle/jruby/1.9/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
rack-1.5.2 lib/rack/auth/abstract/request.rb
devise_sociable-0.1.0 vendor/bundle/gems/rack-1.5.1/lib/rack/auth/abstract/request.rb
rack-1.5.1 lib/rack/auth/abstract/request.rb
rack-1.5.0 lib/rack/auth/abstract/request.rb