summaryrefslogtreecommitdiff
path: root/basicauth.conf-sample
diff options
context:
space:
mode:
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
+}