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
3mix-castronaut-0.5.0.2 vendor/rack/lib/rack/auth/abstract/request.rb
kastner-rack-0.3.171 lib/rack/auth/abstract/request.rb
kastner-rack-0.3.186 lib/rack/auth/abstract/request.rb
kjvarga-rack-1.0.0 lib/rack/auth/abstract/request.rb
masover-castronaut-0.4.4.4 vendor/rack/lib/rack/auth/abstract/request.rb
masover-castronaut-0.4.4.5 vendor/rack/lib/rack/auth/abstract/request.rb
masover-castronaut-0.5.0.1 vendor/rack/lib/rack/auth/abstract/request.rb
p8-castronaut-0.6.1.1 vendor/rack/lib/rack/auth/abstract/request.rb
qoobaa-rack-1.0.0.1 lib/rack/auth/abstract/request.rb
qoobaa-rack-1.0.2 lib/rack/auth/abstract/request.rb
relevance-castronaut-0.2.0 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.2.5 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.3.0 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.3.5 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.3.6 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.4.1 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.4.2 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.4.3 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.4.4 vendor/rack/lib/rack/auth/abstract/request.rb
relevance-castronaut-0.4.5 vendor/rack/lib/rack/auth/abstract/request.rb