Skip to content

Commit 7c52978

Browse files
authored
fix(auth): Enable client certificates by default only for GDU (#10151)
1 parent bcb5568 commit 7c52978

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

auth/internal/transport/cba.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func getTransportConfig(opts *Options) (*transportConfig, error) {
217217
// encountered while initializing the default source will be reported as client
218218
// error (ex. corrupt metadata file).
219219
func getClientCertificateSource(opts *Options) (cert.Provider, error) {
220-
if !isClientCertificateEnabled() {
220+
if !isClientCertificateEnabled(opts) {
221221
return nil, nil
222222
} else if opts.ClientCertProvider != nil {
223223
return opts.ClientCertProvider, nil
@@ -226,14 +226,14 @@ func getClientCertificateSource(opts *Options) (cert.Provider, error) {
226226

227227
}
228228

229-
// isClientCertificateEnabled returns true by default, unless explicitly set to false via env var.
230-
func isClientCertificateEnabled() bool {
229+
// isClientCertificateEnabled returns true by default for all GDU universe domain, unless explicitly overridden by env var
230+
func isClientCertificateEnabled(opts *Options) bool {
231231
if value, ok := os.LookupEnv(googleAPIUseCertSource); ok {
232232
// error as false is OK
233233
b, _ := strconv.ParseBool(value)
234234
return b
235235
}
236-
return true
236+
return opts.isUniverseDomainGDU()
237237
}
238238

239239
type transportConfig struct {

0 commit comments

Comments
 (0)