From 57c6f22684e74191814a30f9de83a05c11ac4b78 Mon Sep 17 00:00:00 2001 From: Robin Lambertz Date: Mon, 17 Feb 2020 20:19:59 +0100 Subject: 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. --- modules/caddyhttp/caddyauth/basicauth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/caddyhttp/caddyauth') diff --git a/modules/caddyhttp/caddyauth/basicauth.go b/modules/caddyhttp/caddyauth/basicauth.go index e0868c2..50fbed9 100644 --- a/modules/caddyhttp/caddyauth/basicauth.go +++ b/modules/caddyhttp/caddyauth/basicauth.go @@ -53,7 +53,7 @@ func (HTTPBasicAuth) CaddyModule() caddy.ModuleInfo { // Provision provisions the HTTP basic auth provider. func (hba *HTTPBasicAuth) Provision(ctx caddy.Context) error { if hba.HashRaw == nil { - return fmt.Errorf("passwords must be hashed, so a hash must be defined") + hba.HashRaw = json.RawMessage(`{"algorithm": "bcrypt"}`) } // load password hasher -- cgit v1.2.3