google-auth-library-php icon indicating copy to clipboard operation
google-auth-library-php copied to clipboard

feat: Get id token for impersonated service account

Open gjvanahee opened this issue 1 year ago • 1 comments

Hello, thanks for a maintaining a great sdk. In order to autenticate impersonated service accounts with e.g. a Cloud Run service, the ISAC IdToken has to be fetched for a given target audience.

I have made this PR to allow this using the ImpersonatedServiceAccountCredentials class, so the AuthTokenMiddleware can use it to add the ISAC IdToken to a request. The change also allows ApplicationDefaultCredentials::getIdTokenMiddleware() and getIdTokenCredentials() to find ImpersonatedServiceAccountCredentials.

gjvanahee avatar Sep 20 '24 10:09 gjvanahee

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Sep 20 '24 10:09 google-cla[bot]

Hi @gjvanahee ! This looks great, thank you for contributing this.

Coincidentally, I was just working on this in https://github.com/googleapis/google-auth-library-php/pull/580! We will get this merged soon, and then merge your additions as well.

bshaffer avatar Oct 01 '24 21:10 bshaffer

Hey @bshaffer, That is great to hear! Let me know if I can help out.

gjvanahee avatar Oct 02 '24 07:10 gjvanahee

@gjvanahee If you'd like to help, you could use test https://github.com/googleapis/google-auth-library-php/pull/580 in your own use-case. I would love to have you review it!

composer require google/auth:dev-add-impersonated-service-account-credentials

I'll use the tests you've written in this PR as well to make sure it works the same.

Thanks again

bshaffer avatar Oct 04 '24 19:10 bshaffer

Closing this PR as it should be completely implemented by https://github.com/googleapis/google-auth-library-php/pull/580

bshaffer avatar Oct 05 '24 18:10 bshaffer