Skip to content

Commit f064e90

Browse files
committed
Use no op method instead of directly comparing values
1 parent 5edd899 commit f064e90

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

google/auth/compute_engine/credentials.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ def with_quota_project(self, quota_project_id):
187187
quota_project_id=quota_project_id,
188188
scopes=self._scopes,
189189
default_scopes=self._default_scopes,
190+
universe_domain=self._universe_domain,
190191
trust_boundary=self._trust_boundary,
191192
)
192-
creds._universe_domain = self._universe_domain
193193
creds._universe_domain_cached = self._universe_domain_cached
194194
return creds
195195

@@ -203,9 +203,9 @@ def with_scopes(self, scopes, default_scopes=None):
203203
default_scopes=default_scopes,
204204
service_account_email=self._service_account_email,
205205
quota_project_id=self._quota_project_id,
206+
universe_domain=self._universe_domain,
206207
trust_boundary=self._trust_boundary,
207208
)
208-
creds._universe_domain = self._universe_domain
209209
creds._universe_domain_cached = self._universe_domain_cached
210210
return creds
211211

@@ -227,9 +227,9 @@ def with_trust_boundary(self, trust_boundary):
227227
quota_project_id=self._quota_project_id,
228228
scopes=self._scopes,
229229
default_scopes=self._default_scopes,
230+
universe_domain=self._universe_domain,
230231
trust_boundary=trust_boundary,
231232
)
232-
creds._universe_domain = self._universe_domain
233233
creds._universe_domain_cached = self._universe_domain_cached
234234
return creds
235235

google/auth/credentials.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,7 @@ def apply(self, headers, token=None):
310310
"""Apply the token to the authentication header."""
311311
super().apply(headers, token)
312312
if self._trust_boundary is not None:
313-
if (
314-
self._trust_boundary["encodedLocations"]
315-
== NO_OP_TRUST_BOUNDARY_ENCODED_LOCATIONS
316-
):
313+
if self._has_no_op_trust_boundary:
317314
# STS expects an empty string if the trust boundary value is no-op.
318315
headers["x-allowed-locations"] = ""
319316
else:

0 commit comments

Comments
 (0)