Class: Rack::Auth::AbstractRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/auth/abstract/request.rb

Direct Known Subclasses

Basic::Request, Digest::Request

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ AbstractRequest


7
8
9
# File 'lib/rack/auth/abstract/request.rb', line 7

def initialize(env)
  @env = env
end

Instance Method Details

#paramsObject


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

def params
  @params ||= parts.last
end

#partsObject


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

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

#provided?Boolean


15
16
17
# File 'lib/rack/auth/abstract/request.rb', line 15

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

#requestObject


11
12
13
# File 'lib/rack/auth/abstract/request.rb', line 11

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

#schemeObject


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

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

#valid?Boolean


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

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