Skip to content

Commit

Permalink
Merge pull request #20 from jibby0/digest-auth
Browse files Browse the repository at this point in the history
Add support for digest auth
  • Loading branch information
mblaschke authored Sep 14, 2024
2 parents b048736 + 893d05d commit a6a0260
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion shellyplug/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

resty "github.com/go-resty/resty/v2"
"github.com/icholy/digest"
cache "github.com/patrickmn/go-cache"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"
Expand Down Expand Up @@ -73,7 +74,12 @@ func (sp *ShellyPlug) SetTimeout(timeout time.Duration) {

func (sp *ShellyPlug) SetHttpAuth(username, password string) {
sp.client.SetDisableWarn(true)
sp.client.SetBasicAuth(username, password)
sp.client.SetBasicAuth(username, password).SetTransport(
&digest.Transport{
Username: username,
Password: password,
},
)
}

func (sp *ShellyPlug) SetTargets(targets []discovery.DiscoveryTarget) {
Expand Down

0 comments on commit a6a0260

Please sign in to comment.