Basic HTTP Authentication Middleware for Buffalo
$ go get -u github.com/gobuffalo/mw-basicauth
auth := func(c buffalo.Context, u, p string) (bool, error) {
return (u == "username" && p == "password"), nil
}
app.Use(basicauth.Middleware(auth))
-
Base64 Encode
username:password
, which becomesdXNlcm5hbWU6cGFzc3dvcmQK
in the aforementioned example -
Then pass the following HTTP header along with all requests to protected endpoints:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQK