package
0.0.0-20241222002135-c9d1db9af773
Repository: https://github.com/alphaone1/midgard.git
Documentation: pkg.go.dev
# README
HTPassWD Authorizer
The htpasswd authorizer is a simple user-password matcher. It reads its configuration from a htpasswd formatted file.
Example
handler := midgard.StackMiddlewareHandler(
[]defs.Middleware{
util.Must(New(
WithAuthenticator(util.Must(
htpasswd_auth.New(htpasswd_auth.WithAuthFile('./testwd')))),
WithRealm("testrealm"))),
},
http.HandlerFunc(util.DummyHandler),
)
Be aware that having password hashes accessible to the program potentially exposes them to attackers. Use strong hashing like bcrypt to counteract brute force attacks on the hashes or rainbow tables.
# Functions
New creates a new htpasswd authenticator.
WithAuthFile configures the htpasswd file to be read from the filesystem with the given name.
WithAuthInput configures the htpasswd file to be read from the given io.Reader.
# Structs
HTPassWDAuth holds the htpasswd relevant data.