summaryrefslogtreecommitdiff
path: root/server/auth.go
blob: 15ea1644ea47a1aaabcc970a6c8849b410b95c31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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"
	}
}