// DefaultHandler takes one parameter, the users returns a Handler // use: iris.Use(DefaultHandler(...)), iris.Get(...,iris.HandlerFunc(Default(...)),...) func DefaultHandler(users map[string]string) iris.Handler { c := config.DefaultBasicAuth() c.Users = users return NewHandler(c) }
// NewHandler takes one parameter, the config.BasicAuth returns a Handler // use: iris.Use(NewHandler(...)), iris.Get(...,iris.HandlerFunc(NewHandler(...)),...) func NewHandler(c config.BasicAuth) iris.Handler { b := &basicAuthMiddleware{config: config.DefaultBasicAuth().MergeSingle(c)} b.init() return b }