Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.13 KB

README.md

File metadata and controls

30 lines (20 loc) · 1.13 KB

mw-basicauth

Standard Test Go Reference Go Report Card

Basic HTTP Authentication Middleware for Buffalo

Installation

$ go get 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