Skip to content

Commit 2eecf8e

Browse files
committed
Uncomment Oauth lines
1 parent 721a3f5 commit 2eecf8e

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

internal/command/command.go

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,38 +164,34 @@ func newServerConfig(ctx context.Context, config *Config) (*auth_providers.Serve
164164
authConfig.WithCommandCACert(string(config.CaCertsBytes))
165165

166166
nonAmbientCredentialsConfigured := false
167+
if config.BasicAuth != nil {
168+
basicAuthConfig := auth_providers.NewBasicAuthAuthenticatorBuilder().
169+
WithUsername(config.BasicAuth.Username).
170+
WithPassword(config.BasicAuth.Password)
171+
basicAuthConfig.CommandAuthConfig = authConfig
172+
server = basicAuthConfig.GetServerConfig()
167173

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-
}
174+
nonAmbientCredentialsConfigured = true
175+
}
179176

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)
177+
if config.OAuth != nil {
178+
oauthConfig := auth_providers.NewOAuthAuthenticatorBuilder().
179+
WithTokenUrl(config.OAuth.TokenURL).
180+
WithClientId(config.OAuth.ClientID).
181+
WithClientSecret(config.OAuth.ClientSecret)
185182

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-
}
183+
if len(config.OAuth.Scopes) > 0 {
184+
oauthConfig.WithScopes(config.OAuth.Scopes)
185+
}
186+
if config.OAuth.Audience != "" {
187+
oauthConfig.WithAudience(config.OAuth.Audience)
188+
}
192189

193-
oauthConfig.CommandAuthConfig = authConfig
194-
server = oauthConfig.GetServerConfig()
190+
oauthConfig.CommandAuthConfig = authConfig
191+
server = oauthConfig.GetServerConfig()
195192

196-
nonAmbientCredentialsConfigured = true
197-
}
198-
*/
193+
nonAmbientCredentialsConfigured = true
194+
}
199195

200196
// If direct basic-auth/OAuth credentials were configured, continue. Otherwise,
201197
// we look for ambient credentials configured on the environment where we're running.

0 commit comments

Comments
 (0)