Documentation ¶
Overview ¶
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)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Basic ¶
func Basic(username string, password string) beego.FilterFunc
func NewBasicAuthenticator ¶
func NewBasicAuthenticator(secrets SecretProvider, Realm string) beego.FilterFunc
Types ¶
type BasicAuth ¶
type BasicAuth struct { Secrets SecretProvider Realm string }
func (*BasicAuth) CheckAuth ¶
Checks the username/password combination from the request. Returns either an empty string (authentication failed) or the name of the authenticated user. Supports MD5 and SHA1 password entries
Click to show internal directories.
Click to hide internal directories.