feat(oauth2): support non-mTLS token URLs and unbound actor tokens in IdentityPoolCredentials - #14430
Open
macastelaz wants to merge 3 commits into
Open
macastelaz wants to merge 3 commits into
macastelaz wants to merge 3 commits into
Conversation
… IdentityPoolCredentials
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the restriction requiring mTLS endpoints and transport configuration for actor token exchanges in IdentityPoolCredentials. Validation checks enforcing mTLS are removed, and unit tests are updated to verify that configuring actor tokens without mTLS now succeeds. Feedback is provided regarding a cross-platform issue in a new test where unescaped backslashes in a file path can cause JSON parsing failures on Windows.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allows
actor_tokenandactor_token_typeto be used inIdentityPoolCredentialswith standard (non-mTLS) STS and IAM impersonation endpoints and without requiring client certificate (certificate_config) configuration.Context & Rationale
In #13955, client-side guardrails (
isMtlsConfigured()andvalidateMtlsEndpoint()) were enforced in theIdentityPoolCredentialsconstructor because Google STS initially required actor tokens to be paired with certificate-bound tokens over mTLS. Per the original design discussion, this was intentionally designed as a one-way door that could be loosened in a non-breaking manner once backend support for non-mTLS actor token exchanges was ready.Changes
isMtlsConfigured()check inIdentityPoolCredentials(Builder)so actor tokens can be configured with standardHttpTransportFactoryinstances and without acertificateblock.validateMtlsEndpoint()checks ontokenUrlandserviceAccountImpersonationUrl, allowing standard public endpoints (e.g.,https://sts.googleapis.com/v1/token) to be used with actor tokens.actorTokenSupplierandactorTokenType, as well as JSON format checks for file-based actor token extraction.x509Provider == null(non-mTLS credentials),refreshAccessToken()uses standard transport without snapshotting aKeyStore, and401 Unauthorizederrors propagate immediately without retry.x509Provider != null && transportFactory instanceof MtlsHttpTransportFactory(mTLS credentials), per-cycle certificate pinning and single-retry cert reload on401remain unchanged.IdentityPoolCredentials.*_succeeds).refreshAccessToken_401WithActorTokenAndNonMtlsTransport_bubblesUpWithoutRetryandfromStream_fileCredentialSource_withoutCertificateConfig_andActorToken_withNonMtlsUrl_refreshesSuccessfullyto verify end-to-end non-mTLS actor token exchanges.Verification
oauth2_httpmodule (including all 88 tests inIdentityPoolCredentialsTest).fmt-maven-plugin:2.25:check.