external_account_credentials.cc
Go to the documentation of this file.
1 //
2 // Copyright 2020 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
18 
20 
21 #include <string.h>
22 
23 #include <algorithm>
24 #include <map>
25 #include <memory>
26 #include <utility>
27 
28 #include "absl/status/status.h"
29 #include "absl/status/statusor.h"
30 #include "absl/strings/match.h"
31 #include "absl/strings/str_format.h"
32 #include "absl/strings/str_join.h"
33 #include "absl/strings/str_split.h"
34 #include "absl/strings/strip.h"
35 #include "absl/time/clock.h"
36 #include "absl/time/time.h"
37 
38 #include <grpc/grpc.h>
39 #include <grpc/grpc_security.h>
40 #include <grpc/support/alloc.h>
41 #include <grpc/support/log.h>
43 
51 #include "src/core/lib/slice/b64.h"
53 
54 #define EXTERNAL_ACCOUNT_CREDENTIALS_GRANT_TYPE \
55  "urn:ietf:params:oauth:grant-type:token-exchange"
56 #define EXTERNAL_ACCOUNT_CREDENTIALS_REQUESTED_TOKEN_TYPE \
57  "urn:ietf:params:oauth:token-type:access_token"
58 #define GOOGLE_CLOUD_PLATFORM_DEFAULT_SCOPE \
59  "https://www.googleapis.com/auth/cloud-platform"
60 
61 namespace grpc_core {
62 
63 namespace {
64 
65 std::string UrlEncode(const absl::string_view& s) {
66  const char* hex = "0123456789ABCDEF";
68  result.reserve(s.length());
69  for (auto c : s) {
70  if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') ||
71  (c >= 'a' && c <= 'z') || c == '-' || c == '_' || c == '!' ||
72  c == '\'' || c == '(' || c == ')' || c == '*' || c == '~' || c == '.') {
73  result.push_back(c);
74  } else {
75  result.push_back('%');
76  result.push_back(hex[static_cast<unsigned char>(c) >> 4]);
77  result.push_back(hex[static_cast<unsigned char>(c) & 15]);
78  }
79  }
80  return result;
81 }
82 
83 // Expression to match:
84 // //iam.googleapis.com/locations/[^/]+/workforcePools/[^/]+/providers/.+
85 bool MatchWorkforcePoolAudience(absl::string_view audience) {
86  // Match "//iam.googleapis.com/locations/"
87  if (!absl::ConsumePrefix(&audience, "//iam.googleapis.com")) return false;
88  if (!absl::ConsumePrefix(&audience, "/locations/")) return false;
89  // Match "[^/]+/workforcePools/"
90  std::pair<absl::string_view, absl::string_view> workforce_pools_split_result =
91  absl::StrSplit(audience, absl::MaxSplits("/workforcePools/", 1));
92  if (absl::StrContains(workforce_pools_split_result.first, '/')) return false;
93  // Match "[^/]+/providers/.+"
94  std::pair<absl::string_view, absl::string_view> providers_split_result =
95  absl::StrSplit(workforce_pools_split_result.second,
96  absl::MaxSplits("/providers/", 1));
97  return !absl::StrContains(providers_split_result.first, '/');
98 }
99 
100 } // namespace
101 
103  const Json& json, std::vector<std::string> scopes,
108  if (json.type() != Json::Type::OBJECT) {
110  "Invalid json to construct credentials options.");
111  return nullptr;
112  }
113  auto it = json.object_value().find("type");
114  if (it == json.object_value().end()) {
115  *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("type field not present.");
116  return nullptr;
117  }
118  if (it->second.type() != Json::Type::STRING) {
119  *error =
120  GRPC_ERROR_CREATE_FROM_STATIC_STRING("type field must be a string.");
121  return nullptr;
122  }
123  if (it->second.string_value() != GRPC_AUTH_JSON_TYPE_EXTERNAL_ACCOUNT) {
124  *error =
125  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid credentials json type.");
126  return nullptr;
127  }
129  it = json.object_value().find("audience");
130  if (it == json.object_value().end()) {
131  *error =
132  GRPC_ERROR_CREATE_FROM_STATIC_STRING("audience field not present.");
133  return nullptr;
134  }
135  if (it->second.type() != Json::Type::STRING) {
137  "audience field must be a string.");
138  return nullptr;
139  }
140  options.audience = it->second.string_value();
141  it = json.object_value().find("subject_token_type");
142  if (it == json.object_value().end()) {
144  "subject_token_type field not present.");
145  return nullptr;
146  }
147  if (it->second.type() != Json::Type::STRING) {
149  "subject_token_type field must be a string.");
150  return nullptr;
151  }
152  options.subject_token_type = it->second.string_value();
153  it = json.object_value().find("service_account_impersonation_url");
154  if (it != json.object_value().end()) {
155  options.service_account_impersonation_url = it->second.string_value();
156  }
157  it = json.object_value().find("token_url");
158  if (it == json.object_value().end()) {
159  *error =
160  GRPC_ERROR_CREATE_FROM_STATIC_STRING("token_url field not present.");
161  return nullptr;
162  }
163  if (it->second.type() != Json::Type::STRING) {
165  "token_url field must be a string.");
166  return nullptr;
167  }
168  options.token_url = it->second.string_value();
169  it = json.object_value().find("token_info_url");
170  if (it != json.object_value().end()) {
171  options.token_info_url = it->second.string_value();
172  }
173  it = json.object_value().find("credential_source");
174  if (it == json.object_value().end()) {
176  "credential_source field not present.");
177  return nullptr;
178  }
179  options.credential_source = it->second;
180  it = json.object_value().find("quota_project_id");
181  if (it != json.object_value().end()) {
182  options.quota_project_id = it->second.string_value();
183  }
184  it = json.object_value().find("client_id");
185  if (it != json.object_value().end()) {
186  options.client_id = it->second.string_value();
187  }
188  it = json.object_value().find("client_secret");
189  if (it != json.object_value().end()) {
190  options.client_secret = it->second.string_value();
191  }
192  it = json.object_value().find("workforce_pool_user_project");
193  if (it != json.object_value().end()) {
194  if (MatchWorkforcePoolAudience(options.audience)) {
195  options.workforce_pool_user_project = it->second.string_value();
196  } else {
198  "workforce_pool_user_project should not be set for non-workforce "
199  "pool credentials");
200  return nullptr;
201  }
202  }
204  if (options.credential_source.object_value().find("environment_id") !=
205  options.credential_source.object_value().end()) {
206  creds = MakeRefCounted<AwsExternalAccountCredentials>(
207  std::move(options), std::move(scopes), error);
208  } else if (options.credential_source.object_value().find("file") !=
209  options.credential_source.object_value().end()) {
210  creds = MakeRefCounted<FileExternalAccountCredentials>(
211  std::move(options), std::move(scopes), error);
212  } else if (options.credential_source.object_value().find("url") !=
213  options.credential_source.object_value().end()) {
214  creds = MakeRefCounted<UrlExternalAccountCredentials>(
215  std::move(options), std::move(scopes), error);
216  } else {
218  "Invalid options credential source to create "
219  "ExternalAccountCredentials.");
220  }
221  if (GRPC_ERROR_IS_NONE(*error)) {
222  return creds;
223  } else {
224  return nullptr;
225  }
226 }
227 
229  Options options, std::vector<std::string> scopes)
230  : options_(std::move(options)) {
231  if (scopes.empty()) {
232  scopes.push_back(GOOGLE_CLOUD_PLATFORM_DEFAULT_SCOPE);
233  }
234  scopes_ = std::move(scopes);
235 }
236 
238 
240  return absl::StrFormat("ExternalAccountCredentials{Audience:%s,%s}",
243 }
244 
245 // The token fetching flow:
246 // 1. Retrieve subject token - Subclass's RetrieveSubjectToken() gets called
247 // and the subject token is received in OnRetrieveSubjectTokenInternal().
248 // 2. Exchange token - ExchangeToken() gets called with the
249 // subject token from #1. Receive the response in OnExchangeTokenInternal().
250 // 3. (Optional) Impersonate service account - ImpersenateServiceAccount() gets
251 // called with the access token of the response from #2. Get an impersonated
252 // access token in OnImpersenateServiceAccountInternal().
253 // 4. Finish token fetch - Return back the response that contains an access
254 // token in FinishTokenFetch().
255 // TODO(chuanr): Avoid starting the remaining requests if the channel gets shut
256 // down.
258  grpc_credentials_metadata_request* metadata_req,
259  grpc_polling_entity* pollent, grpc_iomgr_cb_func response_cb,
260  Timestamp deadline) {
261  GPR_ASSERT(ctx_ == nullptr);
262  ctx_ = new HTTPRequestContext(pollent, deadline);
263  metadata_req_ = metadata_req;
264  response_cb_ = response_cb;
265  auto cb = [this](std::string token, grpc_error_handle error) {
267  };
269 }
270 
272  absl::string_view subject_token, grpc_error_handle error) {
273  if (!GRPC_ERROR_IS_NONE(error)) {
275  } else {
276  ExchangeToken(subject_token);
277  }
278 }
279 
281  absl::string_view subject_token) {
283  if (!uri.ok()) {
285  absl::StrFormat("Invalid token url: %s. Error: %s", options_.token_url,
286  uri.status().ToString())));
287  return;
288  }
290  memset(&request, 0, sizeof(grpc_http_request));
291  grpc_http_header* headers = nullptr;
292  if (!options_.client_id.empty() && !options_.client_secret.empty()) {
293  request.hdr_count = 2;
294  headers = static_cast<grpc_http_header*>(
295  gpr_malloc(sizeof(grpc_http_header) * request.hdr_count));
296  headers[0].key = gpr_strdup("Content-Type");
297  headers[0].value = gpr_strdup("application/x-www-form-urlencoded");
298  std::string raw_cred =
300  char* encoded_cred =
301  grpc_base64_encode(raw_cred.c_str(), raw_cred.length(), 0, 0);
302  std::string str = absl::StrFormat("Basic %s", std::string(encoded_cred));
303  headers[1].key = gpr_strdup("Authorization");
304  headers[1].value = gpr_strdup(str.c_str());
305  gpr_free(encoded_cred);
306  } else {
307  request.hdr_count = 1;
308  headers = static_cast<grpc_http_header*>(
309  gpr_malloc(sizeof(grpc_http_header) * request.hdr_count));
310  headers[0].key = gpr_strdup("Content-Type");
311  headers[0].value = gpr_strdup("application/x-www-form-urlencoded");
312  }
313  request.hdrs = headers;
314  std::vector<std::string> body_parts;
315  body_parts.push_back(
316  absl::StrFormat("audience=%s", UrlEncode(options_.audience).c_str()));
317  body_parts.push_back(absl::StrFormat(
318  "grant_type=%s",
320  body_parts.push_back(absl::StrFormat(
321  "requested_token_type=%s",
323  body_parts.push_back(absl::StrFormat(
324  "subject_token_type=%s", UrlEncode(options_.subject_token_type).c_str()));
325  body_parts.push_back(
326  absl::StrFormat("subject_token=%s", UrlEncode(subject_token).c_str()));
329  scope = absl::StrJoin(scopes_, " ");
330  }
331  body_parts.push_back(absl::StrFormat("scope=%s", UrlEncode(scope).c_str()));
332  Json::Object addtional_options_json_object;
333  if (options_.client_id.empty() && options_.client_secret.empty()) {
334  addtional_options_json_object["userProject"] =
336  }
337  Json addtional_options_json(std::move(addtional_options_json_object));
338  body_parts.push_back(absl::StrFormat(
339  "options=%s", UrlEncode(addtional_options_json.Dump()).c_str()));
340  std::string body = absl::StrJoin(body_parts, "&");
341  request.body = const_cast<char*>(body.c_str());
342  request.body_length = body.size();
344  ctx_->response = {};
345  GRPC_CLOSURE_INIT(&ctx_->closure, OnExchangeToken, this, nullptr);
346  GPR_ASSERT(http_request_ == nullptr);
347  RefCountedPtr<grpc_channel_credentials> http_request_creds;
348  if (uri->scheme() == "http") {
349  http_request_creds = RefCountedPtr<grpc_channel_credentials>(
351  } else {
352  http_request_creds = CreateHttpRequestSSLCredentials();
353  }
354  http_request_ =
355  HttpRequest::Post(std::move(*uri), nullptr /* channel args */,
357  &ctx_->response, std::move(http_request_creds));
358  http_request_->Start();
359  request.body = nullptr;
361 }
362 
366  static_cast<ExternalAccountCredentials*>(arg);
368 }
369 
372  http_request_.reset();
373  if (!GRPC_ERROR_IS_NONE(error)) {
375  } else {
380  metadata_req_->response.hdrs = static_cast<grpc_http_header*>(
382  for (size_t i = 0; i < ctx_->response.hdr_count; i++) {
387  }
389  } else {
391  }
392  }
393 }
394 
397  absl::string_view response_body(ctx_->response.body,
399  Json json = Json::Parse(response_body, &error);
400  if (!GRPC_ERROR_IS_NONE(error) || json.type() != Json::Type::OBJECT) {
402  "Invalid token exchange response.", &error, 1));
404  return;
405  }
406  auto it = json.object_value().find("access_token");
407  if (it == json.object_value().end() ||
408  it->second.type() != Json::Type::STRING) {
410  "Missing or invalid access_token in %s.", response_body)));
411  return;
412  }
413  std::string access_token = it->second.string_value();
414  absl::StatusOr<URI> uri =
416  if (!uri.ok()) {
418  "Invalid service account impersonation url: %s. Error: %s",
420  return;
421  }
423  memset(&request, 0, sizeof(grpc_http_request));
424  request.hdr_count = 2;
425  grpc_http_header* headers = static_cast<grpc_http_header*>(
426  gpr_malloc(sizeof(grpc_http_header) * request.hdr_count));
427  headers[0].key = gpr_strdup("Content-Type");
428  headers[0].value = gpr_strdup("application/x-www-form-urlencoded");
429  std::string str = absl::StrFormat("Bearer %s", access_token);
430  headers[1].key = gpr_strdup("Authorization");
431  headers[1].value = gpr_strdup(str.c_str());
432  request.hdrs = headers;
433  std::string scope = absl::StrJoin(scopes_, " ");
434  std::string body = absl::StrFormat("scope=%s", scope);
435  request.body = const_cast<char*>(body.c_str());
436  request.body_length = body.size();
438  ctx_->response = {};
440  // TODO(ctiller): Use the callers resource quota.
441  GPR_ASSERT(http_request_ == nullptr);
442  RefCountedPtr<grpc_channel_credentials> http_request_creds;
443  if (uri->scheme() == "http") {
444  http_request_creds = RefCountedPtr<grpc_channel_credentials>(
446  } else {
447  http_request_creds = CreateHttpRequestSSLCredentials();
448  }
450  std::move(*uri), nullptr, ctx_->pollent, &request, ctx_->deadline,
451  &ctx_->closure, &ctx_->response, std::move(http_request_creds));
452  http_request_->Start();
453  request.body = nullptr;
455 }
456 
458  void* arg, grpc_error_handle error) {
460  static_cast<ExternalAccountCredentials*>(arg);
462 }
463 
466  http_request_.reset();
467  if (!GRPC_ERROR_IS_NONE(error)) {
469  return;
470  }
471  absl::string_view response_body(ctx_->response.body,
473  Json json = Json::Parse(response_body, &error);
474  if (!GRPC_ERROR_IS_NONE(error) || json.type() != Json::Type::OBJECT) {
476  "Invalid service account impersonation response.", &error, 1));
478  return;
479  }
480  auto it = json.object_value().find("accessToken");
481  if (it == json.object_value().end() ||
482  it->second.type() != Json::Type::STRING) {
484  "Missing or invalid accessToken in %s.", response_body)));
485  return;
486  }
487  std::string access_token = it->second.string_value();
488  it = json.object_value().find("expireTime");
489  if (it == json.object_value().end() ||
490  it->second.type() != Json::Type::STRING) {
492  "Missing or invalid expireTime in %s.", response_body)));
493  return;
494  }
495  std::string expire_time = it->second.string_value();
496  absl::Time t;
497  if (!absl::ParseTime(absl::RFC3339_full, expire_time, &t, nullptr)) {
499  "Invalid expire time of service account impersonation response."));
500  return;
501  }
502  int expire_in = (t - absl::Now()) / absl::Seconds(1);
504  "{\"access_token\":\"%s\",\"expires_in\":%d,\"token_type\":\"Bearer\"}",
505  access_token, expire_in);
507  metadata_req_->response.body = gpr_strdup(body.c_str());
508  metadata_req_->response.body_length = body.length();
509  metadata_req_->response.hdrs = static_cast<grpc_http_header*>(
511  for (size_t i = 0; i < ctx_->response.hdr_count; i++) {
516  }
518 }
519 
521  GRPC_LOG_IF_ERROR("Fetch external account credentials access token",
523  // Move object state into local variables.
524  auto* cb = response_cb_;
525  response_cb_ = nullptr;
526  auto* metadata_req = metadata_req_;
527  metadata_req_ = nullptr;
528  auto* ctx = ctx_;
529  ctx_ = nullptr;
530  // Invoke the callback.
531  cb(metadata_req, error);
532  // Delete context.
533  delete ctx;
535 }
536 
537 } // namespace grpc_core
538 
540  const char* json_string, const char* scopes_string) {
542  grpc_core::Json json = grpc_core::Json::Parse(json_string, &error);
543  if (!GRPC_ERROR_IS_NONE(error)) {
545  "External account credentials creation failed. Error: %s.",
548  return nullptr;
549  }
550  std::vector<std::string> scopes = absl::StrSplit(scopes_string, ',');
552  json, std::move(scopes), &error)
553  .release();
554  if (!GRPC_ERROR_IS_NONE(error)) {
556  "External account credentials creation failed. Error: %s.",
559  return nullptr;
560  }
561  return creds;
562 }
absl::StrSplit
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, AllowEmpty, absl::string_view > StrSplit(strings_internal::ConvertibleToStringView text, Delimiter d)
Definition: abseil-cpp/absl/strings/str_split.h:499
url_external_account_credentials.h
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
xds_interop_client.str
str
Definition: xds_interop_client.py:487
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
absl::MaxSplits
strings_internal::MaxSplitsImpl< typename strings_internal::SelectDelimiter< Delimiter >::type > MaxSplits(Delimiter delimiter, int limit)
Definition: abseil-cpp/absl/strings/str_split.h:294
regen-readme.it
it
Definition: regen-readme.py:15
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
ctx
Definition: benchmark-async.c:30
grpc_core::Json::type
Type type() const
Definition: src/core/lib/json/json.h:174
memset
return memset(p, 0, total)
absl::StrFormat
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
Definition: abseil-cpp/absl/strings/str_format.h:338
absl::Time
Definition: third_party/abseil-cpp/absl/time/time.h:642
grpc_core::ExternalAccountCredentials::~ExternalAccountCredentials
~ExternalAccountCredentials() override
Definition: external_account_credentials.cc:237
EXTERNAL_ACCOUNT_CREDENTIALS_GRANT_TYPE
#define EXTERNAL_ACCOUNT_CREDENTIALS_GRANT_TYPE
Definition: external_account_credentials.cc:54
grpc_core::ExternalAccountCredentials::OnImpersenateServiceAccount
static void OnImpersenateServiceAccount(void *arg, grpc_error_handle error)
Definition: external_account_credentials.cc:457
grpc_core::Json::Type::OBJECT
@ OBJECT
grpc_core::ExternalAccountCredentials::OnExchangeToken
static void OnExchangeToken(void *arg, grpc_error_handle error)
Definition: external_account_credentials.cc:363
grpc_core::ExternalAccountCredentials::response_cb_
grpc_iomgr_cb_func response_cb_
Definition: external_account_credentials.h:124
file_external_account_credentials.h
grpc_core
Definition: call_metric_recorder.h:31
grpc_http_response::body
char * body
Definition: src/core/lib/http/parser.h:96
grpc_core::ExternalAccountCredentials::HTTPRequestContext::pollent
grpc_polling_entity * pollent
Definition: external_account_credentials.h:81
string.h
options
double_dict options[]
Definition: capstone_test.c:55
benchmark.request
request
Definition: benchmark.py:77
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
grpc_core::ExternalAccountCredentials::Options::client_id
std::string client_id
Definition: external_account_credentials.h:58
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
grpc_core::ExternalAccountCredentials::HTTPRequestContext
Definition: external_account_credentials.h:74
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_core::ExternalAccountCredentials
Definition: external_account_credentials.h:45
grpc_core::Json::object_value
const Object & object_value() const
Definition: src/core/lib/json/json.h:177
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(desc, errs, count)
Definition: error.h:307
grpc_call_credentials
Definition: src/core/lib/security/credentials/credentials.h:189
grpc_core::ExternalAccountCredentials::scopes_
std::vector< std::string > scopes_
Definition: external_account_credentials.h:119
ctx
static struct test_ctx ctx
Definition: test-ipc-send-recv.c:65
GRPC_LOG_IF_ERROR
#define GRPC_LOG_IF_ERROR(what, error)
Definition: error.h:398
grpc_core::HttpRequest::Post
static OrphanablePtr< HttpRequest > Post(URI uri, const grpc_channel_args *args, grpc_polling_entity *pollent, const grpc_http_request *request, Timestamp deadline, grpc_closure *on_done, grpc_http_response *response, RefCountedPtr< grpc_channel_credentials > channel_creds) GRPC_MUST_USE_RESULT
Definition: httpcli.cc:95
grpc_core::CreateHttpRequestSSLCredentials
RefCountedPtr< grpc_channel_credentials > CreateHttpRequestSSLCredentials()
Definition: httpcli_security_connector.cc:208
grpc_security.h
grpc_core::ExternalAccountCredentials::RetrieveSubjectToken
virtual void RetrieveSubjectToken(HTTPRequestContext *ctx, const Options &options, std::function< void(std::string, grpc_error_handle)> cb)=0
grpc_core::URI::Parse
static absl::StatusOr< URI > Parse(absl::string_view uri_text)
Definition: uri_parser.cc:209
credentials.h
GRPC_AUTH_JSON_TYPE_EXTERNAL_ACCOUNT
#define GRPC_AUTH_JSON_TYPE_EXTERNAL_ACCOUNT
Definition: src/core/lib/security/util/json_util.h:31
string_util.h
external_account_credentials.h
grpc_http_request_destroy
void grpc_http_request_destroy(grpc_http_request *request)
Definition: src/core/lib/http/parser.cc:422
grpc_core::ExternalAccountCredentials::ImpersenateServiceAccount
void ImpersenateServiceAccount()
Definition: external_account_credentials.cc:395
grpc_external_account_credentials_create
grpc_call_credentials * grpc_external_account_credentials_create(const char *json_string, const char *scopes_string)
Definition: external_account_credentials.cc:539
grpc_http_header::key
char * key
Definition: src/core/lib/http/parser.h:37
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
absl::StrJoin
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
Definition: abseil-cpp/absl/strings/str_join.h:239
grpc_http_header
Definition: src/core/lib/http/parser.h:36
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
Json
JSON (JavaScript Object Notation).
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:227
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
httpcli_ssl_credentials.h
grpc.h
absl::ParseTime
bool ParseTime(absl::string_view format, absl::string_view input, absl::Time *time, std::string *err)
Definition: abseil-cpp/absl/time/format.cc:91
absl::RFC3339_full
ABSL_NAMESPACE_BEGIN const ABSL_DLL char RFC3339_full[]
Definition: third_party/abseil-cpp/absl/time/time.h:1261
grpc_oauth2_token_fetcher_credentials::debug_string
std::string debug_string() override
Definition: oauth2_credentials.cc:358
grpc_insecure_credentials_create
GRPCAPI grpc_channel_credentials * grpc_insecure_credentials_create()
Definition: core/lib/security/credentials/insecure/insecure_credentials.cc:64
grpc_core::ExternalAccountCredentials::ExternalAccountCredentials
ExternalAccountCredentials(Options options, std::vector< std::string > scopes)
Definition: external_account_credentials.cc:228
b64.h
arg
Definition: cmdline.cc:40
absl::StrContains
ABSL_NAMESPACE_BEGIN bool StrContains(absl::string_view haystack, absl::string_view needle) noexcept
Definition: third_party/abseil-cpp/absl/strings/match.h:46
grpc_core::ExternalAccountCredentials::HTTPRequestContext::closure
grpc_closure closure
Definition: external_account_credentials.h:85
grpc_http_response_destroy
void grpc_http_response_destroy(grpc_http_response *response)
Definition: src/core/lib/http/parser.cc:434
grpc_core::ExternalAccountCredentials::FinishTokenFetch
void FinishTokenFetch(grpc_error_handle error)
Definition: external_account_credentials.cc:520
grpc_polling_entity
Definition: polling_entity.h:38
grpc_core::ExternalAccountCredentials::HTTPRequestContext::deadline
Timestamp deadline
Definition: external_account_credentials.h:82
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
grpc_http_response::hdrs
grpc_http_header * hdrs
Definition: src/core/lib/http/parser.h:90
grpc_core::ExternalAccountCredentials::ctx_
HTTPRequestContext * ctx_
Definition: external_account_credentials.h:122
grpc_credentials_metadata_request
Definition: oauth2_credentials.h:85
grpc_base64_encode
char * grpc_base64_encode(const void *vdata, size_t data_size, int url_safe, int multiline)
Definition: b64.cc:59
grpc_core::ExternalAccountCredentials::Options::token_url
std::string token_url
Definition: external_account_credentials.h:54
grpc_core::ExternalAccountCredentials::Options::service_account_impersonation_url
std::string service_account_impersonation_url
Definition: external_account_credentials.h:53
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
grpc_core::ExternalAccountCredentials::fetch_oauth2
void fetch_oauth2(grpc_credentials_metadata_request *req, grpc_polling_entity *pollent, grpc_iomgr_cb_func cb, Timestamp deadline) override
Definition: external_account_credentials.cc:257
grpc_core::Json::Parse
static Json Parse(absl::string_view json_str, grpc_error_handle *error)
Definition: json_reader.cc:899
grpc_core::ExternalAccountCredentials::Options::audience
std::string audience
Definition: external_account_credentials.h:51
grpc_core::ExternalAccountCredentials::HTTPRequestContext::response
grpc_http_response response
Definition: external_account_credentials.h:86
GOOGLE_CLOUD_PLATFORM_DEFAULT_SCOPE
#define GOOGLE_CLOUD_PLATFORM_DEFAULT_SCOPE
Definition: external_account_credentials.cc:58
absl::Seconds
constexpr Duration Seconds(T n)
Definition: third_party/abseil-cpp/absl/time/time.h:419
grpc_core::Json::Object
std::map< std::string, Json > Object
Definition: src/core/lib/json/json.h:54
grpc_core::ExternalAccountCredentials::OnRetrieveSubjectTokenInternal
void OnRetrieveSubjectTokenInternal(absl::string_view subject_token, grpc_error_handle error)
Definition: external_account_credentials.cc:271
absl::Now
ABSL_NAMESPACE_BEGIN Time Now()
Definition: abseil-cpp/absl/time/clock.cc:39
absl::StatusOr::ok
ABSL_MUST_USE_RESULT bool ok() const
Definition: abseil-cpp/absl/status/statusor.h:491
grpc_core::ExternalAccountCredentials::debug_string
std::string debug_string() override
Definition: external_account_credentials.cc:239
parser.h
GRPC_ERROR_REF
#define GRPC_ERROR_REF(err)
Definition: error.h:261
grpc_core::ExternalAccountCredentials::http_request_
OrphanablePtr< HttpRequest > http_request_
Definition: external_account_credentials.h:121
options_
DebugStringOptions options_
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.cc:2390
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
grpc_http_response::body_length
size_t body_length
Definition: src/core/lib/http/parser.h:92
grpc_credentials_metadata_request::response
grpc_http_response response
Definition: oauth2_credentials.h:94
GRPC_ERROR_CREATE_FROM_CPP_STRING
#define GRPC_ERROR_CREATE_FROM_CPP_STRING(desc)
Definition: error.h:297
alloc.h
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc_iomgr_cb_func
void(* grpc_iomgr_cb_func)(void *arg, grpc_error_handle error)
Definition: closure.h:53
grpc_http_header::value
char * value
Definition: src/core/lib/http/parser.h:38
arg
struct arg arg
grpc_core::ExternalAccountCredentials::options_
Options options_
Definition: external_account_credentials.h:118
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
EXTERNAL_ACCOUNT_CREDENTIALS_REQUESTED_TOKEN_TYPE
#define EXTERNAL_ACCOUNT_CREDENTIALS_REQUESTED_TOKEN_TYPE
Definition: external_account_credentials.cc:56
gpr_strdup
GPRAPI char * gpr_strdup(const char *src)
Definition: string.cc:39
absl::StatusOr
Definition: abseil-cpp/absl/status/statusor.h:187
grpc_http_response::hdr_count
size_t hdr_count
Definition: src/core/lib/http/parser.h:89
grpc_core::ExternalAccountCredentials::metadata_req_
grpc_credentials_metadata_request * metadata_req_
Definition: external_account_credentials.h:123
uri_parser.h
json_util.h
grpc_error
Definition: error_internal.h:42
grpc_core::ExternalAccountCredentials::OnImpersenateServiceAccountInternal
void OnImpersenateServiceAccountInternal(grpc_error_handle error)
Definition: external_account_credentials.cc:464
grpc_core::ExternalAccountCredentials::Options::workforce_pool_user_project
std::string workforce_pool_user_project
Definition: external_account_credentials.h:60
aws_external_account_credentials.h
grpc_core::Json
Definition: src/core/lib/json/json.h:37
grpc_core::ExternalAccountCredentials::ExchangeToken
void ExchangeToken(absl::string_view subject_token)
Definition: external_account_credentials.cc:280
grpc_core::ExternalAccountCredentials::Create
static RefCountedPtr< ExternalAccountCredentials > Create(const Json &json, std::vector< std::string > scopes, grpc_error_handle *error)
Definition: external_account_credentials.cc:102
grpc_core::Json::Dump
std::string Dump(int indent=0) const
Definition: json_writer.cc:336
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
grpc_core::Json::Type::STRING
@ STRING
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
grpc_core::ExternalAccountCredentials::Options::subject_token_type
std::string subject_token_type
Definition: external_account_credentials.h:52
absl::StatusOr::status
const Status & status() const &
Definition: abseil-cpp/absl/status/statusor.h:678
grpc_core::ExternalAccountCredentials::Options
Definition: external_account_credentials.h:49
grpc_core::ExternalAccountCredentials::Options::client_secret
std::string client_secret
Definition: external_account_credentials.h:59
grpc_core::ExternalAccountCredentials::OnExchangeTokenInternal
void OnExchangeTokenInternal(grpc_error_handle error)
Definition: external_account_credentials.cc:370
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
GRPC_AUTH_JSON_TYPE_INVALID
#define GRPC_AUTH_JSON_TYPE_INVALID
Definition: src/core/lib/security/util/json_util.h:28
grpc_http_request
Definition: src/core/lib/http/parser.h:69
port_platform.h
absl::ConsumePrefix
ABSL_NAMESPACE_BEGIN bool ConsumePrefix(absl::string_view *str, absl::string_view expected)
Definition: abseil-cpp/absl/strings/strip.h:46


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:21