You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR provides helper methods to allow custom HTTP and WebSocket
connection pools (such as those in google-genai and google-adk) to load
default client certificates and resolve the GOOGLE_API_USE_MTLS_ENDPOINT
env var. Changes include:
- Introduced `GOOGLE_API_USE_MTLS_ENDPOINT` environment variable to
control whether an mTLS endpoint should be used (`always`, `never`, or
`auto`).
- Added several new helper functions in `google.auth.transport.mtls` to
facilitate SSL context creation and client certificate loading:
- `_load_client_cert_into_context`: Loads a client certificate and key
into a provided SSL context.
- `load_default_client_cert`: Discovers and loads the default client
certificate into a provided SSL context if mTLS is enabled.
- `get_default_ssl_context`: Returns a default SSL context pre-loaded
with the default client certificate, or `None` if unavailable.
- `should_use_mtls_endpoint`: Determines if an mTLS endpoint should be
used based on the new environment variable and certificate availability.
- Fixed outdated docstrings for `default_client_cert_source` and
`default_client_encrypted_cert_source` to correctly state they raise
`MutualTLSChannelError` instead of `DefaultClientCertSourceError`.
- Added comprehensive unit tests for the new mTLS helper methods.
0 commit comments