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
.setSubjectTokenSupplier(tokenSupplier) // Sets the token supplier.
514
+
.setAudience(...) // Sets the GCP audience.
515
+
.setSubjectTokenType(SubjectTokenTypes.JWT) // Sets the subject token type.
516
+
.build();
517
+
```
518
+
Where the [audience](https://cloud.google.com/iam/docs/best-practices-for-using-workload-identity-federation#provider-audience) is:
Where the following variables need to be substituted:
522
+
-`$WORKLOAD_POOL_ID`: The workload pool ID.
523
+
-`$PROVIDER_ID`: The provider ID.
524
+
525
+
The values for audience, service account impersonation URL, and any other builder field can also be found by
526
+
generating a [credential configuration file with the gcloud CLI](https://cloud.google.com/sdk/gcloud/reference/iam/workload-identity-pools/create-cred-config).
527
+
528
+
#### Using a custom supplier with AWS
529
+
A custom implementation of AwsSecurityCredentialsSupplier can be provided when initializing AwsCredentials. If provided, the AwsCredentials instance will defer to the supplier to retrieve AWS security credentials to exchange for a GCP access token.
530
+
The supplier must return valid, unexpired AWS security credentials when called by the GCP credential.
531
+
532
+
AwsCredentials do not cache the returned AWS security credentials or region, so caching logic should be
533
+
implemented in the supplier to prevent multiple requests for the same resources.
.setSubjectTokenType(SubjectTokenTypes.AWS4) // Sets the subject token type.
580
+
.setAudience(...) // Sets the GCP audience.
581
+
.setAwsSecurityCredentialsSupplier(supplier) // Sets the supplier.
582
+
.build();
583
+
```
584
+
585
+
Where the [audience](https://cloud.google.com/iam/docs/best-practices-for-using-workload-identity-federation#provider-audience) is:
Where the following variables need to be substituted:
589
+
-`$WORKLOAD_POOL_ID`: The workload pool ID.
590
+
-`$PROVIDER_ID`: The provider ID.
591
+
592
+
The values for audience, service account impersonation URL, and any other builder field can also be found by
593
+
generating a [credential configuration file with the gcloud CLI](https://cloud.google.com/sdk/gcloud/reference/iam/workload-identity-pools/create-cred-config).
594
+
473
595
#### Configurable Token Lifetime
474
596
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.
475
597
@@ -704,6 +826,64 @@ specified below. It must output the response to stdout.
704
826
Refer to the [using executable-sourced credentials with Workload Identity Federation](#using-executable-sourced-credentials-with-oidc-and-saml)
705
827
above for the executable response specification.
706
828
829
+
#### Using a custom supplier with OIDC and SAML
830
+
A custom implementation of IdentityPoolSubjectTokenSupplier can be used while building IdentityPoolCredentials
831
+
to supply a subject token which can be exchanged for a GCP access token. The supplier must return a valid,
832
+
unexpired subject token when called by the GCP credential.
833
+
834
+
IdentityPoolCredentials do not cache the returned token, so caching logic should be
835
+
implemented in the token supplier to prevent multiple requests for the same subject token.
Where the following variables need to be substituted:
879
+
-`$WORKFORCE_POOL_ID`: The workforce pool ID.
880
+
-`$PROVIDER_ID`: The provider ID.
881
+
882
+
and the workforce pool user project is the project number associated with the [workforce pools user project](https://cloud.google.com/iam/docs/workforce-identity-federation#workforce-pools-user-project).
883
+
884
+
The values for audience, service account impersonation URL, and any other builder field can also be found by
885
+
generating a [credential configuration file with the gcloud CLI](https://cloud.google.com/iam/docs/workforce-obtaining-short-lived-credentials#use_configuration_files_for_sign-in).
886
+
707
887
##### Security considerations
708
888
The following security practices are highly recommended:
709
889
* Access to the script should be restricted as it will be displaying credentials to stdout. This ensures that rogue processes do not gain access to the script.
0 commit comments