superclass=Object
type=class
library=webrick.httpauth.basicauth
extended=
included=WEBrick=HTTPAuth=Authenticator

HTTP  Basic ǧڤΤΥ饹Ǥ



    realm = "WEBrick's realm"
    srv = HTTPServer.new({ :BindAddress => '127.0.0.1', :Port => 10080})

    htpd = HTTPAuth::Htpasswd.new('dot.htpasswd')
    htpd.set_passwd(nil, 'username', 'supersecretpass')

    authenticator = HTTPAuth::BasicAuth.new(:UserDB => htpd, :Realm => realm)
    srv.mount_proc('/basic_auth') {|req, res|
      authenticator.authenticate(req, res)
      res.body = "hoge"
    }
