goa: github.com/goadesign/goa/middleware/security/basicauth Index | Files

package basicauth

import "github.com/goadesign/goa/middleware/security/basicauth"

Index

Package Files

basicauth.go

Variables

var ErrBasicAuthFailed = goa.NewErrorClass("basic_auth_failed", 401)

ErrBasicAuthFailed means it wasn't able to authenticate you with your login/password.

func New Uses

func New(username, password string) goa.Middleware

New creates a static username/password auth middleware.

Example:

app.UseBasicAuth(basicauth.New("admin", "password"))

It doesn't get simpler than that.

If you want to handle the username and password checks dynamically, copy the source of `New`, it's 8 lines and you can tweak at will.

Package basicauth imports 3 packages (graph). Updated 2017-04-23. Refresh now. Tools for package owners.