Description

Package auth provides handlers to enable basic auth support. Simple Usage:

import(
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/plugins/auth"
)

func main(){
	// authenticate every request
	beego.InsertFilter("*", beego.BeforeRouter,auth.Basic("username","secretpassword"))
	beego.Run()
}

Advanced Usage:

func SecretAuth(username, password string) bool {
	return username == "astaxie" && password == "helloBeego"
}
authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required")
beego.InsertFilter("*", beego.BeforeRouter,authPlugin)

auth is referenced in 3 repositories

github.com/astaxie/beego github.com/horrido/acme3 github.com/ywg2048/Golang_server