summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/caddyauth
diff options
context:
space:
mode:
authorRobin Lambertz <github@roblab.la>2020-02-17 20:19:59 +0100
committerGitHub <noreply@github.com>2020-02-17 12:19:59 -0700
commit57c6f22684e74191814a30f9de83a05c11ac4b78 (patch)
tree80c7beddf5c6e56ba307860b4af106616696b36f /modules/caddyhttp/caddyauth
parentdd103a67876bd19afd000bda4410fbf83ee5b57d (diff)
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.
Diffstat (limited to 'modules/caddyhttp/caddyauth')
-rw-r--r--modules/caddyhttp/caddyauth/basicauth.go2
1 files changed, 1 insertions, 1 deletions
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