Class Rack::Auth::Basic
In: lib/rack/auth/basic.rb
Parent: AbstractHandler

Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617.

Initialize with the Rack application that you want protecting, and a block that checks if a username and password pair are valid.

See also: example/protectedlobster.rb

Methods

call  

Classes and Modules

Class Rack::Auth::Basic::Request

Public Instance methods

[Source]

    # File lib/rack/auth/basic.rb, line 15
15:       def call(env)
16:         auth = Basic::Request.new(env)
17: 
18:         return unauthorized unless auth.provided?
19: 
20:         return bad_request unless auth.basic?
21: 
22:         if valid?(auth)
23:           env['REMOTE_USER'] = auth.username
24: 
25:           return @app.call(env)
26:         end
27: 
28:         unauthorized
29:       end

[Validate]