code: plan9front

Download patch

ref: 27af159fdcb135e5876788653d2aa6bf080725de
parent: 07f858472356480206c056ae0c0ecf6431a73ae2
author: Igor Böhm <igor@9lab.org>
date: Sat Oct 30 19:59:12 EDT 2021

rc-httpd(8): document how to use HTTP basic authentication

--- a/sys/man/8/rc-httpd
+++ b/sys/man/8/rc-httpd
@@ -80,6 +80,11 @@
 be configured via a similar method acting upon the
 .I location
 and/or other variables.
+.PP
+The
+.I REMOTE_USER
+variable provides a user identification string supplied by the
+client as part of user authentication.
 .SH EXAMPLES
 The following examples demonstrate possible ways to configure
 .BR select-handler.
@@ -95,6 +100,20 @@
 .EE
 .RE
 .PP
+HTTP basic authentication:
+.RS
+.EX
+if(~ $SERVER_NAME *restricted.org){
+	PATH_INFO=$location
+	FS_ROOT=/usr/kgb/www/$SERVER_NAME
+	authorize
+	if(~ $REMOTE_USER (glenda kgb))
+		exec static-or-index
+	error 401
+}
+.EE
+.RE
+.PP
 CGI:
 .RS
 .EX
@@ -151,6 +170,8 @@
 .B /rc/bin/rc-httpd/rc-httpd
 .TP
 .B /rc/bin/rc-httpd/select-handler
+.TP
+.B /rc/bin/rc-httpd/handlers/authorize
 .TP
 .B /rc/bin/rc-httpd/handlers/cgi
 .TP