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
relevance-castronaut-0.4.6 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.5.0 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.5.1 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.5.2 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.5.3 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.5.4 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.6.0 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.6.1 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.7.4 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.7.5 vendor/rack/lib/rack/auth/abstract/request.rb
technomancy-rack-0.3.0 lib/rack/auth/abstract/request.rb
timocratic-rack-1.0.0 lib/rack/auth/abstract/request.rb
rack-1.2.6 lib/rack/auth/abstract/request.rb
rack-1.1.4 lib/rack/auth/abstract/request.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rack-1.1.3/lib/rack/auth/abstract/request.rb
rack-1.2.5 lib/rack/auth/abstract/request.rb
rack-1.1.3 lib/rack/auth/abstract/request.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/rack-1.1.2/lib/rack/auth/abstract/request.rb
rack-1.2.4 lib/rack/auth/abstract/request.rb
rack-1.2.3 lib/rack/auth/abstract/request.rb