diff --git a/charger/shelly.go b/charger/shelly.go index 42715c96e..443954776 100644 --- a/charger/shelly.go +++ b/charger/shelly.go @@ -84,6 +84,7 @@ func NewShelly(uri, user, password string, channel int, standbypower float64) (* // https://shelly-api-docs.shelly.cloud/gen1/#shelly-family-overview c.uri = util.DefaultScheme(uri, "http") if user != "" { + log.Redact(transport.BasicAuthHeader(user, password)) c.Client.Transport = transport.BasicAuth(user, password, c.Client.Transport) } diff --git a/meter/discovergy.go b/meter/discovergy.go index 893459700..a7fcae4f4 100644 --- a/meter/discovergy.go +++ b/meter/discovergy.go @@ -39,7 +39,9 @@ func NewDiscovergyFromConfig(other map[string]interface{}) (api.Meter, error) { return nil, err } - log := util.NewLogger("discgy").Redact(cc.User, cc.Password, cc.Meter) + basicAuth := transport.BasicAuthHeader(cc.User, cc.Password) + + log := util.NewLogger("discgy").Redact(cc.User, cc.Password, cc.Meter, basicAuth) client := request.NewHelper(log) client.Transport = transport.BasicAuth(cc.User, cc.Password, client.Transport) diff --git a/provider/http.go b/provider/http.go index 815b0587c..826b1b567 100644 --- a/provider/http.go +++ b/provider/http.go @@ -201,6 +201,9 @@ func (p *HTTP) WithScript(vm, script string) (*HTTP, error) { func (p *HTTP) WithAuth(typ, user, password string) (*HTTP, error) { switch strings.ToLower(typ) { case "basic": + basicAuth := transport.BasicAuthHeader(user, password) + log.Redact(basicAuth) + p.Client.Transport = transport.BasicAuth(user, password, p.Client.Transport) case "digest": p.Client.Transport = digest.NewTransport(user, password, p.Client.Transport) diff --git a/provider/socket.go b/provider/socket.go index 433d72f49..bc434e113 100644 --- a/provider/socket.go +++ b/provider/socket.go @@ -70,7 +70,10 @@ func NewSocketProviderFromConfig(other map[string]interface{}) (IntProvider, err // handle basic auth if cc.Auth.Type != "" { - p.headers["Authorization"] = transport.BasicAuthHeader(cc.Auth.User, cc.Auth.Password) + basicAuth := transport.BasicAuthHeader(cc.Auth.User, cc.Auth.Password) + log.Redact(basicAuth) + + p.headers["Authorization"] = basicAuth } // ignore the self signed certificate diff --git a/vehicle/volvo.go b/vehicle/volvo.go index 6076f52fb..71078422d 100644 --- a/vehicle/volvo.go +++ b/vehicle/volvo.go @@ -38,7 +38,9 @@ func NewVolvoFromConfig(other map[string]interface{}) (api.Vehicle, error) { return nil, err } - log := util.NewLogger("volvo").Redact(cc.User, cc.Password, cc.VIN) + basicAuth := transport.BasicAuthHeader(cc.User, cc.Password) + + log := util.NewLogger("volvo").Redact(cc.User, cc.Password, cc.VIN, basicAuth) v := &Volvo{ embed: &cc.embed, @@ -49,7 +51,7 @@ func NewVolvoFromConfig(other map[string]interface{}) (api.Vehicle, error) { v.Client.Transport = &transport.Decorator{ Base: v.Client.Transport, Decorator: transport.DecorateHeaders(map[string]string{ - "Authorization": transport.BasicAuthHeader(cc.User, cc.Password), + "Authorization": basicAuth, "Content-Type": "application/json", "X-Device-Id": "Device", "X-OS-Type": "Android",