Module WEBrick::HTTPAuth
In: webrick/httpauth.rb
webrick/httpauth/userdb.rb
webrick/httpauth/htpasswd.rb
webrick/httpauth/htgroup.rb
webrick/httpauth/htdigest.rb
webrick/httpauth/digestauth.rb
webrick/httpauth/basicauth.rb
webrick/httpauth/authenticator.rb

Methods

Classes and Modules

Module WEBrick::HTTPAuth::Authenticator
Module WEBrick::HTTPAuth::ProxyAuthenticator
Module WEBrick::HTTPAuth::UserDB
Class WEBrick::HTTPAuth::BasicAuth
Class WEBrick::HTTPAuth::DigestAuth
Class WEBrick::HTTPAuth::Htdigest
Class WEBrick::HTTPAuth::Htgroup
Class WEBrick::HTTPAuth::Htpasswd
Class WEBrick::HTTPAuth::ProxyBasicAuth
Class WEBrick::HTTPAuth::ProxyDigestAuth

Public Instance methods

[Source]

# File webrick/httpauth.rb, line 21
    def _basic_auth(req, res, realm, req_field, res_field, err_type, block)
      user = pass = nil
      if /^Basic\s+(.*)/o =~ req[req_field]
        userpass = $1
        user, pass = userpass.unpack("m*")[0].split(":", 2)
      end
      if block.call(user, pass)
        req.user = user
        return
      end
      res[res_field] = "Basic realm=\"#{realm}\""
      raise err_type
    end

[Source]

# File webrick/httpauth.rb, line 35
    def basic_auth(req, res, realm, &block)
      _basic_auth(req, res, realm, "Authorization", "WWW-Authenticate",
                  HTTPStatus::Unauthorized, block)
    end

[Source]

# File webrick/httpauth.rb, line 40
    def proxy_basic_auth(req, res, realm, &block)
      _basic_auth(req, res, realm, "Proxy-Authorization", "Proxy-Authenticate",
                  HTTPStatus::ProxyAuthenticationRequired, block)
    end

[Validate]