Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit e482e53

Browse files
committed
fix minor issues
1 parent b1cb7e1 commit e482e53

4 files changed

Lines changed: 10 additions & 13 deletions

File tree

google/auth/_regional_access_boundary_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class _RegionalAccessBoundaryRefreshThread(threading.Thread):
2222

2323
def __init__(self, credentials, request):
2424
super(_RegionalAccessBoundaryRefreshThread, self).__init__()
25+
self.daemon = True
2526
self._credentials = credentials
2627
self._request = request
2728

@@ -63,15 +64,16 @@ def run(self):
6364
_LOGGER.warning(
6465
"Asynchronous Regional Access Boundary lookup failed. Entering cooldown."
6566
)
67+
self._credentials._regional_access_boundary_cooldown_expiry = (
68+
_helpers.utcnow()
69+
+ self._credentials._current_rab_cooldown_duration
70+
)
6671
new_cooldown_duration = (
6772
self._credentials._current_rab_cooldown_duration * 2
6873
)
6974
self._credentials._current_rab_cooldown_duration = min(
7075
new_cooldown_duration, MAX_REGIONAL_ACCESS_BOUNDARY_COOLDOWN
7176
)
72-
self._credentials._regional_access_boundary_cooldown_expiry = (
73-
_helpers.utcnow() + self._credentials._current_rab_cooldown_duration
74-
)
7577
# If the proactive refresh failed, clear any existing expired RAB data.
7678
# This ensures we don't continue using stale data.
7779
self._credentials._regional_access_boundary = None

google/auth/compute_engine/credentials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def _build_regional_access_boundary_lookup_url(self):
172172

173173
return (
174174
_constants._SERVICE_ACCOUNT_REGIONAL_ACCESS_BOUNDARY_LOOKUP_ENDPOINT.format(
175-
self.service_account_email
175+
service_account_email=self.service_account_email
176176
)
177177
)
178178

google/auth/credentials.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,6 @@ def _build_regional_access_boundary_lookup_url(self):
545545
)
546546

547547

548-
# For backward compatibility.
549-
CredentialsWithTrustBoundary = CredentialsWithRegionalAccessBoundary
550-
551-
552548
class AnonymousCredentials(Credentials):
553549
"""Credentials that do not provide any authentication information.
554550

google/auth/impersonated_credentials.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from google.auth import iam
4040
from google.auth import jwt
4141
from google.auth import metrics
42+
from google.auth import _constants
4243
from google.oauth2 import _client
4344

4445
import logging
@@ -50,9 +51,7 @@
5051
_DEFAULT_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds
5152

5253
_GOOGLE_OAUTH2_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token"
53-
_REGIONAL_ACCESS_BOUNDARY_LOOKUP_ENDPOINT = (
54-
"https://iamcredentials.{}/v1/projects/-/serviceAccounts/{}/allowedLocations"
55-
)
54+
5655

5756
_SOURCE_CREDENTIAL_AUTHORIZED_USER_TYPE = "authorized_user"
5857
_SOURCE_CREDENTIAL_SERVICE_ACCOUNT_TYPE = "service_account"
@@ -361,8 +360,8 @@ def _build_regional_access_boundary_lookup_url(self):
361360
"Service account email is required to build the Regional Access Boundary lookup URL for impersonated credentials."
362361
)
363362
return None
364-
return _REGIONAL_ACCESS_BOUNDARY_LOOKUP_ENDPOINT.format(
365-
self.universe_domain, self.service_account_email
363+
return _constants._SERVICE_ACCOUNT_REGIONAL_ACCESS_BOUNDARY_LOOKUP_ENDPOINT.format(
364+
service_account_email=self.service_account_email
366365
)
367366

368367
def sign_bytes(self, message):

0 commit comments

Comments
 (0)