Exemplo n.º 1
0
 def __init__(self):
     # Load client SSL credentials.
     self._context_aware_metadata_path = _mtls_helper._check_dca_metadata_path(
         _mtls_helper.CONTEXT_AWARE_METADATA_PATH)
     if self._context_aware_metadata_path:
         self._is_mtls = True
     else:
         self._is_mtls = False
Exemplo n.º 2
0
def has_default_client_cert_source():
    """Check if default client SSL credentials exists on the device.

    Returns:
        bool: indicating if the default client cert source exists.
    """
    metadata_path = _mtls_helper._check_dca_metadata_path(
        _mtls_helper.CONTEXT_AWARE_METADATA_PATH)
    return metadata_path is not None
Exemplo n.º 3
0
 def __init__(self):
     use_client_cert = os.getenv(
         environment_vars.GOOGLE_API_USE_CLIENT_CERTIFICATE, "false")
     if use_client_cert != "true":
         self._is_mtls = False
     else:
         # Load client SSL credentials.
         metadata_path = _mtls_helper._check_dca_metadata_path(
             _mtls_helper.CONTEXT_AWARE_METADATA_PATH)
         self._is_mtls = metadata_path is not None
 def test_failure(self):
     metadata_path = os.path.join(pytest.data_dir, "not_exists.json")
     returned_path = _mtls_helper._check_dca_metadata_path(metadata_path)
     assert returned_path is None
 def test_success(self):
     metadata_path = os.path.join(pytest.data_dir,
                                  "context_aware_metadata.json")
     returned_path = _mtls_helper._check_dca_metadata_path(metadata_path)
     assert returned_path is not None
Exemplo n.º 6
0
 def __init__(self):
     # Load client SSL credentials.
     metadata_path = _mtls_helper._check_dca_metadata_path(
         _mtls_helper.CONTEXT_AWARE_METADATA_PATH
     )
     self._is_mtls = metadata_path is not None