Htpasswd accesses apache-compatible password files. Passwords are matched to a realm where they are valid. For security, the path for a password database should be stored outside of the paths available to the HTTP server.

Htpasswd is intended for use with WEBrick::HTTPAuth::BasicAuth.

To create an Htpasswd database with a single user:

htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file'
htpasswd.set_passwd 'my realm', 'username', 'password'
htpasswd.flush
Class Methods

Open a password database at path

Instance Methods

Removes a password from the database for user in realm.

Iterate passwords in the database.

Flush the password database. If output is given the database will be written there instead of to the original path.

Retrieves a password from the database for user in realm. If reload_db is true the database will be reloaded first.

Reload passwords from the database

Sets a password in the database for user in realm to pass.