Class: Rack::Auth::Request

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

Constant Summary collapse

VERSION =
"0.1.1"

Instance Method Summary collapse

Constructor Details

#initialize(app, &auth) ⇒ Request

Returns a new instance of Request.



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

def initialize(app, &auth)
  @app, @auth = app, auth
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/rack/auth/request.rb', line 10

def call(env)
  auth_response = @auth.call(env)

  return unauthorized if auth_response[0] == 401
  return forbidden if auth_response[0] == 403

  return @app.call(env) if 200 <= auth_response[0] && auth_response[0] < 300

  ise
end