mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-26 02:09:47 +08:00
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.
This commit is contained in:
parent
dd103a6787
commit
57c6f22684
|
@ -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…
Reference in New Issue
Block a user