123456789_123456789_123456789_123456789_123456789_

Class: Rack::Auth::AbstractRequest

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/rack/auth/abstract/request.rb

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(env) ⇒ AbstractRequest

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 10

def initialize(env)
  @env = env
end

Instance Attribute Details

#provided?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 19

def provided?
  !authorization_key.nil? && valid?
end

#valid?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 23

def valid?
  !@env[authorization_key].nil?
end

Instance Method Details

#authorization_key (private)

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 44

def authorization_key
  @authorization_key ||= AUTHORIZATION_KEYS.detect { |key| @env.has_key?(key) }
end

#params

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 35

def params
  @params ||= parts.last
end

#parts

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 27

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

#request

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 14

def request
  warn "Rack::Auth::AbstractRequest#request is deprecated and will be removed in a future version of rack.", uplevel: 1
  @request ||= Request.new(@env)
end

#scheme

[ GitHub ]

  
# File 'lib/rack/auth/abstract/request.rb', line 31

def scheme
  @scheme ||= parts.first&.downcase
end