{
    "content": [
        {
            "type": "text",
            "text": "# WEBrick::HTTPAuth (ri)\n\n## Sections\n\n- **WEBrick::HTTPAuth**\n- **Instance methods:**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "WEBrick::HTTPAuth",
        "section": "",
        "mode": "ri",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "WEBrick::HTTPAuth",
                "lines": 43,
                "subsections": []
            },
            {
                "name": "Instance methods:",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "WEBrick::HTTPAuth": {
                "content": "(from /home/chedong/.local/share/rdoc)\n------------------------------------------------------------------------\nHTTPAuth provides both basic and digest authentication.\n\nTo enable authentication for requests in WEBrick you will need a user\ndatabase and an authenticator.  To start, here's an Htpasswd database\nfor use with a DigestAuth authenticator:\n\nconfig = { :Realm => 'DigestAuth example realm' }\n\nhtpasswd = WEBrick::HTTPAuth::Htpasswd.new 'mypasswordfile'\nhtpasswd.authtype = WEBrick::HTTPAuth::DigestAuth\nhtpasswd.setpasswd config[:Realm], 'username', 'password'\nhtpasswd.flush\n\nThe :Realm is used to provide different access to different groups\nacross several resources on a server.  Typically you'll need only one\nrealm for a server.\n\nThis database can be used to create an authenticator:\n\nconfig[:UserDB] = htpasswd\n\ndigestauth = WEBrick::HTTPAuth::DigestAuth.new config\n\nTo authenticate a request call #authenticate with a request and response\nobject in a servlet:\n\ndef doGET req, res\n@authenticator.authenticate req, res\nend\n\nFor digest authentication the authenticator must not be created every\nrequest, it must be passed in as an option via\nWEBrick::HTTPServer#mount.\n\n\n\n\n\n\n\n------------------------------------------------------------------------",
                "subsections": []
            },
            "Instance methods:": {
                "content": "basicauth\nproxybasicauth\n",
                "subsections": []
            }
        }
    }
}