{
  "id": "05",
  "content": [
    {
      "type": "heading",
      "text": "Password Protection (Basic Auth)"
    },
    {
      "type": "text",
      "html": "Protect a directory using HTTP Basic authentication with <code>AuthType Basic</code> and a password file created by <code>htpasswd</code>."
    },
    {
      "type": "text",
      "html": "<pre><code>AuthType Basic\nAuthName \"Restricted Area\"\nAuthUserFile /path/outside/webroot/.htpasswd\nRequire valid-user</code></pre>"
    },
    {
      "type": "text",
      "html": "Create a user: <code>htpasswd -c /path/outside/webroot/.htpasswd alice</code> (omit <code>-c</code> when adding more users)."
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "Which directive points to the password file?",
        "options": [
          {
            "id": "a",
            "text": "AuthUserFile"
          },
          {
            "id": "b",
            "text": "RequireUserFile"
          },
          {
            "id": "c",
            "text": "UsersFile"
          }
        ],
        "correct": [
          "a"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "Which tool creates the .htpasswd file?",
        "options": [
          {
            "id": "a",
            "text": "htpasswd"
          },
          {
            "id": "b",
            "text": "openssl"
          },
          {
            "id": "c",
            "text": "ssh-keygen"
          }
        ],
        "correct": [
          "a"
        ]
      }
    ]
  }
}