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
middleman-0.12.1 lib/middleman/vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
colouringcode-passenger-0.1 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
rango-0.0.6 vendor/rack/lib/rack/auth/abstract/request.rb
rango-0.1.pre vendor/rack/lib/rack/auth/abstract/request.rb
passenger-2.2.7 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb
passenger-2.2.6 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rack-0.4.0/lib/rack/auth/abstract/request.rb
middleman-0.10.17 vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
middleman-0.10.16 vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
middleman-0.10.15 vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
rackjour-0.1.8 vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
middleman-0.10.14 vendor/gems/gems/rack-1.0.1/lib/rack/auth/abstract/request.rb
rack-1.0.1 lib/rack/auth/abstract/request.rb
hiraku-rack-1.0.0.1 lib/rack/auth/abstract/request.rb
passenger-2.2.5 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb
webroar-0.2.2 src/admin_panel/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/request.rb
passenger-2.2.3 vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb