Go to the documentation of this file.
25 #include "absl/flags/declare.h"
26 #include "absl/flags/flag.h"
27 #include "absl/strings/match.h"
59 if (json_key.empty()) {
60 std::ifstream json_key_file(
absl::GetFlag(FLAGS_service_account_key_file));
61 std::stringstream key_stream;
62 key_stream << json_key_file.rdbuf();
63 json_key = key_stream.str();
77 std::string access_token(token +
sizeof(
"Bearer ") - 1);
88 std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
89 interceptor_creators) {
95 std::shared_ptr<CallCredentials> creds;
96 if (test_case ==
"compute_engine_creds") {
98 "google_default_credentials"
101 }
else if (test_case ==
"jwt_token_creds") {
105 "google_default_credentials"
108 token_lifetime.count());
109 }
else if (test_case ==
"oauth2_auth_token") {
111 "google_default_credentials"
114 }
else if (test_case ==
"pick_first_unary") {
133 if (interceptor_creators.empty()) {
165 for (
const auto& entry : *initial_metadata) {
180 status->error_message().c_str());
#define GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION
std::chrono::duration< std::int_fast64_t > seconds
void StrAppend(std::string *dest, const AlphaNum &a)
gpr_free(creds_file_name)
@ POST_RECV_INITIAL_METADATA
The following two are for all clients and servers.
virtual std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvTrailingMetadata()=0
virtual bool QueryInterceptionHookPoint(InterceptionHookPoints type)=0
std::string GetOauth2AccessToken()
void UpdateActions(std::unordered_map< std::string, std::function< bool()>> *)
std::shared_ptr< CallCredentials > ServiceAccountJWTAccessCredentials(const grpc::string &json_key, long token_lifetime_seconds=kMaxAuthTokenLifetimeSecs)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
std::string custom_credentials_type("INSECURE_CREDENTIALS")
ABSL_DECLARE_FLAG(bool, use_alts)
ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag< T > &flag)
std::string GetServiceAccountJsonKey()
std::shared_ptr< Channel > CreateTestChannel(const std::string &server, const std::string &cred_type, const std::string &override_hostname, bool use_prod_roots, const std::shared_ptr< CallCredentials > &creds, const ChannelArguments &args)
char * grpc_base64_encode(const void *vdata, size_t data_size, int url_safe, int multiline)
static char * key_str(grpc_error_strs which)
virtual std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvInitialMetadata()=0
grpc_call_credentials * GetRawCreds()
std::shared_ptr< Channel > CreateChannelForTestCase(const std::string &test_case, std::vector< std::unique_ptr< experimental::ClientInterceptorFactoryInterface >> interceptor_creators)
static const char prefix[]
void SetInt(const std::string &key, int value)
Set an integer argument value under key.
std::shared_ptr< CallCredentials > AccessTokenCredentials(const grpc::string &access_token)
static bool to_string(zval *from)
std::shared_ptr< CallCredentials > GoogleComputeEngineCredentials()
bool EndsWith(absl::string_view text, absl::string_view suffix) noexcept
virtual Status * GetRecvStatus()=0
static void log_metadata_entry(const std::string &prefix, const grpc::string_ref &key, const grpc::string_ref &value)
char * grpc_test_fetch_oauth2_token_with_credentials(grpc_call_credentials *creds)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:55