diff options
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" + } +} |