Package basicauth implements HTTP Basic Authentication for Caddy.
This is useful for simple protections on a website, like requiring a password to access an admin interface. This package assumes a fairly small threat model.
BasicAuth is middleware to protect resources with a username and password. Note that HTTP Basic Authentication is not secure by itself and should not be used to protect important assets without HTTPS. Even then, the security of HTTP Basic Auth is disputed. Use discretion when deciding what to protect with BasicAuth.
ServeHTTP implements the httpserver.Handler interface.
PasswordMatcher determines whether a password matches a rule.
GetHtpasswdMatcher matches password rules.
PlainMatcher returns a PasswordMatcher that does a constant-time byte comparison against the password passw.
Rule represents a BasicAuth rule. A username and password combination protect the associated resources, which are file or directory paths.