auth

package
v0.0.0-...-2da11fd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorUnauthorized = errors.New("unauthorized")
)

Functions

func Basic

func Basic(configs ...BasicConfig) ngamux.MiddlewareFunc

Types

type BasicConfig

type BasicConfig struct {
	Authorizer   func(username string, password string) bool
	ErrorHandler func(rw http.ResponseWriter, err error) error
	Realm        string
	Creds        map[string]string
}

BasicConfig is a configuration used in Basic function for basic authentication middleware. If credentials, authorizer, or errorhandler is not provided, it uses the default one when passed as an argument to Basic function. For default crendetials, there is default root:root credential stored inside a map with this format `username=password`. You can also provide a realm name for the challenge authentication method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL