aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/google/oauth2/_client.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-06-21 09:28:26 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-06-21 09:36:40 +0300
commit0cb3f820fac6a243bcb7e4c4388700898660bfd0 (patch)
tree056f1b8bc5f72039fa422aac0af13bab0e966aa7 /contrib/python/google-auth/py3/google/oauth2/_client.py
parent08049311fe5c42a97e8bb47a73fb6cd143c0bdb1 (diff)
downloadydb-0cb3f820fac6a243bcb7e4c4388700898660bfd0.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/google-auth/py3/google/oauth2/_client.py')
-rw-r--r--contrib/python/google-auth/py3/google/oauth2/_client.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/python/google-auth/py3/google/oauth2/_client.py b/contrib/python/google-auth/py3/google/oauth2/_client.py
index d2af6c8aa85..bce797b88bb 100644
--- a/contrib/python/google-auth/py3/google/oauth2/_client.py
+++ b/contrib/python/google-auth/py3/google/oauth2/_client.py
@@ -39,10 +39,6 @@ _URLENCODED_CONTENT_TYPE = "application/x-www-form-urlencoded"
_JSON_CONTENT_TYPE = "application/json"
_JWT_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer"
_REFRESH_GRANT_TYPE = "refresh_token"
-_IAM_IDTOKEN_ENDPOINT = (
- "https://iamcredentials.googleapis.com/v1/"
- + "projects/-/serviceAccounts/{}:generateIdToken"
-)
def _handle_error_response(response_data, retryable_error):
@@ -328,12 +324,15 @@ def jwt_grant(request, token_uri, assertion, can_retry=True):
return access_token, expiry, response_data
-def call_iam_generate_id_token_endpoint(request, signer_email, audience, access_token):
+def call_iam_generate_id_token_endpoint(
+ request, iam_id_token_endpoint, signer_email, audience, access_token
+):
"""Call iam.generateIdToken endpoint to get ID token.
Args:
request (google.auth.transport.Request): A callable used to make
HTTP requests.
+ iam_id_token_endpoint (str): The IAM ID token endpoint to use.
signer_email (str): The signer email used to form the IAM
generateIdToken endpoint.
audience (str): The audience for the ID token.
@@ -346,7 +345,7 @@ def call_iam_generate_id_token_endpoint(request, signer_email, audience, access_
response_data = _token_endpoint_request(
request,
- _IAM_IDTOKEN_ENDPOINT.format(signer_email),
+ iam_id_token_endpoint.format(signer_email),
body,
access_token=access_token,
use_json=True,