Skip to content

[googleapis_auth] Support impersonated_service_account in ADC#721

Open
kevmoo wants to merge 1 commit intomasterfrom
feature_ADC
Open

[googleapis_auth] Support impersonated_service_account in ADC#721
kevmoo wants to merge 1 commit intomasterfrom
feature_ADC

Conversation

@kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented Feb 19, 2026

Features:

  • Add support for impersonated_service_account type in Application Default Credentials (ADC).

Tests:

  • Add adc_impersonation_test.dart to verify full impersonation flow.

@gemini-code-assist
Copy link

Summary of Changes

Hello @kevmoo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the googleapis_auth package by introducing support for impersonated service accounts within Application Default Credentials (ADC), allowing for more flexible and secure authentication flows. It also improves resource management by ensuring that the quota_project_id is properly propagated for service account credentials. Additionally, a fix was applied to a configuration script to handle varying input formats, improving its reliability.

Highlights

  • ADC Impersonated Service Account Support: Application Default Credentials (ADC) now supports impersonated_service_account source files, allowing clients to obtain credentials for impersonating a service account.
  • Quota Project Propagation: ADC now correctly propagates the quota_project_id for Service Account credentials, ensuring that the X-Goog-User-Project header is set for requests.
  • Config Script Fix: The config_delta script has been updated to correctly parse configuration files where the 'packages' key can be either a list or a map, improving its robustness.
  • Refactored Client Initialization: The ImpersonatedAuthClient and clientViaServiceAccountImpersonation functions now accept an optional baseClient, providing more flexibility for transport handling.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • googleapis_auth/CHANGELOG.md
    • ImpersonatedAuthClient and clientViaServiceAccountImpersonation accept an optional baseClient to likely use for the transport handling.
    • Application Default Credentials (ADC) now supports impersonated_service_account source files.
    • Application Default Credentials (ADC) now propagate quota_project_id for Service Account credentials.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kevmoo kevmoo changed the base branch from master to fix_delta_script February 19, 2026 19:55
@kevmoo kevmoo changed the title feature ADC [googleapis_auth] Support impersonated_service_account in ADC and refactor _FlowClient Feb 19, 2026
@kevmoo kevmoo requested a review from demolaf February 19, 2026 19:56
@github-actions
Copy link

github-actions bot commented Feb 19, 2026

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
googleapis_auth Non-Breaking 2.1.0 2.2.0-wip 2.2.0-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

Unused Dependencies ✔️
Package Status
googleapis_auth ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

License Headers ✔️
//
Files
no missing headers

All source files should start with a license header.

This check can be disabled by tagging the PR with skip-license-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for impersonated_service_account in Application Default Credentials (ADC) and propagates quota_project_id for service account credentials. The changes include refactoring to handle different credential types, updating various clients and functions to support quota_project and baseClient parameters, and adding corresponding tests. The code changes are well-structured and include appropriate tests. My review includes one suggestion to improve security by using a more specific OAuth scope.

Base automatically changed from fix_delta_script to master February 19, 2026 20:05
@demolaf
Copy link
Collaborator

demolaf commented Feb 20, 2026

Question, with these changes does the clientViaApplicationDefaultCredentials always act as one or the other? one or the other meaning source service account and target service account, if yes then that might not be the intended use of ImpersonatedAuthClient.

At least what I understand is, you should be able to create two different clients one clientViaApplicationDefaultCredentials and the other clientViaServiceAccountImpersonation and use both but now if credentials type impersonated_service_account the sign() method would always act as impersonated/target SA not source SA.

@kevmoo kevmoo marked this pull request as ready for review February 28, 2026 01:45
@kevmoo kevmoo changed the title [googleapis_auth] Support impersonated_service_account in ADC and refactor _FlowClient [googleapis_auth] Support impersonated_service_account in ADC Feb 28, 2026
@kevmoo
Copy link
Collaborator Author

kevmoo commented Feb 28, 2026

After a bunch of cleanup, all this does is wire through ADC on top of https://github.com/google/googleapis.dart/pull/711/changes

Are you saying the ADC should NOT always use the impersonation route if that's the credentials that are discovered?

…actor _FlowClient

Features:
- Add support for `impersonated_service_account` type in Application Default Credentials (ADC).
- Propagate `quota_project_id` for Service Account credentials in ADC.
- Add `ImpersonatedAuthClient` and `clientViaServiceAccountImpersonation` which accept an optional baseClient.

Tests:
- Add `adc_impersonation_test.dart` to verify full impersonation flow.
@kevmoo kevmoo force-pushed the feature_ADC branch 3 times, most recently from 0ebe0d4 to cdf5229 Compare February 28, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants