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
*[Accessing resources using an OIDC or SAML 2.0 identity provider](#accessing-resources-using-an-oidc-or-saml-20-identity-provider)
34
35
*[Accessing resources using Executable-sourced credentials](#using-executable-sourced-workforce-credentials-with-oidc-and-saml)
@@ -467,6 +468,33 @@ credentials unless they do not meet your specific requirements.
467
468
You can now [use the Auth library](#using-external-identities) to call Google Cloud
468
469
resources from an OIDC or SAML provider.
469
470
471
+
#### Configurable Token Lifetime
472
+
When creating a credential configuration with workload identity federation using service account impersonation, you can provide an optional argument to configure the service account access token lifetime.
473
+
474
+
To generate the configuration with configurable token lifetime, run the following command (this example uses an AWS configuration, but the token lifetime can be configured for all workload identity federation providers):
475
+
```bash
476
+
# Generate an AWS configuration file with configurable token lifetime.
477
+
gcloud iam workload-identity-pools create-cred-config \
Where the following variables need to be substituted:
486
+
-`$PROJECT_NUMBER`: The Google Cloud project number.
487
+
-`$POOL_ID`: The workload identity pool ID.
488
+
-`$AWS_PROVIDER_ID`: The AWS provider ID.
489
+
-`$SERVICE_ACCOUNT_EMAIL`: The email of the service account to impersonate.
490
+
-`$TOKEN_LIFETIME`: The desired lifetime duration of the service account access token in seconds.
491
+
492
+
The `service-account-token-lifetime-seconds` flag is optional. If not provided, this defaults to one hour.
493
+
The minimum allowed value is 600 (10 minutes) and the maximum allowed value is 43200 (12 hours).
494
+
If a lifetime greater than one hour is required, the service account must be added as an allowed value in an Organization Policy that enforces the `constraints/iam.allowServiceAccountCredentialLifetimeExtension` constraint.
495
+
496
+
Note that configuring a short lifetime (e.g. 10 minutes) will result in the library initiating the entire token exchange flow every 10 minutes, which will call the 3rd party token provider even if the 3rd party token is not expired.
497
+
470
498
### Workforce Identity Federation
471
499
472
500
[Workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation) lets you use an
0 commit comments