Versions in this module Expand all Collapse all v0 v0.0.4 Nov 7, 2024 v0.0.3 Nov 1, 2023 v0.0.2 Sep 19, 2022 v0.0.1 Nov 23, 2020 Changes in this version + const DefaultCookieMaxAge + const DefaultMaxTriesCookie + const DefaultRealm + var ReadFile = ioutil.ReadFile + func BCRYPT(opts *UserAuthOptions) + func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error) + func Func(auth Middleware) func(http.HandlerFunc) http.HandlerFunc + func GetUser(r *http.Request) interface + func HandlerFunc(auth Middleware, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc + func Logout(r *http.Request) *http.Request + type AuthFunc func(r *http.Request, username, password string) (interface{}, bool) + func AllowUsers(users interface{}, opts ...UserAuthOption) AuthFunc + func AllowUsersFile(jsonOrYamlFilename string, opts ...UserAuthOption) AuthFunc + type BasicAuth struct + type ErrCredentialsExpired struct + AuthenticateHeader string + AuthenticateHeaderValue string + Code int + Password string + Username string + func (e ErrCredentialsExpired) Error() string + type ErrCredentialsForbidden struct + Age time.Duration + Password string + Tries int + Username string + func (e ErrCredentialsForbidden) Error() string + type ErrCredentialsInvalid struct + AuthenticateHeader string + AuthenticateHeaderValue string + Code int + CurrentTries int + Password string + Username string + func (e ErrCredentialsInvalid) Error() string + type ErrCredentialsMissing struct + AuthenticateHeader string + AuthenticateHeaderValue string + Code int + Header string + func (e ErrCredentialsMissing) Error() string + type ErrHTTPVersion struct + func (e ErrHTTPVersion) Error() string + type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error) + type GC struct + Context context.Context + Every time.Duration + type Map = map[string]interface + type Middleware = func(http.Handler) http.Handler + func Default(users interface{}, userOpts ...UserAuthOption) Middleware + func Load(jsonOrYamlFilename string, userOpts ...UserAuthOption) Middleware + func New(opts Options) Middleware + type Options struct + Allow AuthFunc + ErrorHandler ErrorHandler + ErrorLogger *log.Logger + GC GC + HTTPSOnly bool + MaxAge time.Duration + MaxTries int + MaxTriesCookie string + OnLogoutClearContext bool + Proxy bool + Realm string + type SimpleUser struct + Password string + Username string + func (u *SimpleUser) GetPassword() string + func (u *SimpleUser) GetUsername() string + type User interface + GetPassword func() string + GetUsername func() string + type UserAuthOption func(*UserAuthOptions) + type UserAuthOptions struct + ComparePassword func(stored, userPassword string) bool