Repository navigation
Conversation
…_authorized_channel
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for self-signed JWTs (AIP-4111) in both asynchronous sessions and secure gRPC channels by adding a default_host parameter. In AsyncAuthorizedSession, the default_host is used to configure self-signed JWTs for service account credentials after constructor validation. Similarly, in secure_authorized_channel, the default_host is forwarded to AuthMetadataPlugin to enable minting self-signed JWTs with the intended audience. Corresponding unit tests have been added to verify these behaviors and ensure that failed initialization does not mutate credentials. There are no review comments, and I have no additional feedback to provide.
This branch has not been deployed
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.
Add optional
default_hostparameter support toAsyncAuthorizedSessionandgrpc.secure_authorized_channel, matchingrequests.AuthorizedSession,urllib3.AuthorizedHttp, andgrpc.AuthMetadataPluginfor AIP-4111 self-signed JWT initialization:google.auth.aio.transport.sessions.AsyncAuthorizedSession:default_host: Optional[str] = Nonein__init__.service_account.Credentialsvia_create_self_signed_jwt("https://{}/".format(default_host))(orNonewhen unset), after validating constructor arguments so a failed__init__does not mutate caller credentials.google.auth.transport.grpc.secure_authorized_channel:default_host=Noneand forward it toAuthMetadataPlugin(credentials, request, default_host=default_host)without passing it through**kwargstogrpc.secure_channel.default_hostforwarding, omitteddefault_host, and non-mutation on constructor failure.