Documentation ¶
Index ¶
- Variables
- func AddFlags(flagSet *pflag.FlagSet)
- func AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string, Opt *Options)
- func Auth(opt Options) http.Middleware
- func CustomAuth(fn CustomAuthFn, realm string) httplib.Middleware
- func HtPasswdAuth(path, realm string) httplib.Middleware
- func SingleAuth(user, pass, realm string) httplib.Middleware
- type CustomAuthFn
- type LoggedBasicAuth
- type Options
Constants ¶
This section is empty.
Variables ¶
var ContextAuthKey = &contextAuthType{}
ContextAuthKey is a simple context key for storing info returned by CustomAuthFn
var ContextUserKey = &contextUserType{}
ContextUserKey is a simple context key for storing the username of the request
var Help = `` /* 622-byte string literal not displayed */
Help contains text describing the http authentication to add to the command help.
var (
Opt = Options{}
)
Options set by command line flags
Functions ¶
func AddFlagsPrefix ¶
AddFlagsPrefix adds flags for http/auth
func Auth ¶
func Auth(opt Options) http.Middleware
Auth instantiates middleware that authenticates users based on the configuration
func CustomAuth ¶
func CustomAuth(fn CustomAuthFn, realm string) httplib.Middleware
CustomAuth instantiates middleware that authenticates using a custom function
func HtPasswdAuth ¶
func HtPasswdAuth(path, realm string) httplib.Middleware
HtPasswdAuth instantiates middleware that authenticates against the passed htpasswd file
func SingleAuth ¶
func SingleAuth(user, pass, realm string) httplib.Middleware
SingleAuth instantiates middleware that authenticates for a single user
Types ¶
type CustomAuthFn ¶
CustomAuthFn if used will be used to authenticate user, pass. If an error is returned then the user is not authenticated.
If a non nil value is returned then it is added to the context under the key
type LoggedBasicAuth ¶
LoggedBasicAuth extends BasicAuth to include access logging
func NewLoggedBasicAuthenticator ¶
func NewLoggedBasicAuthenticator(realm string, secrets auth.SecretProvider) *LoggedBasicAuth
NewLoggedBasicAuthenticator instantiates a new instance of LoggedBasicAuthenticator
type Options ¶
type Options struct { HtPasswd string // htpasswd file - if not provided no authentication is done Realm string // realm for authentication BasicUser string // single username for basic auth if not using Htpasswd BasicPass string // password for BasicUser Auth CustomAuthFn `json:"-"` // custom Auth (not set by command line flags) }
Options contains options for the http authentication