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
For `X.509 certificate-sourced credentials`_, the authentication library uses an X.509 certificate and private key to prove your application's identity. The certificate has a built-in expiration date and must be renewed to maintain access.
298
+
299
+
The library constructs a subject token by creating a JSON array containing the base64-encoded leaf certificate, followed by any intermediate certificates from a provided trust chain.
300
+
301
+
**Generating Configuration Files for X.509 Federation**
302
+
303
+
To configure X.509 certificate-sourced credentials, you need to generate two separate configuration files: a primary **credential configuration file** and a **certificate configuration file**. The ``gcloud iam workload-identity-pools create-cred-config`` command can be used to create both.
304
+
305
+
The location where the certificate configuration file is created depends on whether you use the ``--credential-cert-configuration-output-file`` flag.
306
+
307
+
**Default Behavior (Recommended)**
308
+
309
+
If you omit the ``--credential-cert-configuration-output-file`` flag, gcloud creates the certificate configuration file at a default, well-known location that the auth library can automatically discover. This is the simplest approach for most use cases.
310
+
311
+
**Example Command (Default Behavior):**
312
+
313
+
.. code-block:: bash
314
+
315
+
gcloud iam workload-identity-pools create-cred-config \
Where the following variables need to be substituted:
324
+
325
+
* ``$PROJECT_NUMBER``: The unique, numerical identifier for your Google Cloud project. This is not the Project ID string.
326
+
* ``$POOL_ID``: The workload identity pool ID.
327
+
* ``$PROVIDER_ID``: The provider ID.
328
+
* ``$SERVICE_ACCOUNT_EMAIL``: The email of the service account to impersonate.
329
+
* ``$PATH_TO_CERTIFICATE``: The file path where your leaf X.509 certificate is located.
330
+
* ``$PATH_TO_PRIVATE_KEY``: The file path where the corresponding private key for the leaf certificate is located.
331
+
* ``$PATH_TO_TRUST_CHAIN``: The file path of the X.509 certificate trust chain file. This file should be a PEM-formatted file containing any intermediate certificates required to complete the trust chain between the leaf certificate and the trust store configured in the Workload Identity Federation pool. The leaf certificate is optional in this file.
332
+
333
+
This command results in:
334
+
335
+
* ``/path/to/config.json``: Created at the path you specified. This file will contain ``"use_default_certificate_config": true`` to instruct clients to look for the certificate configuration at the default path.
336
+
* ``certificate_config.json``: Created at the default gcloud configuration path, which is typically ``~/.config/gcloud/certificate_config.json`` on Linux and macOS, or ``%APPDATA%\gcloud\certificate_config.json`` on Windows.
337
+
338
+
339
+
**Custom Location Behavior**
340
+
341
+
If you need to store the certificate configuration file in a non-default location, use the ``--credential-cert-configuration-output-file`` flag.
342
+
343
+
**Example Command (Custom Location):**
344
+
345
+
.. code-block:: bash
346
+
347
+
gcloud iam workload-identity-pools create-cred-config \
* ``/path/to/config.json``: Created at the path you specified. This file will contain a ``"certificate_config_location"`` field that points to your custom path.
360
+
* ``cert_config.json``: Created at ``/custom/path/cert_config.json``, as specified by the flag.
361
+
362
+
You can now use the Auth library to call Google Cloud resources with X.509 certificate-sourced credentials.
0 commit comments