From b2e39e7146608d5b600127de9a3b2448f13f6218 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 6 Feb 2016 15:33:41 -0500 Subject: Stuff --- basicauth.conf-sample | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 basicauth.conf-sample (limited to 'basicauth.conf-sample') 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 +} -- cgit v1.2.3