diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-10 23:37:43 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-10 23:37:43 +0000 |
commit | 8c2a52937f3b71efa7bcb48e7b8b00bc6b616ab4 (patch) | |
tree | 757bcc2a71bbb2338e5ccc11a0f37e2424132e0c /lib/webrick/httpauth/authenticator.rb | |
parent | 6626b0a2c567669cceebd3bfd0195b0ffd8c97c3 (diff) |
* lib/webrick: Add documentation for WEBrick::HTTPAuth
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/httpauth/authenticator.rb')
-rw-r--r-- | lib/webrick/httpauth/authenticator.rb | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/lib/webrick/httpauth/authenticator.rb b/lib/webrick/httpauth/authenticator.rb index af34a19b88..0739d4371d 100644 --- a/lib/webrick/httpauth/authenticator.rb +++ b/lib/webrick/httpauth/authenticator.rb @@ -9,17 +9,43 @@ module WEBrick module HTTPAuth + + ## + # Module providing generic support for both Digest and Basic + # authentication schemes. + module Authenticator + RequestField = "Authorization" ResponseField = "WWW-Authenticate" ResponseInfoField = "Authentication-Info" AuthException = HTTPStatus::Unauthorized - AuthScheme = nil # must override by the derived class - attr_reader :realm, :userdb, :logger + ## + # Method of authentication, must be overriden by the including class + + AuthScheme = nil + + ## + # The realm this authenticator covers + + attr_reader :realm + + ## + # The user database for this authenticator + + attr_reader :userdb + + ## + # The logger for this authenticator + + attr_reader :logger private + ## + # Initializes the authenticator from +config+ + def check_init(config) [:UserDB, :Realm].each{|sym| unless config[sym] @@ -37,6 +63,9 @@ module WEBrick @auth_scheme = self::class::AuthScheme end + ## + # Ensures +req+ has credentials that can be authenticated. + def check_scheme(req) unless credentials = req[@request_field] error("no credentials in the request.") @@ -69,6 +98,10 @@ module WEBrick end end + ## + # Module providing generic support for both Digest and Basic + # authentication schemes for proxies. + module ProxyAuthenticator RequestField = "Proxy-Authorization" ResponseField = "Proxy-Authenticate" |