Skip to content
Buffalo Basic Auth Middleware
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.gometalinter.json
LICENSE.txt
Makefile
README.md
azure-pipelines.yml
azure-tests.yml
basicauth.go
basicauth_test.go
go.mod
go.sum
shoulders.md
version.go

README.md

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

You can’t perform that action at this time.