| Use Case | Command | Description |
|---|---|---|
| π§ Setup DigestAuth config | config = { :Realm => 'DigestAuth example realm' } | Define the authentication realm |
| π Create password database | htdigest = WEBrick::HTTPAuth::Htdigest.new 'my_password_file' | Open or create the digest password file |
| π Set a user password | htdigest.set_passwd config[:Realm], 'username', 'password' | Add or update a userβs password |
| πΎ Flush password file | htdigest.flush | Write changes to disk |
| π Create DigestAuth object | digest_auth = WEBrick::HTTPAuth::DigestAuth.new config | Instantiate the digest authentication handler |
RFC 2617 Digest Access Authentication for WEBrick.
Use this class to add digest authentication to a WEBrick servlet.
Here is an example of how to set up DigestAuth:
config = { :Realm => 'DigestAuth example realm' }
htdigest = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
htdigest.set_passwd config[:Realm], 'username', 'password'
htdigest.flush
config[:UserDB] = htdigest
digest_auth = WEBrick::HTTPAuth::DigestAuth.new config
When using this as with a servlet be sure not to create a new DigestAuth object in the servlet's #initialize. By default WEBrick creates a new servlet instance for every request and the DigestAuth object must be used across requests.
make_passwdnewalgorithmauthenticatechallengeqopattr_reader algorithmattr_reader qopGenerated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-31 05:41 @216.73.217.152
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format