Class: Rack::Auth::AbstractRequest

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

Direct Known Subclasses

Basic::Request

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ AbstractRequest

Returns a new instance of AbstractRequest.



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

def initialize(env)
  @env = env
end

Instance Method Details

#paramsObject



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

def params
  @params ||= parts.last
end

#partsObject



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

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

#provided?Boolean

Returns:

  • (Boolean)


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

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

#requestObject



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

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

#schemeObject



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

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

#valid?Boolean

Returns:

  • (Boolean)


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

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