Files

Merb::Authentication::Strategies::Basic::BasicAuth

Public Class Methods

new(request, params) click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 40
40:         def initialize(request, params)
41:           super
42:           @auth = Rack::Auth::Basic::Request.new(request.env)
43:         end
realm() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 27
27:         def self.realm
28:           @realm ||= "Application"
29:         end

Public Instance Methods

realm() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 32
32:         def realm
33:           @realm ||= self.class.realm
34:         end
run!() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 15
15:         def run!
16:           if basic_authentication?
17:             basic_authentication do |login, password|
18:               user = user_class.authenticate(login, password)
19:               unless user
20:                 request_basic_auth!
21:               end
22:               user
23:             end
24:           end
25:         end

Private Instance Methods

basic_authentication(realm = nil, &authenticator) click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 64
64:         def basic_authentication(realm = nil, &authenticator)
65:           self.realm = realm if realm
66:           if basic_authentication?
67:             authenticator.call(*@auth.credentials)
68:           else
69:             false
70:           end
71:         end
basic_authentication?() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 45
45:         def basic_authentication?
46:           @auth.provided? and @auth.basic?
47:         end
password() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 53
53:         def password
54:           basic_authentication? ? @auth.credentials.last : nil
55:         end
request_basic_auth!() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 57
57:         def request_basic_auth!
58:           self.status = Merb::Controller::Unauthorized.status
59:           self.headers['WWW-Authenticate'] = 'Basic realm="%s"' % realm
60:           self.body = self.class.failure_message
61:           halt!
62:         end
username() click to toggle source
    # File lib/merb-auth-more/strategies/basic/basic_auth.rb, line 49
49:         def username
50:           basic_authentication? ? @auth.credentials.first : nil
51:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.