-
Notifications
You must be signed in to change notification settings - Fork 458
feat(Migrate Auth TPC): Add auth option while creating HTTP/gRPC client #3570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @Tulsishah, 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 introduces a new, opt-in authentication mechanism for both HTTP and gRPC clients within the storage layer. By adding an EnableGoogleLibAuth
flag, the system can now leverage Google's client library authentication flow, providing an alternative and potentially more robust way to handle credentials. The changes involve updating configuration structures, modifying client creation logic to conditionally apply this new flow, and adapting the HTTP client creation function to support pre-provided token sources.
Highlights
- New Authentication Flag: I've introduced an
EnableGoogleLibAuth
boolean flag to theStorageClientConfig
struct. This flag allows users to opt into a new authentication mechanism, likely leveraging Google's official client libraries for credential handling. - Conditional Client Authentication Logic: I've updated the client creation functions (
createClientOptionForGRPCClient
andcreateHTTPClientHandle
) to conditionally apply authentication options. IfEnableGoogleLibAuth
is true, the system now usesstorageutil.GetClientAuthOptionsAndToken
to retrieve and apply authentication credentials; otherwise, it falls back to the existingCreateTokenSource
method. - Flexible HTTP Client Creation: The
CreateHttpClient
function instorageutil
has been modified to accept an optionaloauth2.TokenSource
parameter. This allows the caller (specifically, the new authentication flow for HTTP clients) to provide a pre-obtained token source, enhancing flexibility in how authentication tokens are managed and applied. - Test Adaptations: Existing unit tests for
CreateHttpClient
were updated to passnil
for the newly addedtokenSrc
parameter. This ensures that the tests continue to function correctly with the updated function signature without altering their original behavior.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 or fill out our survey to provide feedback.
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
-
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. ↩
There was a problem hiding this 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 introduces a new authentication path using the EnableGoogleLibAuth
flag for creating HTTP and gRPC clients. I have suggested making error messages more descriptive to aid in debugging and adding comments to clarify the logic.
4abe8d5
to
4c71841
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3570 +/- ##
==========================================
- Coverage 79.63% 79.59% -0.05%
==========================================
Files 144 144
Lines 19143 19158 +15
==========================================
+ Hits 15244 15248 +4
- Misses 3375 3385 +10
- Partials 524 525 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a9b9153
to
a72f2b3
Compare
a72f2b3
to
8ee312f
Compare
Description
Link to the issue in case of a bug fix.
Testing details
Any backward incompatible change? If so, please explain.