summaryrefslogtreecommitdiff
path: root/basicauth.conf-sample
blob: 11048fc85334d94df2a608b7030d5ce401bf8bc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}