summaryrefslogtreecommitdiff
path: root/basicauth.conf-sample
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-02-06 15:33:41 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-02-06 15:33:41 -0500
commitb2e39e7146608d5b600127de9a3b2448f13f6218 (patch)
tree4518b872d768d3a1cf094ef21af668fc962c60a8 /basicauth.conf-sample
parentd1a0019bb4c674a1ae6bc1d6d628ab039984d06a (diff)
Stuff
Diffstat (limited to 'basicauth.conf-sample')
-rw-r--r--basicauth.conf-sample20
1 files changed, 20 insertions, 0 deletions
diff --git a/basicauth.conf-sample b/basicauth.conf-sample
new file mode 100644
index 0000000..11048fc
--- /dev/null
+++ b/basicauth.conf-sample
@@ -0,0 +1,20 @@
+#!/hint/bash
+# Copyright 2016 Luke Shumaker
+# License: WTFPLv2
+
+# Dependencies:
+# - bash
+# - base64 -d
+
+authenticate_basic() {
+ local authparams="$*"
+ local pair
+ pair=$(base64 -d <<<"$authparams")
+ if [[ "$pair" != *:* ]]; then
+ return 1;
+ fi
+ local username="${pair%%:*}"
+ local password="${pair#*:}"
+
+ # TODO: check username and password against some DB
+}