ri > WEBrick::HTTPAuth::BasicAuth

WEBrick::HTTPAuth::BasicAuth < Object

📦 Includes

Authenticator (from /home/chedong/.local/share/rdoc)

🚀 Quick Reference

Use CaseCommandDescription
🔐 Create a BasicAuth instanceWEBrick::HTTPAuth::BasicAuth.new configCreate a new basic authenticator with a configuration hash
🔑 Set user passwordhtpasswd.set_passwd realm, username, passwordSet or update a password for a user in the given realm
💾 Write password filehtpasswd.flushWrite the password database to disk
👤 Authenticate requestbasic_auth.authenticate request, responseAuthenticate a request (returns user or fails)
⚠️ Send challengebasic_auth.challenge request, responseSend a 401 Unauthorized challenge to the client
📄 Get loggerbasic_auth.loggerReturn the logger object (attr_reader)
🌐 Get realmbasic_auth.realmReturn the authentication realm (attr_reader)
🗄️ Get user databasebasic_auth.userdbReturn the user database object (attr_reader)

📖 Description

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:

  config = { :Realm => 'BasicAuth example realm' }

  htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file', password_hash: :bcrypt
  htpasswd.set_passwd config[:Realm], 'username', 'password'
  htpasswd.flush

  config[:UserDB] = htpasswd

  basic_auth = WEBrick::HTTPAuth::BasicAuth.new config

🧩 Class Methods

🔧 Instance Methods

📋 Attributes

WEBrick::HTTPAuth::BasicAuth
WEBrick::HTTPAuth::BasicAuth < Object 📦 Includes 🚀 Quick Reference 📖 Description 🧩 Class Methods 🔧 Instance Methods 📋 Attributes

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-31 08:23 @216.73.217.152
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format