Parent

Namespace

Class Index [+]

Quicksearch

Rack::Auth::Basic

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

Public Instance Methods

call(env) click to toggle source

(Not documented)

    # 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

Private Instance Methods

challenge() click to toggle source

(Not documented)

    # File lib/rack/auth/basic.rb, line 34
34:       def challenge
35:         'Basic realm="%s"' % realm
36:       end
valid?(auth) click to toggle source

(Not documented)

    # File lib/rack/auth/basic.rb, line 38
38:       def valid?(auth)
39:         @authenticator.call(*auth.credentials)
40:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.