Methods
- C
- E
- I
- L
Constants
RequestField | = | "Authorization" |
ResponseField | = | "WWW-Authenticate" |
ResponseInfoField | = | "Authentication-Info" |
AuthException | = | HTTPStatus::Unauthorized |
AuthScheme | = | nil |
Method of authentication, must be overridden by the including class |
Attributes
[R] | logger | The logger for this authenticator |
[R] | realm | The realm this authenticator covers |
[R] | userdb | The user database for this authenticator |
Instance Private methods
check_init(config)
Link
Initializes the authenticator from config
# File ../ruby/lib/webrick/httpauth/authenticator.rb, line 49 def check_init(config) [:UserDB, :Realm].each{|sym| unless config[sym] raise ArgumentError, "Argument #{sym.inspect} missing." end } @realm = config[:Realm] @userdb = config[:UserDB] @logger = config[:Logger] || Log::new($stderr) @reload_db = config[:AutoReloadUserDB] @request_field = self::class::RequestField @response_field = self::class::ResponseField @resp_info_field = self::class::ResponseInfoField @auth_exception = self::class::AuthException @auth_scheme = self::class::AuthScheme end
check_scheme(req)
Link
Ensures req
has credentials that can be authenticated.
# File ../ruby/lib/webrick/httpauth/authenticator.rb, line 69 def check_scheme(req) unless credentials = req[@request_field] error("no credentials in the request.") return nil end unless match = /^#{@auth_scheme}\s+/i.match(credentials) error("invalid scheme in %s.", credentials) info("%s: %s", @request_field, credentials) if $DEBUG return nil end return match.post_match end
error(fmt, *args)
Link
info(fmt, *args)
Link