Conversation
…mail in PluggableAuthCredentials
There was a problem hiding this comment.
Code Review
This pull request updates ExternalAccountCredentials and PluggableAuthCredentials to properly handle and preserve the impersonated service account email when cloning or creating scoped credentials. It introduces a lazy initializer getImpersonatedCredentials() in ExternalAccountCredentials, adds the impersonatedServiceAccountEmail field and builder methods to PluggableAuthCredentials, and overrides getServiceAccountEmail() to fall back to this email. Additionally, corresponding unit tests have been updated and added to verify that the impersonated email is correctly set in the environment and preserved during scoping. There are no review comments to address, and I have no additional feedback to provide.
…uthCredentials.Builder constructor
…ildImpersonatedCredentials directly
…rsonationUrl() != null
…ableAuthCredentials constructor
Summary
Fixes two issues in
PluggableAuthCredentialswhen service account impersonation is configured:refreshAccessToken()now checksgetServiceAccountImpersonationUrl() != nulland delegates directly toimpersonatedCredentials.refreshAccessToken(), instead of running the executable a first time on the outer credential and discarding the token.PluggableAuthCredentials.Builder(PluggableAuthCredentials)capturesgetServiceAccountEmail()beforebuildImpersonatedCredentials()clearsserviceAccountImpersonationUrlonsourceCredentials, soGOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAILis still passed to the executable.Testing
PluggableAuthCredentialsTestandExternalAccountCredentialsTest