-
Notifications
You must be signed in to change notification settings - Fork 438
V3 decommission storage oauth2 #15879
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: prepare-for-v3.0.0
Are you sure you want to change the base?
Changes from all commits
4d9d8b6
255a0eb
019ff02
04b148c
67526a7
4758d61
d47caf8
363fefb
375b6e7
a41639b
432e6b7
9f19453
efe8f00
83401ec
cb58555
6219e17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,10 @@ CurlRestClient::CurlRestClient(std::string endpoint_address, | |
| : endpoint_address_(std::move(endpoint_address)), | ||
| handle_factory_(std::move(factory)), | ||
| options_(std::move(options)) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
| if (options_.has<UnifiedCredentialsOption>()) { | ||
| std::cout << __PRETTY_FUNCTION__ << ": has UnifiedCredentialsOption" | ||
| << std::endl; | ||
| credentials_ = MapCredentials(*options_.get<UnifiedCredentialsOption>()); | ||
| } | ||
| } | ||
|
|
@@ -124,6 +127,7 @@ StatusOr<std::unique_ptr<CurlImpl>> CurlRestClient::CreateCurlImpl( | |
| auto impl = | ||
| std::make_unique<CurlImpl>(std::move(handle), handle_factory_, options); | ||
| if (credentials_) { | ||
| std::cout << __PRETTY_FUNCTION__ << ": has credentials_" << std::endl; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| auto auth_header = | ||
| credentials_->AuthenticationHeader(std::chrono::system_clock::now()); | ||
| if (!auth_header.ok()) return std::move(auth_header).status(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,9 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN | |
|
|
||
| AccessTokenCredentials::AccessTokenCredentials( | ||
| google::cloud::AccessToken access_token) | ||
| : access_token_(std::move(access_token)) {} | ||
| : access_token_(std::move(access_token)) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| StatusOr<AccessToken> AccessTokenCredentials::GetToken( | ||
| std::chrono::system_clock::time_point /*tp*/) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,10 +92,13 @@ AuthorizedUserCredentials::AuthorizedUserCredentials( | |
| HttpClientFactory client_factory) | ||
| : info_(std::move(info)), | ||
| options_(std::move(options)), | ||
| client_factory_(std::move(client_factory)) {} | ||
| client_factory_(std::move(client_factory)) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
| } | ||
|
|
||
| StatusOr<AccessToken> AuthorizedUserCredentials::GetToken( | ||
| std::chrono::system_clock::time_point tp) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
Comment on lines
+96
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| rest_internal::RestRequest request; | ||
| request.SetPath(info_.token_uri); | ||
| request.AddHeader("content-type", "application/x-www-form-urlencoded"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ CachedCredentials::~CachedCredentials() = default; | |
| StatusOr<AccessToken> CachedCredentials::GetToken( | ||
| std::chrono::system_clock::time_point now) { | ||
| std::lock_guard<std::mutex> lk(mu_); | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (!ExpiringSoon(token_, now)) return token_; | ||
| auto refreshed = impl_->GetToken(now); | ||
| if (!refreshed) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,7 +194,9 @@ ComputeEngineCredentials::ComputeEngineCredentials( | |
| HttpClientFactory client_factory) | ||
| : options_(std::move(options)), | ||
| client_factory_(std::move(client_factory)), | ||
| service_account_email_(std::move(service_account_email)) {} | ||
| service_account_email_(std::move(service_account_email)) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| StatusOr<AccessToken> ComputeEngineCredentials::GetToken( | ||
| std::chrono::system_clock::time_point tp) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ StatusOr<std::string> Credentials::project_id( | |
|
|
||
| StatusOr<std::pair<std::string, std::string>> Credentials::AuthenticationHeader( | ||
| std::chrono::system_clock::time_point tp) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| auto token = GetToken(tp); | ||
| if (!token) return std::move(token).status(); | ||
| if (token->token.empty()) return std::make_pair(std::string{}, std::string{}); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ LoggingCredentials::~LoggingCredentials() = default; | |
|
|
||
| StatusOr<AccessToken> LoggingCredentials::GetToken( | ||
| std::chrono::system_clock::time_point now) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| auto token = impl_->GetToken(now); | ||
| if (!token) { | ||
| GCP_LOG(DEBUG) << __func__ << "(" << phase_ << ") failed " | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,17 +248,21 @@ ServiceAccountCredentials::ServiceAccountCredentials( | |
| std::move(options), | ||
| Options{}.set<ServiceAccountCredentialsTokenUriOption>( | ||
| info_.token_uri))), | ||
| client_factory_(std::move(client_factory)) {} | ||
| client_factory_(std::move(client_factory)) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
| } | ||
|
|
||
| StatusOr<AccessToken> ServiceAccountCredentials::GetToken( | ||
| std::chrono::system_clock::time_point tp) { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
|
Comment on lines
+252
to
+257
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (UseOAuth()) return GetTokenOAuth(tp); | ||
| return GetTokenSelfSigned(tp); | ||
| } | ||
|
|
||
| StatusOr<std::vector<std::uint8_t>> ServiceAccountCredentials::SignBlob( | ||
| absl::optional<std::string> const& signing_account, | ||
| std::string const& blob) const { | ||
| std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
| if (signing_account.has_value() && | ||
| signing_account.value() != info_.client_email) { | ||
| return internal::InvalidArgumentError( | ||
|
|
||
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.
These
std::coutstatements appear to be for debugging and should be removed before merging.