#include "src/cpp/client/secure_credentials.h"
#include <string.h>
#include <algorithm>
#include <map>
#include <utility>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_join.h"
#include "absl/types/optional.h"
#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/util/json_util.h"
#include "src/cpp/client/create_channel_internal.h"
#include "src/cpp/common/secure_auth_context.h"
namespace grpc {
SecureChannelCredentials::SecureChannelCredentials(
grpc_channel_credentials* c_creds)
: … { … }
std::shared_ptr<Channel> SecureChannelCredentials::CreateChannelImpl(
const std::string& target, const ChannelArguments& args) { … }
std::shared_ptr<Channel>
SecureChannelCredentials::CreateChannelWithInterceptors(
const std::string& target, const ChannelArguments& args,
std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) { … }
SecureCallCredentials::SecureCallCredentials(grpc_call_credentials* c_creds)
: … { … }
bool SecureCallCredentials::ApplyToCall(grpc_call* call) { … }
namespace internal {
std::shared_ptr<ChannelCredentials> WrapChannelCredentials(
grpc_channel_credentials* creds) { … }
}
namespace {
std::shared_ptr<CallCredentials> WrapCallCredentials(
grpc_call_credentials* creds) { … }
}
std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials() { … }
std::shared_ptr<CallCredentials> ExternalAccountCredentials(
const grpc::string& json_string, const std::vector<grpc::string>& scopes) { … }
std::shared_ptr<ChannelCredentials> SslCredentials(
const SslCredentialsOptions& options) { … }
namespace experimental {
namespace {
void ClearStsCredentialsOptions(StsCredentialsOptions* options) { … }
}
grpc::Status StsCredentialsOptionsFromJson(const std::string& json_string,
StsCredentialsOptions* options) { … }
grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options) { … }
grpc_sts_credentials_options StsCredentialsCppToCoreOptions(
const StsCredentialsOptions& options) { … }
std::shared_ptr<CallCredentials> StsCredentials(
const StsCredentialsOptions& options) { … }
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin,
grpc_security_level min_security_level) { … }
std::shared_ptr<ChannelCredentials> AltsCredentials(
const AltsCredentialsOptions& options) { … }
std::shared_ptr<ChannelCredentials> LocalCredentials(
grpc_local_connect_type type) { … }
std::shared_ptr<ChannelCredentials> TlsCredentials(
const TlsChannelCredentialsOptions& options) { … }
}
std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() { … }
std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
const std::string& json_key, long token_lifetime_seconds) { … }
std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
const std::string& json_refresh_token) { … }
std::shared_ptr<CallCredentials> AccessTokenCredentials(
const std::string& access_token) { … }
std::shared_ptr<CallCredentials> GoogleIAMCredentials(
const std::string& authorization_token,
const std::string& authority_selector) { … }
std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds) { … }
std::shared_ptr<CallCredentials> CompositeCallCredentials(
const std::shared_ptr<CallCredentials>& creds1,
const std::shared_ptr<CallCredentials>& creds2) { … }
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin) { … }
char* MetadataCredentialsPluginWrapper::DebugString(void* wrapper) { … }
void MetadataCredentialsPluginWrapper::Destroy(void* wrapper) { … }
int MetadataCredentialsPluginWrapper::GetMetadata(
void* wrapper, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb, void* user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t* num_creds_md, grpc_status_code* status,
const char** error_details) { … }
namespace {
void UnrefMetadata(const std::vector<grpc_metadata>& md) { … }
}
void MetadataCredentialsPluginWrapper::InvokePlugin(
grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb,
void* user_data, grpc_metadata creds_md[4], size_t* num_creds_md,
grpc_status_code* status_code, const char** error_details) { … }
MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(
std::unique_ptr<MetadataCredentialsPlugin> plugin)
: … { … }
}