Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

tango-contrib/basicauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

basicauth Build Status

Middleware basicauth is a basic auth checker for Tango.

Installation

go get github.com/tango-contrib/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.