|
1 month ago | |
---|---|---|
README.md | 1 month ago | |
basicauth.go | 1 month ago | |
basicauth_test.go | 1 month ago | |
circle.yml | 2 years ago | |
go.mod | 1 month ago | |
go.sum | 1 month ago |
Middleware basicauth is a basic auth checker for Tango.
go get gitea.com/tango/basicauth
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.