aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client/secure_credentials.cc
diff options
context:
space:
mode:
authorGravatar kpayson64 <kpayson@google.com>2018-05-11 12:20:11 -0700
committerGravatar kpayson64 <kpayson@google.com>2018-05-11 12:20:11 -0700
commit4fad281ce8affe27fb7428f264d2c3b9dfc45f2f (patch)
treeca96c9efd69afec56aa2e5fe072a9f758247d0a3 /src/cpp/client/secure_credentials.cc
parentec445cc2bb270ed4acb1c710c3533fca14a50019 (diff)
parent61fdb46ac456027c79841949272ec540f66d2317 (diff)
Merge remote-tracking branch 'upstream/master' into fork_exec_ctx_check
Diffstat (limited to 'src/cpp/client/secure_credentials.cc')
-rw-r--r--src/cpp/client/secure_credentials.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc
index 19d67c2e06..00245b397d 100644
--- a/src/cpp/client/secure_credentials.cc
+++ b/src/cpp/client/secure_credentials.cc
@@ -87,6 +87,27 @@ std::shared_ptr<ChannelCredentials> SslCredentials(
return WrapChannelCredentials(c_creds);
}
+namespace experimental {
+
+// Builds ALTS Credentials given ALTS specific options
+std::shared_ptr<ChannelCredentials> AltsCredentials(
+ const AltsCredentialsOptions& options) {
+ GrpcLibraryCodegen init; // To call grpc_init().
+ grpc_alts_credentials_options* c_options =
+ grpc_alts_credentials_client_options_create();
+ for (auto service_account = options.target_service_accounts.begin();
+ service_account != options.target_service_accounts.end();
+ service_account++) {
+ grpc_alts_credentials_client_options_add_target_service_account(
+ c_options, service_account->c_str());
+ }
+ grpc_channel_credentials* c_creds = grpc_alts_credentials_create(c_options);
+ grpc_alts_credentials_options_destroy(c_options);
+ return WrapChannelCredentials(c_creds);
+}
+
+} // namespace experimental
+
// Builds credentials for use when running in GCE
std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() {
GrpcLibraryCodegen init; // To call grpc_init().