maintain backwards compatability for default oidc scope variable

This commit is contained in:
Matt Feury 2022-11-29 13:55:37 -05:00
parent 3d0cd1ccb5
commit 027342e117

View File

@ -103,10 +103,17 @@ func NewOidcAuthSetter(baseCfg BaseConfig, cfg OidcClientConfig) *OidcAuthProvid
eps[k] = []string{v}
}
// Previous versions hardcoded the scope to audience,
// so for backwards compatability, use that if no scope is set
scope := cfg.OidcAudience
if cfg.OidcScope != "" {
scope = cfg.OidcScope
}
tokenGenerator := &clientcredentials.Config{
ClientID: cfg.OidcClientID,
ClientSecret: cfg.OidcClientSecret,
Scopes: []string{cfg.OidcScope},
Scopes: []string{scope},
TokenURL: cfg.OidcTokenEndpointURL,
EndpointParams: eps,
}