Sha256: ebbdbae553d8dbe287455e4a255c5b5353c62137eb527322e68065b885629c4e

Contents?: true

Size: 650 Bytes

Versions: 97

Compression:

Stored size: 650 Bytes

Contents

module Rack
  module Auth
    class AbstractRequest

      def initialize(env)
        @env = env
      end

      def provided?
        !authorization_key.nil?
      end

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

      def scheme
        @scheme ||= parts.first.downcase.to_sym
      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

97 entries across 96 versions & 26 rubygems

Version Path
rack-1.2.2 lib/rack/auth/abstract/request.rb
rack-1.1.2 lib/rack/auth/abstract/request.rb
rack-1.1.1 lib/rack/auth/abstract/request.rb
rack-1.1.1.pre lib/rack/auth/abstract/request.rb
eac-rack-1.1.1 lib/rack/auth/abstract/request.rb
nbudin-castronaut-0.7.5 vendor/rack/lib/rack/auth/abstract/request.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
rack-1.2.1 lib/rack/auth/abstract/request.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
rack-1.2.0 lib/rack/auth/abstract/request.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
rack-1.1.0 lib/rack/auth/abstract/request.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb