V3 decommission storage oauth2#15879
V3 decommission storage oauth2#15879scotthart wants to merge 20 commits intogoogleapis:prepare-for-v3.0.0from
Conversation
Summary of ChangesHello @scotthart, 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 initiates the decommissioning of the Highlights
🧠 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. Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request decommissions the v2 storage OAuth2 implementation, which is a significant and important refactoring. The changes generally look correct, moving towards a unified credentials implementation. However, there are numerous debugging std::cout statements and a large amount of commented-out code that should be removed before merging. Additionally, many files are disabled using #if 0, which is a temporary measure; these files should be deleted to keep the codebase clean.
|
|
||
| StatusOr<std::pair<std::string, std::string>> Credentials::AuthenticationHeader( | ||
| std::chrono::system_clock::time_point tp) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; |
| auto impl = | ||
| std::make_unique<CurlImpl>(std::move(handle), handle_factory_, options); | ||
| if (credentials_) { | ||
| std::cout << __PRETTY_FUNCTION__ << ": has credentials_" << std::endl; |
| google::cloud::AccessToken access_token) | ||
| : access_token_(std::move(access_token)) {} | ||
| : access_token_(std::move(access_token)) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; |
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
| } | ||
|
|
||
| StatusOr<AccessToken> AuthorizedUserCredentials::GetToken( | ||
| std::chrono::system_clock::time_point tp) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; |
| StatusOr<AccessToken> CachedCredentials::GetToken( | ||
| std::chrono::system_clock::time_point now) { | ||
| std::lock_guard<std::mutex> lk(mu_); | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; |
| #if 0 | ||
| auto credentials = std::make_shared<oauth2_internal::AnonymousCredentials>(); | ||
| if (!UsingEmulator()) { | ||
| auto c = oauth2::GoogleDefaultCredentials(); | ||
| ASSERT_THAT(c, IsOk()); | ||
| credentials = *std::move(c); | ||
| } | ||
| #endif |
| // auto credentials = | ||
| // oauth2::CreateServiceAccountCredentialsFromFilePath(key_filename_); | ||
| auto is = std::ifstream(key_filename_); | ||
| // is.exceptions(std::ios::badbit); // Minimal error handling in examples | ||
| auto contents = std::string(std::istreambuf_iterator<char>(is.rdbuf()), {}); | ||
|
|
||
| auto credentials = MakeServiceAccountCredentials(contents); | ||
| // ASSERT_STATUS_OK(credentials); |
| // auto credentials = | ||
| // oauth2::CreateServiceAccountCredentialsFromFilePath(key_filename_); | ||
| // ASSERT_STATUS_OK(credentials); | ||
|
|
||
| auto is = std::ifstream(key_filename_); | ||
| // is.exceptions(std::ios::badbit); // Minimal error handling in examples | ||
| auto contents = std::string(std::istreambuf_iterator<char>(is.rdbuf()), {}); | ||
|
|
||
| auto credentials = MakeServiceAccountCredentials(contents); | ||
| // ASSERT_STATUS_OK(credentials); |
| // auto creds = oauth2::CreateServiceAccountCredentialsFromJsonFilePath( | ||
| // service_account_key_filename_); | ||
| // ASSERT_STATUS_OK(creds); | ||
|
|
||
| std::string account_email = (*creds)->AccountEmail(); | ||
| auto is = std::ifstream(service_account_key_filename_); | ||
| // is.exceptions(std::ios::badbit); // Minimal error handling in examples | ||
| auto contents = std::string(std::istreambuf_iterator<char>(is.rdbuf()), {}); | ||
| auto creds = MakeServiceAccountCredentials(contents); | ||
| auto sa_creds = rest_internal::MapCredentials(*creds); | ||
|
|
||
| // std::string account_email = (*creds)->AccountEmail(); | ||
| std::string account_email = sa_creds->AccountEmail(); | ||
|
|
||
| // auto client = | ||
| // MakeIntegrationTestClient(Options{}.set<Oauth2CredentialsOption>(*creds)); |
| // auto creds = oauth2::CreateServiceAccountCredentialsFromJsonFilePath( | ||
| // service_account_key_filename_); | ||
| // ASSERT_STATUS_OK(creds); | ||
|
|
||
| auto is = std::ifstream(service_account_key_filename_); | ||
| // is.exceptions(std::ios::badbit); // Minimal error handling in examples | ||
| auto contents = std::string(std::istreambuf_iterator<char>(is.rdbuf()), {}); | ||
| auto creds = MakeServiceAccountCredentials(contents); | ||
| auto sa_creds = rest_internal::MapCredentials(*creds); | ||
|
|
||
| // std::string account_email = (*creds)->AccountEmail(); | ||
| std::string account_email = sa_creds->AccountEmail(); |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## prepare-for-v3.0.0 #15879 +/- ##
======================================================
- Coverage 92.87% 92.83% -0.04%
======================================================
Files 2391 2359 -32
Lines 218434 216614 -1820
======================================================
- Hits 202866 201097 -1769
+ Misses 15568 15517 -51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.