From 679a62a9407c09be0cfb4e22455dca5ae694ce01 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Mon, 16 Sep 2019 15:56:31 -0400 Subject: Flesh out --- server/auth.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 server/auth.go (limited to 'server/auth.go') diff --git a/server/auth.go b/server/auth.go new file mode 100644 index 0000000..15ea164 --- /dev/null +++ b/server/auth.go @@ -0,0 +1,15 @@ +package main + +import ( + "net/http" +) + +// An Authenticator takes an HTTP request and returns true iff it is allowed to +// use our service. +type Authenticator func(req *http.Request) bool + +func TokenAuthenticator() Authenticator { + return func(req *http.Request) bool { + return req.Header.Get("authorization") == "magic" + } +} -- cgit v1.2.3