11件ヒット
[1-11件を表示]
(0.030秒)
検索結果
-
WEBrick
:: HTTPAuth :: BasicAuth (3030.0) -
HTTP の Basic 認証のためのクラスです。
...HTTP の Basic 認証のためのクラスです。
例
require 'webrick'
realm = "WEBrick's realm"
srv = WEBrick::HTTPServer.new({ :BindAddress => '127.0.0.1', :Port => 10080})
htpd = WEBrick::HTTPAuth::Htpasswd.new('dot.htpasswd')
htpd.set_passwd(nil, 'username', 'supersecre......tpass')
authenticator = WEBrick::HTTPAuth::BasicAuth.new(:UserDB => htpd, :Realm => realm)
srv.mount_proc('/basic_auth') {|req, res|
authenticator.authenticate(req, res)
res.body = "hoge"
}
srv.start # http://127.0.0.1:10080/basic_auth...