Browse Source

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.
master
Robin Lambertz 5 years ago
committed by GitHub
parent
commit
57c6f22684
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/caddyhttp/caddyauth/basicauth.go

2
modules/caddyhttp/caddyauth/basicauth.go

@ -53,7 +53,7 @@ func (HTTPBasicAuth) CaddyModule() caddy.ModuleInfo {
// Provision provisions the HTTP basic auth provider. // Provision provisions the HTTP basic auth provider.
func (hba *HTTPBasicAuth) Provision(ctx caddy.Context) error { func (hba *HTTPBasicAuth) Provision(ctx caddy.Context) error {
if hba.HashRaw == nil { 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 // load password hasher

Loading…
Cancel
Save