Type:
Class
Constants:
AuthScheme
:
"Basic"
Basic Authentication for WEBrick
Use this class to add basic authentication to a WEBrick servlet.
Here is an example of how to set up a BasicAuth:
1 2 3 4 5 6 7 8 9 | config = { :Realm => 'BasicAuth example realm' } htpasswd = WEBrick::HTTPAuth::Htpasswd. new 'my_password_file' htpasswd.set_passwd config[:Realm], 'username' , 'password' htpasswd.flush config[:UserDB] = htpasswd basic_auth = WEBrick::HTTPAuth::BasicAuth. new config |