Sha256: bfe76eed4c64b35f2bb20c02686082855de484bf95ae4232668a63b5e5ec2bdf

Contents?: true

Size: 735 Bytes

Versions: 41

Compression:

Stored size: 735 Bytes

Contents

require 'rack/request'

module Rack
  module Auth
    class AbstractRequest

      def initialize(env)
        @env = env
      end

      def request
        @request ||= Request.new(@env)
      end

      def provided?
        !authorization_key.nil?
      end

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

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

41 entries across 36 versions & 11 rubygems

Version Path
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/rack-1.5.5/lib/rack/auth/abstract/request.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/rack-1.5.5/lib/rack/auth/abstract/request.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/rack-1.5.5/lib/rack/auth/abstract/request.rb
rack-1.5.5 lib/rack/auth/abstract/request.rb
rack-1.5.4 lib/rack/auth/abstract/request.rb
rack-1.5.3 lib/rack/auth/abstract/request.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
nanumfont-rails-0.1 vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.5 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.4 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.3 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.3.pre lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.2 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.1 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-1.0.0 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb
scout_realtime-0.5.5 lib/vendor/rack-1.5.2/lib/rack/auth/abstract/request.rb