aboutsummaryrefslogtreecommitdiff
path: root/google
diff options
context:
space:
mode:
authorarithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>2021-05-20 16:04:06 -0700
committerGitHub <noreply@github.com>2021-05-20 16:04:06 -0700
commite6976879b392508c022610ab3ea2ea55c7089c63 (patch)
tree8bdb9876820e29719fad2c7fb8f6f2785ca4ffe3 /google
parente9ca25fa39a112cc1a376388ab47a4e1b3ea746c (diff)
downloadgoogle-auth-library-python-e6976879b392508c022610ab3ea2ea55c7089c63.tar.gz
fix: allow user to customize context aware metadata path in _mtls_helper (#754)
Diffstat (limited to 'google')
-rw-r--r--google/auth/transport/_mtls_helper.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/google/auth/transport/_mtls_helper.py b/google/auth/transport/_mtls_helper.py
index 388ae3c..4dccb10 100644
--- a/google/auth/transport/_mtls_helper.py
+++ b/google/auth/transport/_mtls_helper.py
@@ -141,13 +141,17 @@ def _run_cert_provider_command(command, expect_encrypted_key=False):
return cert_match[0], key_match[0], None
-def get_client_ssl_credentials(generate_encrypted_key=False):
+def get_client_ssl_credentials(
+ generate_encrypted_key=False,
+ context_aware_metadata_path=CONTEXT_AWARE_METADATA_PATH,
+):
"""Returns the client side certificate, private key and passphrase.
Args:
generate_encrypted_key (bool): If set to True, encrypted private key
and passphrase will be generated; otherwise, unencrypted private key
will be generated and passphrase will be None.
+ context_aware_metadata_path (str): The context_aware_metadata.json file path.
Returns:
Tuple[bool, bytes, bytes, bytes]:
@@ -158,7 +162,7 @@ def get_client_ssl_credentials(generate_encrypted_key=False):
google.auth.exceptions.ClientCertError: if problems occurs when getting
the cert, key and passphrase.
"""
- metadata_path = _check_dca_metadata_path(CONTEXT_AWARE_METADATA_PATH)
+ metadata_path = _check_dca_metadata_path(context_aware_metadata_path)
if metadata_path:
metadata_json = _read_dca_metadata_file(metadata_path)