The Central Go Modules Repository

To use GoCenter:
export GOPROXY=https://gocenter.io
5
Stars
MIT
License
26,585
Downloads
January 31st 2020
Last Modified
Version:
Loading...

GoDoc Build Status Go Report Card

Basic HTTP Authentication Middleware for Buffalo

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