-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impersonated credentials should implement IdTokenProvider
interface
#1318
Comments
@salrashid123 do you have a testing project where you're experimenting with this functionality, I'd be happy to help add this functionality, but it would be nice to have a real world environment to test against. |
certaiinly. i've added your corp user cred access to impersonate the service account below so you could directly impersonate an SA and get its export ID_TOKEN=`gcloud auth print-identity-token --audiences="https://myapp-jyosxg6puq-uc.a.run.app" --impersonate-service-account=target-serviceaccount@fabled-ray-104117.iam.gserviceaccount.com --format="value(id_token)"`
curl -v -H "Authorization: Bearer $ID_TOKEN" https://myapp-jyosxg6puq-uc.a.run.app/ the curl command uses that id token to access a Cloud Run instance which will only allow that svc account's idtoken through. If you would rather,i can grant project access or create a test user within the cloud org i own. LMK |
@bcoe I'll make an effort to prod at this next week during the slow week, feel free to message me if you feel like wokring on this patch together. |
@bcoe This is a blocker for us, is there an update? |
Hey @m0ar, @salrashid123, & @FrodoTheTrue: found some time to work on this today. Here's the PR: It should be merged shortly after review 👌🏽 |
Currently there is no easy way to acquire an
id_token
for a service account that was impersonated.For example, if you run an application as SA1 but you would like to get an
id_token
for SA2, you would have to first useImpersonated
module to get a rawaccess_token
for SA2 and then use that in iamcredentials.generateIdToken() api call manually.in another example, if you run running workload identity federation (WIF) in AWS and need an
id_token
to access Cloud Run, you would need to acquire theaccess_token
for the service account for WIF on aws and then use that samegenerateIDToken()
api call.This FR is to allow the
Impersonated
module to acquire its ownid_token
the workaround i tried was to edit the following
then the usage would be
Finally, please note the following:
ref:
fetchIdToken
fails with a 400 error when using theCompute
client on GKE with Workload Identity #1305(The last issue describes the limits of using the impersonated module with google cloud client libraries)
The text was updated successfully, but these errors were encountered: