basicauth is a http basic auth middleware for tango
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lunny Xiao 73a449ba35
update README
1 month ago
README.md update README 1 month ago
basicauth.go use go mod and moved to gitea.com 1 month ago
basicauth_test.go use go mod and moved to gitea.com 1 month ago
circle.yml add CI config 2 years ago
go.mod use go mod and moved to gitea.com 1 month ago
go.sum use go mod and moved to gitea.com 1 month ago

README.md

basicauth Build Status

Middleware basicauth is a basic auth checker for Tango.

Installation

go get gitea.com/tango/basicauth

Simple Example

type AuthAction struct {}
func (a *AuthAction) Get() string {
    return "200"
}

func main() {
    tg := tango.Classic()
    tg.Use(basicauth.New(user, pass))
    tg.Get("/", new(AuthAction))
}

If you don’t want some action to check auth, then

type NoAuthAction struct {
    basicauth.NoAuth
}
func (a *NoAuthAction) Get() string {
    return "200"
}

func main() {
    tg := tango.Classic()
    tg.Use(basicauth.New(user, pass))
    tg.Get("/", new(NoAuthAction))
}

will be ok.