aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/google-auth/py3/google/auth/transport/requests.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/auth/transport/requests.py
parent08049311fe5c42a97e8bb47a73fb6cd143c0bdb1 (diff)
downloadydb-0cb3f820fac6a243bcb7e4c4388700898660bfd0.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/google-auth/py3/google/auth/transport/requests.py')
-rw-r--r--contrib/python/google-auth/py3/google/auth/transport/requests.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/contrib/python/google-auth/py3/google/auth/transport/requests.py b/contrib/python/google-auth/py3/google/auth/transport/requests.py
index aa16113226..63a2b4596c 100644
--- a/contrib/python/google-auth/py3/google/auth/transport/requests.py
+++ b/contrib/python/google-auth/py3/google/auth/transport/requests.py
@@ -262,19 +262,16 @@ class _MutualTlsOffloadAdapter(requests.adapters.HTTPAdapter):
def __init__(self, enterprise_cert_file_path):
import certifi
- import urllib3.contrib.pyopenssl
-
from google.auth.transport import _custom_tls_signer
- # Call inject_into_urllib3 to activate certificate checking. See the
- # following links for more info:
- # (1) doc: https://github.com/urllib3/urllib3/blob/cb9ebf8aac5d75f64c8551820d760b72b619beff/src/urllib3/contrib/pyopenssl.py#L31-L32
- # (2) mTLS example: https://github.com/urllib3/urllib3/issues/474#issuecomment-253168415
- urllib3.contrib.pyopenssl.inject_into_urllib3()
-
self.signer = _custom_tls_signer.CustomTlsSigner(enterprise_cert_file_path)
self.signer.load_libraries()
+ if not self.signer.should_use_provider():
+ import urllib3.contrib.pyopenssl
+
+ urllib3.contrib.pyopenssl.inject_into_urllib3()
+
poolmanager = create_urllib3_context()
poolmanager.load_verify_locations(cafile=certifi.where())
self.signer.attach_to_ssl_context(poolmanager)