public class X509Provider implements MtlsProviderThis class implements 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.
Implements
MtlsProviderConstructors
X509Provider()
public X509Provider()Creates a new X.509 provider that will check the environment variable path and the well known Gcloud certificate configuration location. This is meant for internal Google Cloud usage and behavior may be changed without warning.
X509Provider(EnvironmentProvider envProvider, PropertyProvider propProvider, String certConfigPathOverride)
public X509Provider(EnvironmentProvider envProvider, PropertyProvider propProvider, 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. This is meant for internal Google Cloud usage and behavior may be changed without warning.
| Parameters | |
|---|---|
| Name | Description |
envProvider |
EnvironmentProviderenvironment provider used for environment variables |
propProvider |
PropertyProviderproperty provider used for system properties |
certConfigPathOverride |
Stringthe path to read the certificate configuration from. |
X509Provider(String certConfigPathOverride)
public X509Provider(String certConfigPathOverride)Creates an X509 provider with an override path for the certificate configuration.
| Parameter | |
|---|---|
| Name | Description |
certConfigPathOverride |
Stringthe path to read the certificate configuration from. |
Methods
getKeyStore()
public KeyStore getKeyStore()Finds the certificate configuration file, then builds a Keystore using the X.509 certificate and private key pointed to by the configuration. This will check the following locations in order.
- The certificate config override path, if set.
- The path pointed to by the "GOOGLE_API_CERTIFICATE_CONFIG" environment variable
- The well known gcloud location for the certificate configuration file.
| Returns | |
|---|---|
| Type | Description |
KeyStore |
a KeyStore containing the X.509 certificate specified by the certificate configuration. |
| Exceptions | |
|---|---|
| Type | Description |
CertificateSourceUnavailableException |
if the certificate source is unavailable (ex. missing configuration file) |
IOException |
if the certificate source is unavailable (ex. missing configuration file) |
isAvailable()
public boolean isAvailable()Returns true if the X509 mTLS provider is available.
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
if a general I/O error occurs while determining availability. |