summaryrefslogtreecommitdiffstats
path: root/debian/vendor-h2o/srcdoc/configure/basic_auth.mt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:12:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:12:02 +0000
commit77e50caaf2ef81cd91075cf836fed0e75718ffb4 (patch)
tree53b7b411290b63192fc9e924a3b6b65cdf67e9d0 /debian/vendor-h2o/srcdoc/configure/basic_auth.mt
parentAdding upstream version 1.8.3. (diff)
downloaddnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.tar.xz
dnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.zip
Adding debian version 1.8.3-2.debian/1.8.3-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/vendor-h2o/srcdoc/configure/basic_auth.mt31
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/vendor-h2o/srcdoc/configure/basic_auth.mt b/debian/vendor-h2o/srcdoc/configure/basic_auth.mt
new file mode 100644
index 0000000..918b405
--- /dev/null
+++ b/debian/vendor-h2o/srcdoc/configure/basic_auth.mt
@@ -0,0 +1,31 @@
+? my $ctx = $main::context;
+? $_mt->wrapper_file("wrapper.mt", "Configure", "Using Basic Authentication")->(sub {
+
+<p>
+Starting from version 1.7, H2O comes with a mruby script named <a href="https://github.com/h2o/h2o/blob/master/share/h2o/mruby/htpasswd.rb">htpasswd.rb</a> that implements <a href="https://tools.ietf.org/html/rfc2617" target="_blank">Basic Authentication</a>.
+The script provides a Rack handler that implements Basic Authentication using password files generated by the <a href="https://httpd.apache.org/docs/2.4/programs/htpasswd.html">htpasswd</a> command.
+</p>
+
+<p>
+Below example uses the mruby script to restrict access to the path.
+If authentication fails, the mruby handler returns a <code>401 Unauthorized</code> response.
+If authentication succeeds, the handler returns a <code>399</code> response, and the request is <a href="configure/mruby.html#delegating-request">delegated</a> internally to the next handler (i.e. <code>file.dir</code>).
+</p>
+
+<?= $ctx->{example}->('Configuring HTTP authentication using htpasswd.rb', <<'EOT');
+paths:
+ "/":
+ mruby.handler: |
+ require "htpasswd.rb"
+ Htpasswd.new("/path/to/.htpasswd", "realm-name")
+ file.dir: /path/to/doc_root
+EOT
+?>
+
+<p>
+In H2O versions prior to 2.0, you should specify <code>"#{$H2O_ROOT}/share/h2o/mruby/htpasswd.rb"</code> as the argument to <code>require</code>, since the directory is not registered as part of <code>$LOAD_PATH</code>.
+</p>
+
+For convenience, the mruby script also forbids access to files or directories that start with <code>.ht</code>.
+
+? })