Skip to content

Conversation

@vverman
Copy link
Contributor

@vverman vverman commented Oct 27, 2025

Added logic and unit tests for trust boundary for external accounts. This PR covers

  1. Workload authentication.
  2. Workforce authentication. (headful and headless)
  3. Service account impersonation for workloads and workforces.

This PR is a followup of the initial PR for Trust Boundaries for Service accounts.

… and header value.

# Conflicts:
#	oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java
#	oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
#	oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java

# Conflicts:
#	oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java
#	oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
#	oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java
#	oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java
#	oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java
#	oauth2_http/java/com/google/auth/oauth2/TrustBoundary.java
…ents regarding a separate mock for trust boundary.
@vverman vverman requested review from a team as code owners October 27, 2025 18:13
@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Oct 27, 2025
@vverman vverman force-pushed the feat/trust-boundary-external-account branch from fb18c0c to 458bad4 Compare October 27, 2025 23:24
@vverman vverman self-assigned this Oct 29, 2025
@vverman vverman requested review from lqiu96 and nbayati October 29, 2025 17:57
@vverman vverman added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 29, 2025
@vverman vverman requested a review from nbayati October 30, 2025 22:11
@vverman vverman requested a review from lqiu96 October 31, 2025 21:21
@lqiu96
Copy link
Member

lqiu96 commented Nov 3, 2025

I think things generally LGTM. I will do a second pass for the tests below.

AccessToken accessToken = this.impersonatedCredentials.refreshAccessToken();
// After the impersonated credential refreshes, its trust boundary is
// also refreshed. That is the trust boundary we will use.
// We use the impersonated account's credential as the trust boundary
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think the previous comment was more clear.

Copy link
Contributor

@nbayati nbayati left a comment

Choose a reason for hiding this comment

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

LGTM. Great job! :)

@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Nov 4, 2025
@vverman vverman force-pushed the feat/trust-boundary-external-account branch from 01eb20d to 2071071 Compare November 4, 2025 06:31
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Nov 4, 2025
@vverman vverman requested a review from lqiu96 November 4, 2025 19:00
Comment on lines +342 to +344
protected void setTrustBoundary(TrustBoundary trustBoundary) {
this.trustBoundary = trustBoundary;
}
Copy link
Member

Choose a reason for hiding this comment

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

is this still needed?

.setSubjectTokenType("subjectTokenType")
.build();

awsCredential.refreshAccessToken();
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think most of the other test classes use .refresh()

Comment on lines +650 to +652
throw new IllegalStateException(
"The provided audience is not in a valid format for either a workload identity pool or a workforce pool.");
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: If possible, is there an official doc that we can link to with the format for workload pool and workforce pool?

Comment on lines +232 to +233
throw new IllegalStateException(
"The provided audience is not in the correct format for a workforce pool.");
Copy link
Member

Choose a reason for hiding this comment

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

nit: If possible, can we link to a public offical doc that has the format for workforce pool?

Copy link
Member

@lqiu96 lqiu96 left a comment

Choose a reason for hiding this comment

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

LGTM. I added a few nits that may need additional code changes (feel free to resolve if it's not possible). I can re-approve afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants