google_default_credentials.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 #include <string.h>
24 
25 #include <map>
26 #include <memory>
27 #include <string>
28 
29 #include "absl/status/statusor.h"
30 #include "absl/strings/match.h"
31 #include "absl/strings/string_view.h"
32 #include "absl/strings/strip.h"
33 
34 #include <grpc/grpc_security.h> // IWYU pragma: keep
36 #include <grpc/slice.h>
37 #include <grpc/support/alloc.h>
38 #include <grpc/support/log.h>
39 #include <grpc/support/sync.h>
40 
45 #include "src/core/lib/gpr/env.h"
58 #include "src/core/lib/json/json.h"
69 
70 using grpc_core::Json;
71 
72 /* -- Constants. -- */
73 
74 #define GRPC_COMPUTE_ENGINE_DETECTION_HOST "metadata.google.internal."
75 #define GRPC_GOOGLE_CREDENTIAL_CREATION_ERROR \
76  "Failed to create Google credentials"
77 
78 /* -- Default credentials. -- */
79 
80 /* A sticky bit that will be set only if the result of metadata server detection
81  * is positive. We do not set the bit if the result is negative. Because it
82  * means the detection is done via network test that is unreliable and the
83  * unreliable result should not be referred by successive calls. */
86 /* Protect a metadata_server_detector instance that can be modified by more than
87  * one gRPC threads */
92 
93 static void init_default_credentials(void) {
95 }
96 
99  int is_done;
100  int success;
102 };
103 
104 namespace {
105 
106 bool IsXdsNonCfeCluster(const char* xds_cluster) {
107  if (xds_cluster == nullptr) return false;
108  if (absl::StartsWith(xds_cluster, "google_cfe_")) return false;
109  if (!absl::StartsWith(xds_cluster, "xdstp:")) return true;
110  auto uri = grpc_core::URI::Parse(xds_cluster);
111  if (!uri.ok()) return true; // Shouldn't happen, but assume ALTS.
112  return uri->authority() != "traffic-director-c2p.xds.googleapis.com" ||
113  !absl::StartsWith(uri->path(),
114  "/envoy.config.cluster.v3.Cluster/google_cfe_");
115 }
116 
117 } // namespace
118 
122  const char* target, const grpc_channel_args* args,
123  grpc_channel_args** new_args) {
124  const bool is_grpclb_load_balancer = grpc_channel_args_find_bool(
126  const bool is_backend_from_grpclb_load_balancer = grpc_channel_args_find_bool(
128  const char* xds_cluster =
130  const bool is_xds_non_cfe_cluster = IsXdsNonCfeCluster(xds_cluster);
131  const bool use_alts = is_grpclb_load_balancer ||
132  is_backend_from_grpclb_load_balancer ||
133  is_xds_non_cfe_cluster;
134  /* Return failure if ALTS is selected but not running on GCE. */
135  if (use_alts && alts_creds_ == nullptr) {
136  gpr_log(GPR_ERROR, "ALTS is selected, but not running on GCE.");
137  return nullptr;
138  }
141  args, new_args)
143  new_args);
144  /* grpclb-specific channel args are removed from the channel args set
145  * to ensure backends and fallback adresses will have the same set of channel
146  * args. By doing that, it guarantees the connections to backends will not be
147  * torn down and re-connected when switching in and out of fallback mode.
148  */
149  if (use_alts) {
150  static const char* args_to_remove[] = {
153  };
155  args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), nullptr, 0);
156  }
157  return sc;
158 }
159 
163  return args.SetIfUnset(GRPC_ARG_DNS_ENABLE_SRV_QUERIES, true);
164 }
165 
167  const {
168  static grpc_core::UniqueTypeName::Factory kFactory("GoogleDefault");
169  return kFactory.Create();
170 }
171 
173  void* user_data, grpc_error_handle error) {
174  metadata_server_detector* detector =
175  static_cast<metadata_server_detector*>(user_data);
176  if (GRPC_ERROR_IS_NONE(error) && detector->response.status == 200 &&
177  detector->response.hdr_count > 0) {
178  /* Internet providers can return a generic response to all requests, so
179  it is necessary to check that metadata header is present also. */
180  size_t i;
181  for (i = 0; i < detector->response.hdr_count; i++) {
182  grpc_http_header* header = &detector->response.hdrs[i];
183  if (strcmp(header->key, "Metadata-Flavor") == 0 &&
184  strcmp(header->value, "Google") == 0) {
185  detector->success = 1;
186  break;
187  }
188  }
189  }
191  detector->is_done = 1;
193  "Pollset kick",
195  nullptr));
197 }
198 
199 static void destroy_pollset(void* p, grpc_error_handle /*e*/) {
200  grpc_pollset_destroy(static_cast<grpc_pollset*>(p));
201 }
202 
204  metadata_server_detector detector;
206  grpc_closure destroy_closure;
207  /* The http call is local. If it takes more than one sec, it is for sure not
208  on compute engine. */
209  const auto max_detection_delay = grpc_core::Duration::Seconds(1);
210  grpc_pollset* pollset =
211  static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
212  grpc_pollset_init(pollset, &g_polling_mu);
214  detector.is_done = 0;
215  detector.success = 0;
216  memset(&request, 0, sizeof(grpc_http_request));
217  auto uri =
219  {} /* query params */, "" /* fragment */);
220  GPR_ASSERT(uri.ok()); // params are hardcoded
221  auto http_request = grpc_core::HttpRequest::Get(
222  std::move(*uri), nullptr /* channel args */, &detector.pollent, &request,
223  grpc_core::ExecCtx::Get()->Now() + max_detection_delay,
225  grpc_schedule_on_exec_ctx),
226  &detector.response,
229  http_request->Start();
231  /* Block until we get the response. This is not ideal but this should only be
232  called once for the lifetime of the process by the default credentials. */
234  while (!detector.is_done) {
235  grpc_pollset_worker* worker = nullptr;
236  if (!GRPC_LOG_IF_ERROR(
237  "pollset_work",
240  detector.is_done = 1;
241  detector.success = 0;
242  }
243  }
245  http_request.reset();
246  GRPC_CLOSURE_INIT(&destroy_closure, destroy_pollset,
248  grpc_schedule_on_exec_ctx);
250  &destroy_closure);
251  g_polling_mu = nullptr;
255  return detector.success;
256 }
257 
258 namespace {
259 
260 bool ValidateUrlField(const Json& json, const std::string& field) {
261  auto it = json.object_value().find(field);
262  if (it == json.object_value().end()) {
263  return true;
264  }
265  if (it->second.type() != Json::Type::STRING ||
266  it->second.string_value().empty()) {
267  return false;
268  }
270  grpc_core::URI::Parse(it->second.string_value());
271  if (!url.ok()) return false;
272  if (!absl::EqualsIgnoreCase(url->scheme(), "https")) {
273  return false;
274  }
275  absl::string_view host;
277  grpc_core::SplitHostPort(url->authority(), &host, &port);
278  if (absl::ConsumeSuffix(&host, ".googleapis.com")) {
279  if (host == "sts" || host == "iamcredentials") {
280  return true;
281  } else if (absl::StartsWith(host, "sts.") ||
282  absl::StartsWith(host, "iamcredentials.")) {
283  return true;
284  } else if (absl::EndsWith(host, ".sts") ||
285  absl::EndsWith(host, ".iamcredentials")) {
286  return true;
287  } else if (absl::EndsWith(host, "-sts") ||
288  absl::EndsWith(host, "-iamcredentials")) {
289  return true;
290  }
291  }
292  return false;
293 }
294 
295 bool ValidateExteralAccountCredentials(const Json& json) {
296  return json.type() == Json::Type::OBJECT &&
297  ValidateUrlField(json, "token_url") &&
298  ValidateUrlField(json, "service_account_impersonation_url") &&
299  ValidateUrlField(json, "token_info_url");
300 }
301 
302 } // namespace
303 
304 /* Takes ownership of creds_path if not NULL. */
306  const std::string& creds_path,
311  grpc_slice creds_data = grpc_empty_slice();
313  Json json;
314  if (creds_path.empty()) {
315  error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("creds_path unset");
316  goto end;
317  }
318  error = grpc_load_file(creds_path.c_str(), 0, &creds_data);
319  if (!GRPC_ERROR_IS_NONE(error)) goto end;
320  json = Json::Parse(grpc_core::StringViewFromSlice(creds_data), &error);
321  if (!GRPC_ERROR_IS_NONE(error)) goto end;
322  if (json.type() != Json::Type::OBJECT) {
324  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to parse JSON"),
326  goto end;
327  }
328 
329  /* First, try an auth json key. */
332  result =
335  if (result == nullptr) {
337  "grpc_service_account_jwt_access_credentials_create_from_auth_json_"
338  "key failed");
339  }
340  goto end;
341  }
342 
343  /* Then try a refresh token if the auth json key was invalid. */
345  if (grpc_auth_refresh_token_is_valid(&token)) {
346  result =
348  if (result == nullptr) {
350  "grpc_refresh_token_credentials_create_from_auth_refresh_token "
351  "failed");
352  }
353  goto end;
354  }
355 
356  /* Finally try an external account credentials.*/
357  if (!ValidateExteralAccountCredentials(json)) {
359  "Invalid external account credentials format.");
360  goto end;
361  }
363 
364 end:
365  GPR_ASSERT((result == nullptr) + (GRPC_ERROR_IS_NONE(error)) == 1);
366  grpc_slice_unref_internal(creds_data);
367  *creds = result;
368  return error;
369 }
370 
371 static void update_tenancy() {
374 
375  /* Try a platform-provided hint for GCE. */
378  }
379  /* TODO: Add a platform-provided hint for GAE. */
380 
381  /* Do a network test for metadata server. */
384  }
385 }
386 
389  return static_cast<bool>(g_metadata_server_available);
390 }
391 
396 
397  /* First, try the environment variable. */
398  char* path_from_env = gpr_getenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR);
399  if (path_from_env != nullptr) {
400  err = create_default_creds_from_path(path_from_env, &call_creds);
401  gpr_free(path_from_env);
402  if (GRPC_ERROR_IS_NONE(err)) return call_creds;
404  }
405 
406  /* Then the well-known file. */
409  if (GRPC_ERROR_IS_NONE(err)) return call_creds;
411 
412  update_tenancy();
413 
417  if (call_creds == nullptr) {
422  "Failed to get credentials from network"));
423  }
424  }
425 
426  return call_creds;
427 }
428 
430  grpc_call_credentials* call_credentials) {
431  grpc_channel_credentials* result = nullptr;
435 
436  GRPC_API_TRACE("grpc_google_default_credentials_create(%p)", 1,
437  (call_credentials));
438 
439  if (call_creds == nullptr) {
441  }
442 
443  if (call_creds != nullptr) {
444  /* Create google default credentials. */
445  grpc_channel_credentials* ssl_creds =
446  grpc_ssl_credentials_create(nullptr, nullptr, nullptr, nullptr);
447  GPR_ASSERT(ssl_creds != nullptr);
450  grpc_channel_credentials* alts_creds =
453  auto creds =
454  grpc_core::MakeRefCounted<grpc_google_default_channel_credentials>(
458  creds.get(), call_creds.get(), nullptr);
459  GPR_ASSERT(result != nullptr);
460  } else {
461  gpr_log(GPR_ERROR, "Could not create google default credentials: %s",
463  }
465  return result;
466 }
467 
468 namespace grpc_core {
469 namespace internal {
470 
472  g_gce_tenancy_checker = checker;
473 }
474 
478  MutexLock lock(g_state_mu);
480 }
481 
482 } // namespace internal
483 } // namespace grpc_core
484 
485 /* -- Well known credentials path. -- */
486 
488 
490  if (creds_path_getter != nullptr) return creds_path_getter();
492 }
493 
496  creds_path_getter = getter;
497 }
grpc_pollset_worker
struct grpc_pollset_worker grpc_pollset_worker
Definition: pollset.h:39
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
trace.h
grpc_alts_credentials_options_destroy
GRPCAPI void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options)
Definition: grpc_alts_credentials_options.cc:38
grpc_channel_args_find_string
char * grpc_channel_args_find_string(const grpc_channel_args *args, const char *name)
Definition: channel_args.cc:441
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
grpc_pollset_size
size_t grpc_pollset_size(void)
Definition: pollset.cc:56
cleanup.Json
Json
Definition: cleanup.py:49
grpc_core::UniqueTypeName::Factory::Create
UniqueTypeName Create()
Definition: unique_type_name.h:67
grpc_google_default_channel_credentials::ssl_creds_
grpc_core::RefCountedPtr< grpc_channel_credentials > ssl_creds_
Definition: google_default_credentials.h:85
gpr_mu_unlock
GPRAPI void gpr_mu_unlock(gpr_mu *mu)
grpc_polling_entity_pollset
grpc_pollset * grpc_polling_entity_pollset(grpc_polling_entity *pollent)
Definition: polling_entity.cc:42
g_gce_tenancy_checker
static grpc_core::internal::grpc_gce_tenancy_checker g_gce_tenancy_checker
Definition: google_default_credentials.cc:90
pollset.h
regen-readme.it
it
Definition: regen-readme.py:15
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
grpc_google_default_credentials_create
grpc_channel_credentials * grpc_google_default_credentials_create(grpc_call_credentials *call_credentials)
Definition: google_default_credentials.cc:429
grpc_override_well_known_credentials_path_getter
void grpc_override_well_known_credentials_path_getter(grpc_well_known_credentials_path_getter getter)
Definition: google_default_credentials.cc:494
grpc_load_file
grpc_error_handle grpc_load_file(const char *filename, int add_null_terminator, grpc_slice *output)
Definition: load_file.cc:33
grpc_core::Json::type
Type type() const
Definition: src/core/lib/json/json.h:174
grpc_google_default_channel_credentials::type
grpc_core::UniqueTypeName type() const override
Definition: google_default_credentials.cc:166
grpc_core::internal::set_gce_tenancy_checker_for_testing
void set_gce_tenancy_checker_for_testing(grpc_gce_tenancy_checker checker)
Definition: google_default_credentials.cc:471
memset
return memset(p, 0, total)
load_file.h
absl::ConsumeSuffix
bool ConsumeSuffix(absl::string_view *str, absl::string_view expected)
Definition: abseil-cpp/absl/strings/strip.h:62
on_metadata_server_detection_http_response
static void on_metadata_server_detection_http_response(void *user_data, grpc_error_handle error)
Definition: google_default_credentials.cc:172
gpr_once
pthread_once_t gpr_once
Definition: impl/codegen/sync_posix.h:50
polling_entity.h
slice.h
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::MutexLock
Definition: src/core/lib/gprpp/sync.h:88
string.h
options
double_dict options[]
Definition: capstone_test.c:55
benchmark.request
request
Definition: benchmark.py:77
absl::StartsWith
bool StartsWith(absl::string_view text, absl::string_view prefix) noexcept
Definition: third_party/abseil-cpp/absl/strings/match.h:58
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_refresh_token_credentials_create_from_auth_refresh_token
grpc_core::RefCountedPtr< grpc_call_credentials > grpc_refresh_token_credentials_create_from_auth_refresh_token(grpc_auth_refresh_token refresh_token)
Definition: oauth2_credentials.cc:476
grpc_core::StringViewFromSlice
absl::string_view StringViewFromSlice(const grpc_slice &slice)
Definition: slice_internal.h:93
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
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_alts_is_running_on_gcp
bool grpc_alts_is_running_on_gcp()
Definition: check_gcp_environment_no_op.cc:27
error_ref_leak.err
err
Definition: error_ref_leak.py:35
grpc_core::Json::object_value
const Object & object_value() const
Definition: src/core/lib/json/json.h:177
g_once
static gpr_once g_once
Definition: google_default_credentials.cc:89
grpc_channel_args_copy_and_add_and_remove
grpc_channel_args * grpc_channel_args_copy_and_add_and_remove(const grpc_channel_args *src, const char **to_remove, size_t num_to_remove, const grpc_arg *to_add, size_t num_to_add)
Definition: channel_args.cc:246
closure.h
grpc_call_credentials
Definition: src/core/lib/security/credentials/credentials.h:189
grpc_core::SplitHostPort
bool SplitHostPort(absl::string_view name, absl::string_view *host, absl::string_view *port)
Definition: host_port.cc:88
grpc_auth_refresh_token_create_from_json
grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(const Json &json)
Definition: oauth2_credentials.cc:79
check_gcp_environment.h
grpc_get_well_known_google_credentials_file_path
std::string grpc_get_well_known_google_credentials_file_path(void)
Definition: google_default_credentials.cc:489
grpc_google_compute_engine_credentials_create
GRPCAPI grpc_call_credentials * grpc_google_compute_engine_credentials_create(void *reserved)
Definition: oauth2_credentials.cc:421
GPR_ONCE_INIT
#define GPR_ONCE_INIT
Definition: impl/codegen/sync_posix.h:52
env.h
grpc_pollset_work
grpc_error_handle grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker **worker, grpc_core::Timestamp deadline)
Definition: pollset.cc:45
update_tenancy
static void update_tenancy()
Definition: google_default_credentials.cc:371
json_token.h
GRPC_LOG_IF_ERROR
#define GRPC_LOG_IF_ERROR(what, error)
Definition: error.h:398
is_metadata_server_reachable
static int is_metadata_server_reachable()
Definition: google_default_credentials.cc:203
GRPC_ERROR_STR_RAW_BYTES
@ GRPC_ERROR_STR_RAW_BYTES
hex dump (or similar) with the data that generated this error
Definition: error.h:123
xds_manager.p
p
Definition: xds_manager.py:60
GRPC_CLOSURE_CREATE
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler)
Definition: closure.h:160
grpc_security.h
GRPC_GOOGLE_CREDENTIAL_CREATION_ERROR
#define GRPC_GOOGLE_CREDENTIAL_CREATION_ERROR
Definition: google_default_credentials.cc:75
grpc_auth_refresh_token
Definition: oauth2_credentials.h:60
grpc_core::URI::Parse
static absl::StatusOr< URI > Parse(absl::string_view uri_text)
Definition: uri_parser.cc:209
credentials.h
grpc_channel_args_find_bool
bool grpc_channel_args_find_bool(const grpc_channel_args *args, const char *name, bool default_value)
Definition: channel_args.cc:465
grpc_channel_args
Definition: grpc_types.h:132
creds_path_getter
static grpc_well_known_credentials_path_getter creds_path_getter
Definition: google_default_credentials.cc:487
grpc_pollset_init
void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu)
Definition: pollset.cc:33
grpc_ssl_credentials_create
GRPCAPI grpc_channel_credentials * grpc_ssl_credentials_create(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair, const verify_peer_options *verify_options, void *reserved)
Definition: ssl_credentials.cc:132
grpc_error_set_str
grpc_error_handle grpc_error_set_str(grpc_error_handle src, grpc_error_strs which, absl::string_view str)
Definition: error.cc:650
grpclb.h
gpr_once_init
GPRAPI void gpr_once_init(gpr_once *once, void(*init_function)(void))
init_default_credentials
static void init_default_credentials(void)
Definition: google_default_credentials.cc:93
gpr_zalloc
GPRAPI void * gpr_zalloc(size_t size)
Definition: alloc.cc:40
make_default_call_creds
static grpc_core::RefCountedPtr< grpc_call_credentials > make_default_call_creds(grpc_error_handle *error)
Definition: google_default_credentials.cc:392
GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER
#define GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER
Definition: grpclb.h:32
setup.url
url
Definition: setup.py:547
grpc_http_response
Definition: src/core/lib/http/parser.h:85
grpc_error_add_child
grpc_error_handle grpc_error_add_child(grpc_error_handle src, grpc_error_handle child)
Definition: error.cc:678
external_account_credentials.h
grpc_get_well_known_google_credentials_file_path_impl
std::string grpc_get_well_known_google_credentials_file_path_impl(void)
Definition: credentials_generic.cc:32
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_alts_credentials_client_options_create
GRPCAPI grpc_alts_credentials_options * grpc_alts_credentials_client_options_create(void)
Definition: grpc_alts_credentials_client_options.cc:73
gpr_getenv
char * gpr_getenv(const char *name)
grpc_core::RefCountedPtr< grpc_channel_security_connector >
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
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
GRPC_ARG_ADDRESS_IS_GRPCLB_LOAD_BALANCER
#define GRPC_ARG_ADDRESS_IS_GRPCLB_LOAD_BALANCER
Definition: grpclb.h:27
grpc_auth_json_key_is_valid
int grpc_auth_json_key_is_valid(const grpc_auth_json_key *json_key)
Definition: json_token.cc:66
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
grpc_core::ExecCtx::Flush
bool Flush()
Definition: exec_ctx.cc:69
grpc_max_auth_token_lifetime
GRPCAPI gpr_timespec grpc_max_auth_token_lifetime(void)
Definition: json_token.cc:48
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
worker
Definition: worker.py:1
grpc_polling_entity_create_from_pollset
grpc_polling_entity grpc_polling_entity_create_from_pollset(grpc_pollset *pollset)
Definition: polling_entity.cc:34
grpc_core::internal::grpc_gce_tenancy_checker
bool(* grpc_gce_tenancy_checker)(void)
Definition: google_default_credentials.h:91
httpcli.h
call_creds
void call_creds(grpc_end2end_test_config config)
Definition: call_creds.cc:523
header
struct absl::base_internal::@2940::AllocList::Header header
grpc_service_account_jwt_access_credentials_create_from_auth_json_key
grpc_core::RefCountedPtr< grpc_call_credentials > grpc_service_account_jwt_access_credentials_create_from_auth_json_key(grpc_auth_json_key key, gpr_timespec token_lifetime)
Definition: jwt_credentials.cc:133
metadata_server_detector
Definition: google_default_credentials.cc:97
grpc_insecure_credentials_create
GRPCAPI grpc_channel_credentials * grpc_insecure_credentials_create()
Definition: core/lib/security/credentials/insecure/insecure_credentials.cc:64
absl::EqualsIgnoreCase
ABSL_NAMESPACE_BEGIN bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) noexcept
Definition: abseil-cpp/absl/strings/match.cc:22
grpc_google_default_channel_credentials::update_arguments
grpc_core::ChannelArgs update_arguments(grpc_core::ChannelArgs args) override
Definition: google_default_credentials.cc:161
time.h
grpc_empty_slice
GPRAPI grpc_slice grpc_empty_slice(void)
Definition: slice/slice.cc:42
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
create_default_creds_from_path
static grpc_error_handle create_default_creds_from_path(const std::string &creds_path, grpc_core::RefCountedPtr< grpc_call_credentials > *creds)
Definition: google_default_credentials.cc:305
xds_channel_args.h
gpr_mu_lock
GPRAPI void gpr_mu_lock(gpr_mu *mu)
grpc_http_response_destroy
void grpc_http_response_destroy(grpc_http_response *response)
Definition: src/core/lib/http/parser.cc:434
absl::flags_internal::Parse
bool Parse(FlagOpFn op, absl::string_view text, void *dst, std::string *error)
Definition: abseil-cpp/absl/flags/internal/flag.h:125
error.h
grpc_polling_entity
Definition: polling_entity.h:38
host_port.h
grpc_composite_channel_credentials_create
GRPCAPI grpc_channel_credentials * grpc_composite_channel_credentials_create(grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds, void *reserved)
Definition: composite_credentials.cc:164
json.h
slice_internal.h
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
metadata_server_detector::response
grpc_http_response response
Definition: google_default_credentials.cc:101
grpc_pollset_kick
grpc_error_handle grpc_pollset_kick(grpc_pollset *pollset, grpc_pollset_worker *specific_worker)
Definition: pollset.cc:51
grpc_http_response::hdrs
grpc_http_header * hdrs
Definition: src/core/lib/http/parser.h:90
grpc_core::ExecCtx
Definition: exec_ctx.h:97
g_state_mu
static grpc_core::Mutex * g_state_mu
Definition: google_default_credentials.cc:85
grpc_auth_json_key_create_from_json
grpc_auth_json_key grpc_auth_json_key_create_from_json(const Json &json)
Definition: json_token.cc:71
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
grpc_http_response::status
int status
Definition: src/core/lib/http/parser.h:87
GRPC_ARG_DNS_ENABLE_SRV_QUERIES
#define GRPC_ARG_DNS_ENABLE_SRV_QUERIES
Definition: grpc_types.h:433
GRPC_GOOGLE_CREDENTIALS_ENV_VAR
#define GRPC_GOOGLE_CREDENTIALS_ENV_VAR
Definition: grpc_security_constants.h:63
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
GRPC_COMPUTE_ENGINE_DETECTION_HOST
#define GRPC_COMPUTE_ENGINE_DETECTION_HOST
Definition: google_default_credentials.cc:74
grpc_alts_credentials_options
Definition: grpc_alts_credentials_options.h:35
g_polling_mu
static gpr_mu * g_polling_mu
Definition: google_default_credentials.cc:88
grpc_alts_credentials_create
GRPCAPI grpc_channel_credentials * grpc_alts_credentials_create(const grpc_alts_credentials_options *options)
Definition: alts_credentials.cc:110
GPR_ARRAY_SIZE
#define GPR_ARRAY_SIZE(array)
Definition: useful.h:129
grpc_core::Mutex
Definition: src/core/lib/gprpp/sync.h:61
parser.h
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
grpc_core::HttpRequest::Get
static OrphanablePtr< HttpRequest > Get(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:69
key
const char * key
Definition: hpack_parser_table.cc:164
grpc_core::UniqueTypeName
Definition: unique_type_name.h:56
grpc_google_default_channel_credentials::create_security_connector
grpc_core::RefCountedPtr< grpc_channel_security_connector > create_security_connector(grpc_core::RefCountedPtr< grpc_call_credentials > call_creds, const char *target, const grpc_channel_args *args, grpc_channel_args **new_args) override
Definition: google_default_credentials.cc:120
destroy_pollset
static void destroy_pollset(void *p, grpc_error_handle)
Definition: google_default_credentials.cc:199
gpr_mu
pthread_mutex_t gpr_mu
Definition: impl/codegen/sync_posix.h:47
metadata_server_detector::is_done
int is_done
Definition: google_default_credentials.cc:99
metadata_server_detector::success
int success
Definition: google_default_credentials.cc:100
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
grpc_pollset_shutdown
void grpc_pollset_shutdown(grpc_pollset *pollset, grpc_closure *closure)
Definition: pollset.cc:37
grpc_core::URI::Create
static absl::StatusOr< URI > Create(std::string scheme, std::string authority, std::string path, std::vector< QueryParam > query_parameter_pairs, std::string fragment)
Definition: uri_parser.cc:289
alloc.h
google::protobuf.internal::Mutex
WrappedMutex Mutex
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/mutex.h:113
metadata_server_detector::pollent
grpc_polling_entity pollent
Definition: google_default_credentials.cc:98
grpc_core::Duration::Seconds
static constexpr Duration Seconds(int64_t seconds)
Definition: src/core/lib/gprpp/time.h:151
grpc_security_constants.h
exec_ctx.h
GRPC_ARG_XDS_CLUSTER_NAME
#define GRPC_ARG_XDS_CLUSTER_NAME
Definition: filters/client_channel/lb_policy/xds/xds_channel_args.h:22
slice_refcount.h
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
grpc_core::ChannelArgs
Definition: channel_args.h:111
ref_counted_ptr.h
grpc_well_known_credentials_path_getter
std::string(* grpc_well_known_credentials_path_getter)(void)
Definition: src/core/lib/security/credentials/credentials.h:85
channel_args.h
g_metadata_server_available
static int g_metadata_server_available
Definition: google_default_credentials.cc:84
api_trace.h
internal
Definition: benchmark/test/output_test_helper.cc:20
grpc_core::internal::grpc_flush_cached_google_default_credentials
void grpc_flush_cached_google_default_credentials(void)
Definition: google_default_credentials.cc:475
grpc_core::Timestamp::InfFuture
static constexpr Timestamp InfFuture()
Definition: src/core/lib/gprpp/time.h:79
google_default_credentials.h
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
uri_parser.h
grpc_core::ExecCtx::Now
Timestamp Now()
Definition: exec_ctx.cc:90
grpc_google_default_channel_credentials::alts_creds_
grpc_core::RefCountedPtr< grpc_channel_credentials > alts_creds_
Definition: google_default_credentials.h:84
grpc_error
Definition: error_internal.h:42
oauth2_credentials.h
grpc_channel_credentials::create_security_connector
virtual grpc_core::RefCountedPtr< grpc_channel_security_connector > create_security_connector(grpc_core::RefCountedPtr< grpc_call_credentials > call_creds, const char *target, const grpc_channel_args *args, grpc_channel_args **new_args)=0
grpc_pollset
Definition: bm_cq_multiple_threads.cc:37
grpc_pollset_destroy
void grpc_pollset_destroy(grpc_pollset *pollset)
Definition: pollset.cc:41
sync.h
grpc_closure
Definition: closure.h:56
grpc_core::UniqueTypeName::Factory
Definition: unique_type_name.h:60
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
grpc_channel_credentials
Definition: src/core/lib/security/credentials/credentials.h:96
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_auth_refresh_token_is_valid
int grpc_auth_refresh_token_is_valid(const grpc_auth_refresh_token *refresh_token)
Returns 1 if the object is valid, 0 otherwise.
Definition: oauth2_credentials.cc:73
sync.h
absl::EndsWith
bool EndsWith(absl::string_view text, absl::string_view suffix) noexcept
Definition: third_party/abseil-cpp/absl/strings/match.h:68
grpc_core::ExecCtx::Get
static ExecCtx * Get()
Definition: exec_ctx.h:205
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
metadata_server_available
static bool metadata_server_available()
Definition: google_default_credentials.cc:387
GRPC_API_TRACE
#define GRPC_API_TRACE(fmt, nargs, args)
Definition: api_trace.h:48
grpc_slice_unref_internal
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:39
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
grpc_http_request
Definition: src/core/lib/http/parser.h:69
jwt_credentials.h
port_platform.h
grpc_auth_json_key
Definition: json_token.h:36


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