Skip to content

robsliwi/mw-basicauth

 
 

Repository files navigation

GoDoc Build Status Go Report Card

Installation

$ go get -u github.com/gobuffalo/mw-basicauth

Usage

auth := func(c buffalo.Context, u, p string) (bool, error) {
    return (u == "username" && p == "password"), nil
}
app.Use(basicauth.Middleware(auth))

Hitting protected endpoints

  1. Base64 Encode username:password, which becomes dXNlcm5hbWU6cGFzc3dvcmQK in the aforementioned example

  2. Then pass the following HTTP header along with all requests to protected endpoints: Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQK

About

Buffalo Basic Auth Middleware

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 83.6%
  • Makefile 16.4%