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.



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

def initialize(env)
  @env = env
end

Instance Method Details

#paramsObject



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

def params
  @params ||= parts.last
end

#partsObject



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

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

#provided?Boolean

Returns:

  • (Boolean)


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

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

#requestObject



14
15
16
17
# 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

#schemeObject



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

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

#valid?Boolean

Returns:

  • (Boolean)


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

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