Skip to content

Commit daa4a62

Browse files
committed
.
1 parent 1640cc5 commit daa4a62

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed

internal/command/command.go

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -165,42 +165,39 @@ func newServerConfig(ctx context.Context, config *Config) (*auth_providers.Serve
165165

166166
nonAmbientCredentialsConfigured := false
167167

168-
// TODO: Uncomment the below section
169-
/*
170-
if config.BasicAuth != nil {
171-
basicAuthConfig := auth_providers.NewBasicAuthAuthenticatorBuilder().
172-
WithUsername(config.BasicAuth.Username).
173-
WithPassword(config.BasicAuth.Password)
174-
basicAuthConfig.CommandAuthConfig = authConfig
175-
server = basicAuthConfig.GetServerConfig()
176-
177-
nonAmbientCredentialsConfigured = true
178-
}
179-
180-
if config.OAuth != nil {
181-
oauthConfig := auth_providers.NewOAuthAuthenticatorBuilder().
182-
WithTokenUrl(config.OAuth.TokenURL).
183-
WithClientId(config.OAuth.ClientID).
184-
WithClientSecret(config.OAuth.ClientSecret)
168+
if config.BasicAuth != nil {
169+
basicAuthConfig := auth_providers.NewBasicAuthAuthenticatorBuilder().
170+
WithUsername(config.BasicAuth.Username).
171+
WithPassword(config.BasicAuth.Password)
172+
basicAuthConfig.CommandAuthConfig = authConfig
173+
server = basicAuthConfig.GetServerConfig()
185174

186-
if len(config.OAuth.Scopes) > 0 {
187-
oauthConfig.WithScopes(config.OAuth.Scopes)
188-
}
189-
if config.OAuth.Audience != "" {
190-
oauthConfig.WithAudience(config.OAuth.Audience)
191-
}
175+
nonAmbientCredentialsConfigured = true
176+
}
192177

193-
oauthConfig.CommandAuthConfig = authConfig
194-
server = oauthConfig.GetServerConfig()
178+
if config.OAuth != nil {
179+
oauthConfig := auth_providers.NewOAuthAuthenticatorBuilder().
180+
WithTokenUrl(config.OAuth.TokenURL).
181+
WithClientId(config.OAuth.ClientID).
182+
WithClientSecret(config.OAuth.ClientSecret)
195183

196-
nonAmbientCredentialsConfigured = true
184+
if len(config.OAuth.Scopes) > 0 {
185+
oauthConfig.WithScopes(config.OAuth.Scopes)
197186
}
198-
*/
187+
if config.OAuth.Audience != "" {
188+
oauthConfig.WithAudience(config.OAuth.Audience)
189+
}
190+
191+
oauthConfig.CommandAuthConfig = authConfig
192+
server = oauthConfig.GetServerConfig()
193+
194+
nonAmbientCredentialsConfigured = true
195+
}
199196

200197
// If direct basic-auth/OAuth credentials were configured, continue. Otherwise,
201198
// we look for ambient credentials configured on the environment where we're running.
202199
if !nonAmbientCredentialsConfigured {
203-
log.Info("Using ambient credentails")
200+
log.Info("Using ambient credentails!")
204201
source := getAmbientTokenCredentialSource()
205202
if source == nil {
206203
log.Info("no direct credentials provided; attempting to use ambient credentials. trying Azure DefaultAzureCredential first")

0 commit comments

Comments
 (0)