public class X509Provider extends Object implements MtlsProvider
MtlsProvider for the Google Auth library transport layer via WorkloadCertificateConfiguration. This is only meant to be used internally by Google Cloud
libraries, and the public facing methods may be changed without notice, and have no guarantee of
backwards compatibility.| Constructor and Description |
|---|
X509Provider()
Creates a new X.509 provider that will check the environment variable path and the well known
Gcloud certificate configuration location.
|
X509Provider(String certConfigPathOverride)
Creates an X509 provider with an override path for the certificate configuration, bypassing the
normal checks for the well known certificate configuration file path and environment variable.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getCertificatePath()
Returns the path to the client certificate file specified by the loaded workload certificate
configuration.
|
KeyStore |
getKeyStore()
Finds the certificate configuration file, then builds a Keystore using the X.509 certificate
and private key pointed to by the configuration.
|
boolean |
isAvailable()
Returns true if the X509 mTLS provider is available.
|
public X509Provider(String certConfigPathOverride)
certConfigPathOverride - the path to read the certificate configuration from.public X509Provider()
public String getCertificatePath() throws IOException
If the configuration has not been loaded yet (e.g., if getKeyStore() has not been
called), this method will attempt to load it first by searching the override path, environment
variable, and well-known locations.
IOException - if the certificate configuration cannot be found or loaded, or if the
configuration file does not specify a certificate path.CertificateSourceUnavailableException - if the configuration file is not found.public KeyStore getKeyStore() throws CertificateSourceUnavailableException, IOException
getKeyStore in interface MtlsProviderCertificateSourceUnavailableException - if the certificate source is unavailable (ex.
missing configuration file)IOException - if a general I/O error occurs while creating the KeyStorepublic boolean isAvailable()
throws IOException
isAvailable in interface MtlsProviderIOException - if a general I/O error occurs while determining availability.Copyright © 2026 Google. All rights reserved.