OAuth2: refactor authorization framework (BC) (#23978)

This commit is contained in:
andig 2025-09-30 18:35:10 +02:00 • committed by GitHub
parent c642732588
commit 2780278752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 241 additions and 311 deletions

View file

@ -10,6 +10,7 @@ import (
"github.com/evcc-io/evcc/util"
"github.com/evcc-io/evcc/util/transport"
"github.com/jpfielding/go-http-digest/pkg/digest"
"golang.org/x/oauth2"
)
// Auth is the authorization config
@ -47,11 +48,14 @@ func (p *Auth) Transport(ctx context.Context, log *util.Logger, base http.RoundT
p.Other["password"] = p.Password
}
authorizer, err := auth.NewFromConfig(ctx, p.Source, p.Other)
ts, err := auth.NewFromConfig(ctx, p.Source, p.Other)
if err != nil {
return nil, err
}
return authorizer.Transport(base), nil
return &oauth2.Transport{
Source: ts,
Base: base,
}, nil
}
}