@@ -28,12 +28,17 @@ func init() {
2828 )
2929}
3030
31- // A Caddy `http.handlers` module that implements the dns01proxy API.
31+ // Implements an API for proxying ACME DNS-01 challenges.
32+ //
33+ // This is a Caddy `http.handlers` module.
3234type Handler struct {
3335 DNS DNSConfig `json:"dns"`
3436
35- // During provisioning, this is used to fill in [Authentication] and
36- // [ClientRegistry].
37+ // Configures HTTP basic authentication and the domains for which each user
38+ // can get TLS certificates.
39+ //
40+ // (During provisioning, this is used to fill in [Authentication] and
41+ // [ClientRegistry].)
3742 AccountsRaw []RawAccount `json:"accounts"`
3843
3944 // Specifies how clients should be authenticated. If absent, then clients must
@@ -55,7 +60,11 @@ var _ caddyfile.Unmarshaler = (*Handler)(nil)
5560
5661type RawAccount struct {
5762 ClientPolicy
58- Password optionals.Optional [string ] `json:"password"`
63+
64+ // The user's password, hashed using `caddy hash-password`. Optional. If
65+ // omitted, then clients must be authenticated by an
66+ // `http.handlers.authentication` instance earlier in the handler chain.
67+ Password * string `json:"password,omitempty"`
5968}
6069
6170func (Handler ) CaddyModule () caddy.ModuleInfo {
@@ -79,10 +88,10 @@ func (h *Handler) Provision(ctx caddy.Context) error {
7988 // Provision Authentication from AccountsRaw.
8089 accountList := []caddyauth.Account {}
8190 for _ , rawAccount := range h .AccountsRaw {
82- if password , exists := rawAccount .Password . Get (); exists {
91+ if rawAccount .Password != nil {
8392 accountList = append (accountList , caddyauth.Account {
8493 Username : rawAccount .UserID ,
85- Password : password ,
94+ Password : * rawAccount . Password ,
8695 })
8796 }
8897 }
@@ -329,10 +338,10 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
329338 if ! d .AllArgs ((& password )) {
330339 return d .ArgErr ()
331340 }
332- if account .Password . IsSome () {
341+ if account .Password != nil {
333342 return fmt .Errorf ("cannot specify more than one password per user" )
334343 }
335- account .Password = optionals . Some ( password )
344+ account .Password = & password
336345 continue
337346
338347 case "allow_domains" :
0 commit comments