@marcel91200 / caddy Mirror · read-only / commits / 57c6f226
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

basicauth: default hash to bcrypt (#3050)

The documentation specifies that the hash algorithm defaults to bcrypt. However, the implementation returns an error in provision if no hash is provided. Fix this inconsistency by *actually* defaulting to bcrypt.

Robin Lambertz committed Feb 17, 2020 at 20:19 UTC 57c6f22684e74191814a30f9de83a05c11ac4b78
1 file changed +1 -1
modules/caddyhttp/caddyauth/basicauth.go
+1 -1
@@ -53,7 +53,7 @@ func (HTTPBasicAuth) CaddyModule() caddy.ModuleInfo {
53 // Provision provisions the HTTP basic auth provider.
54 func (hba *HTTPBasicAuth) Provision(ctx caddy.Context) error {
55 if hba.HashRaw == nil {
56 - return fmt.Errorf("passwords must be hashed, so a hash must be defined")
56 + hba.HashRaw = json.RawMessage(`{"algorithm": "bcrypt"}`)
57 }
58
59 // load password hasher