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
passenger-2.2.4 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb
actionpack-2.3.2 lib/action_controller/vendor/rack-1.0/rack/auth/abstract/request.rb
mack-0.8.2 lib/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
mack-0.8.3 lib/gems/rack-0.9.1/lib/rack/auth/abstract/request.rb
mack-0.8.3.1 lib/gems/rack-0.9.1/lib/rack/auth/abstract/request.rb
passenger-2.1.2 vendor/rack-0.9.1/lib/rack/auth/abstract/request.rb
passenger-2.1.3 vendor/rack-0.9.1/lib/rack/auth/abstract/request.rb
passenger-2.2.1 vendor/rack-0.9.1/lib/rack/auth/abstract/request.rb
passenger-2.2.0 vendor/rack-0.9.1/lib/rack/auth/abstract/request.rb
passenger-2.2.2 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb
rack-0.9.1 lib/rack/auth/abstract/request.rb
rack-0.4.0 lib/rack/auth/abstract/request.rb
rack-0.9.0 lib/rack/auth/abstract/request.rb
rack-0.3.0 lib/rack/auth/abstract/request.rb
rack-1.0.0 lib/rack/auth/abstract/request.rb
radiant-0.8.0 vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/request.rb
sinatra-0.2.2 vendor/rack/lib/rack/auth/abstract/request.rb