diff options
author | Ben Burwell <ben@benburwell.com> | 2019-09-16 15:56:31 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2019-09-16 16:29:16 -0400 |
commit | 679a62a9407c09be0cfb4e22455dca5ae694ce01 (patch) | |
tree | a99e8d61ada1677aee6f63a78545463308c5badd /server/auth.go | |
parent | 528352cddbe0290653c56a27a4134637ad0624e5 (diff) |
Flesh out
Diffstat (limited to 'server/auth.go')
-rw-r--r-- | server/auth.go | 15 |
1 files changed, 15 insertions, 0 deletions
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" + } +} |