Method: Rack::Auth::Basic#call

Defined in:
lib/rack/auth/basic.rb

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rack/auth/basic.rb', line 18

def call(env)
  auth = Basic::Request.new(env)

  return unauthorized unless auth.provided?

  return bad_request unless auth.basic?

  if valid?(auth)
    env['REMOTE_USER'] = auth.username

    return @app.call(env)
  end

  unauthorized
end