Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
David Garcia Quintas | 5a94623 | 2016-01-27 19:22:14 -0800 | [diff] [blame] | 3 | * Copyright 2015-2016, Google Inc. |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
yang-g | 8c2be9f | 2015-08-19 16:28:09 -0700 | [diff] [blame] | 34 | #include <grpc++/channel.h> |
yang-g | e71a6b0 | 2015-08-10 15:48:34 -0700 | [diff] [blame] | 35 | #include <grpc++/impl/grpc_library.h> |
yang-g | 9e2f90c | 2015-08-21 15:35:03 -0700 | [diff] [blame] | 36 | #include <grpc++/support/channel_arguments.h> |
yang-g | d88e1d8 | 2015-12-02 13:23:33 -0800 | [diff] [blame] | 37 | #include <grpc/support/log.h> |
yang-g | c317f07 | 2015-08-20 12:18:08 -0700 | [diff] [blame] | 38 | #include "src/cpp/client/create_channel_internal.h" |
Julien Boeuf | 1d2240c | 2015-04-09 21:07:56 -0700 | [diff] [blame] | 39 | #include "src/cpp/client/secure_credentials.h" |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 40 | #include "src/cpp/common/secure_auth_context.h" |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 41 | |
| 42 | namespace grpc { |
| 43 | |
David Garcia Quintas | d79ef3a | 2016-01-28 00:21:27 -0800 | [diff] [blame] | 44 | static internal::GrpcLibraryInitializer g_gli_initializer; |
David Garcia Quintas | e1300de | 2016-01-27 18:41:26 -0800 | [diff] [blame] | 45 | SecureChannelCredentials::SecureChannelCredentials( |
| 46 | grpc_channel_credentials* c_creds) |
| 47 | : c_creds_(c_creds) { |
David Garcia Quintas | d79ef3a | 2016-01-28 00:21:27 -0800 | [diff] [blame] | 48 | g_gli_initializer.summon(); |
David Garcia Quintas | e1300de | 2016-01-27 18:41:26 -0800 | [diff] [blame] | 49 | } |
| 50 | |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 51 | std::shared_ptr<grpc::Channel> SecureChannelCredentials::CreateChannel( |
Julien Boeuf | 1d2240c | 2015-04-09 21:07:56 -0700 | [diff] [blame] | 52 | const string& target, const grpc::ChannelArguments& args) { |
| 53 | grpc_channel_args channel_args; |
| 54 | args.SetChannelArgs(&channel_args); |
yang-g | c317f07 | 2015-08-20 12:18:08 -0700 | [diff] [blame] | 55 | return CreateChannelInternal( |
yang-g | d556da9 | 2015-07-31 15:59:04 -0700 | [diff] [blame] | 56 | args.GetSslTargetNameOverride(), |
Julien Boeuf | c5b570f | 2015-08-25 17:47:55 -0700 | [diff] [blame] | 57 | grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args, |
| 58 | nullptr)); |
Julien Boeuf | 1d2240c | 2015-04-09 21:07:56 -0700 | [diff] [blame] | 59 | } |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 60 | |
David Garcia Quintas | e1300de | 2016-01-27 18:41:26 -0800 | [diff] [blame] | 61 | SecureCallCredentials::SecureCallCredentials(grpc_call_credentials* c_creds) |
| 62 | : c_creds_(c_creds) { |
David Garcia Quintas | 146070d | 2016-03-18 15:53:28 -0700 | [diff] [blame] | 63 | g_gli_initializer.summon(); |
David Garcia Quintas | e1300de | 2016-01-27 18:41:26 -0800 | [diff] [blame] | 64 | } |
| 65 | |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 66 | bool SecureCallCredentials::ApplyToCall(grpc_call* call) { |
Yang Gao | a893892 | 2015-05-14 11:51:07 -0700 | [diff] [blame] | 67 | return grpc_call_set_credentials(call, c_creds_) == GRPC_CALL_OK; |
| 68 | } |
| 69 | |
Craig Tiller | ad9d0c4 | 2015-02-23 10:53:01 -0800 | [diff] [blame] | 70 | namespace { |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 71 | std::shared_ptr<ChannelCredentials> WrapChannelCredentials( |
| 72 | grpc_channel_credentials* creds) { |
| 73 | return creds == nullptr ? nullptr : std::shared_ptr<ChannelCredentials>( |
| 74 | new SecureChannelCredentials(creds)); |
| 75 | } |
| 76 | |
| 77 | std::shared_ptr<CallCredentials> WrapCallCredentials( |
| 78 | grpc_call_credentials* creds) { |
| 79 | return creds == nullptr ? nullptr : std::shared_ptr<CallCredentials>( |
| 80 | new SecureCallCredentials(creds)); |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 81 | } |
| 82 | } // namespace |
| 83 | |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 84 | std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials() { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 85 | GrpcLibraryCodegen init; // To call grpc_init(). |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 86 | return WrapChannelCredentials(grpc_google_default_credentials_create()); |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | // Builds SSL Credentials given SSL specific options |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 90 | std::shared_ptr<ChannelCredentials> SslCredentials( |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 91 | const SslCredentialsOptions& options) { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 92 | GrpcLibraryCodegen init; // To call grpc_init(). |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 93 | grpc_ssl_pem_key_cert_pair pem_key_cert_pair = { |
| 94 | options.pem_private_key.c_str(), options.pem_cert_chain.c_str()}; |
| 95 | |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 96 | grpc_channel_credentials* c_creds = grpc_ssl_credentials_create( |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 97 | options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(), |
Julien Boeuf | c5b570f | 2015-08-25 17:47:55 -0700 | [diff] [blame] | 98 | options.pem_private_key.empty() ? nullptr : &pem_key_cert_pair, nullptr); |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 99 | return WrapChannelCredentials(c_creds); |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | // Builds credentials for use when running in GCE |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 103 | std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 104 | GrpcLibraryCodegen init; // To call grpc_init(). |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 105 | return WrapCallCredentials( |
Julien Boeuf | 510a920 | 2015-08-25 21:51:07 -0700 | [diff] [blame] | 106 | grpc_google_compute_engine_credentials_create(nullptr)); |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 107 | } |
| 108 | |
Yang Gao | 0535da3 | 2015-03-11 14:51:03 -0700 | [diff] [blame] | 109 | // Builds JWT credentials. |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 110 | std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials( |
Julien Boeuf | fe4c3f4 | 2015-07-22 16:20:13 -0700 | [diff] [blame] | 111 | const grpc::string& json_key, long token_lifetime_seconds) { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 112 | GrpcLibraryCodegen init; // To call grpc_init(). |
Nicolas "Pixel" Noble | e24dde5 | 2015-04-24 00:43:09 +0200 | [diff] [blame] | 113 | if (token_lifetime_seconds <= 0) { |
Yang Gao | 94e296c | 2015-03-13 16:06:56 -0700 | [diff] [blame] | 114 | gpr_log(GPR_ERROR, |
| 115 | "Trying to create JWTCredentials with non-positive lifetime"); |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 116 | return WrapCallCredentials(nullptr); |
Yang Gao | 05e3eef | 2015-03-12 23:41:46 -0700 | [diff] [blame] | 117 | } |
Craig Tiller | 677c50c | 2015-07-13 10:49:06 -0700 | [diff] [blame] | 118 | gpr_timespec lifetime = |
| 119 | gpr_time_from_seconds(token_lifetime_seconds, GPR_TIMESPAN); |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 120 | return WrapCallCredentials(grpc_service_account_jwt_access_credentials_create( |
Julien Boeuf | c5b570f | 2015-08-25 17:47:55 -0700 | [diff] [blame] | 121 | json_key.c_str(), lifetime, nullptr)); |
Yang Gao | 0535da3 | 2015-03-11 14:51:03 -0700 | [diff] [blame] | 122 | } |
| 123 | |
Yang Gao | 5ebd6c7 | 2015-03-17 16:22:32 -0700 | [diff] [blame] | 124 | // Builds refresh token credentials. |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 125 | std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials( |
Yang Gao | 5ebd6c7 | 2015-03-17 16:22:32 -0700 | [diff] [blame] | 126 | const grpc::string& json_refresh_token) { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 127 | GrpcLibraryCodegen init; // To call grpc_init(). |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 128 | return WrapCallCredentials(grpc_google_refresh_token_credentials_create( |
Julien Boeuf | c5b570f | 2015-08-25 17:47:55 -0700 | [diff] [blame] | 129 | json_refresh_token.c_str(), nullptr)); |
Yang Gao | 5ebd6c7 | 2015-03-17 16:22:32 -0700 | [diff] [blame] | 130 | } |
| 131 | |
Julien Boeuf | 2805be1 | 2015-07-01 02:47:18 -0700 | [diff] [blame] | 132 | // Builds access token credentials. |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 133 | std::shared_ptr<CallCredentials> AccessTokenCredentials( |
Julien Boeuf | 2805be1 | 2015-07-01 02:47:18 -0700 | [diff] [blame] | 134 | const grpc::string& access_token) { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 135 | GrpcLibraryCodegen init; // To call grpc_init(). |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 136 | return WrapCallCredentials( |
Julien Boeuf | c5b570f | 2015-08-25 17:47:55 -0700 | [diff] [blame] | 137 | grpc_access_token_credentials_create(access_token.c_str(), nullptr)); |
Julien Boeuf | 2805be1 | 2015-07-01 02:47:18 -0700 | [diff] [blame] | 138 | } |
| 139 | |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 140 | // Builds IAM credentials. |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 141 | std::shared_ptr<CallCredentials> GoogleIAMCredentials( |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 142 | const grpc::string& authorization_token, |
| 143 | const grpc::string& authority_selector) { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 144 | GrpcLibraryCodegen init; // To call grpc_init(). |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 145 | return WrapCallCredentials(grpc_google_iam_credentials_create( |
Julien Boeuf | c5b570f | 2015-08-25 17:47:55 -0700 | [diff] [blame] | 146 | authorization_token.c_str(), authority_selector.c_str(), nullptr)); |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 147 | } |
| 148 | |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 149 | // Combines one channel credentials and one call credentials into a channel |
| 150 | // composite credentials. |
| 151 | std::shared_ptr<ChannelCredentials> CompositeChannelCredentials( |
| 152 | const std::shared_ptr<ChannelCredentials>& channel_creds, |
| 153 | const std::shared_ptr<CallCredentials>& call_creds) { |
| 154 | // Note that we are not saving shared_ptrs to the two credentials passed in |
| 155 | // here. This is OK because the underlying C objects (i.e., channel_creds and |
| 156 | // call_creds) into grpc_composite_credentials_create will see their refcounts |
| 157 | // incremented. |
| 158 | SecureChannelCredentials* s_channel_creds = |
| 159 | channel_creds->AsSecureCredentials(); |
| 160 | SecureCallCredentials* s_call_creds = call_creds->AsSecureCredentials(); |
| 161 | if (s_channel_creds && s_call_creds) { |
| 162 | return WrapChannelCredentials(grpc_composite_channel_credentials_create( |
| 163 | s_channel_creds->GetRawCreds(), s_call_creds->GetRawCreds(), nullptr)); |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 164 | } |
| 165 | return nullptr; |
| 166 | } |
| 167 | |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 168 | void MetadataCredentialsPluginWrapper::Destroy(void* wrapper) { |
| 169 | if (wrapper == nullptr) return; |
| 170 | MetadataCredentialsPluginWrapper* w = |
| 171 | reinterpret_cast<MetadataCredentialsPluginWrapper*>(wrapper); |
| 172 | delete w; |
| 173 | } |
| 174 | |
| 175 | void MetadataCredentialsPluginWrapper::GetMetadata( |
Julien Boeuf | 3c957e6 | 2015-11-18 21:33:58 -0800 | [diff] [blame] | 176 | void* wrapper, grpc_auth_metadata_context context, |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 177 | grpc_credentials_plugin_metadata_cb cb, void* user_data) { |
Vijay Pai | e547bdf | 2015-09-29 23:29:38 +0000 | [diff] [blame] | 178 | GPR_ASSERT(wrapper); |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 179 | MetadataCredentialsPluginWrapper* w = |
| 180 | reinterpret_cast<MetadataCredentialsPluginWrapper*>(wrapper); |
Vijay Pai | e57abcf | 2015-09-29 22:55:34 +0000 | [diff] [blame] | 181 | if (!w->plugin_) { |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 182 | cb(user_data, NULL, 0, GRPC_STATUS_OK, NULL); |
| 183 | return; |
| 184 | } |
| 185 | if (w->plugin_->IsBlocking()) { |
| 186 | w->thread_pool_->Add( |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 187 | std::bind(&MetadataCredentialsPluginWrapper::InvokePlugin, w, context, |
| 188 | cb, user_data)); |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 189 | } else { |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 190 | w->InvokePlugin(context, cb, user_data); |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 191 | } |
| 192 | } |
| 193 | |
| 194 | void MetadataCredentialsPluginWrapper::InvokePlugin( |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 195 | grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb, |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 196 | void* user_data) { |
Julien Boeuf | 8b0b6f4 | 2015-09-22 13:31:16 -0700 | [diff] [blame] | 197 | std::multimap<grpc::string, grpc::string> metadata; |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 198 | |
| 199 | // const_cast is safe since the SecureAuthContext does not take owndership and |
| 200 | // the object is passed as a const ref to plugin_->GetMetadata. |
| 201 | SecureAuthContext cpp_channel_auth_context( |
| 202 | const_cast<grpc_auth_context*>(context.channel_auth_context), false); |
| 203 | |
| 204 | Status status = plugin_->GetMetadata(context.service_url, context.method_name, |
| 205 | cpp_channel_auth_context, &metadata); |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 206 | std::vector<grpc_metadata> md; |
| 207 | for (auto it = metadata.begin(); it != metadata.end(); ++it) { |
Vijay Pai | e57abcf | 2015-09-29 22:55:34 +0000 | [diff] [blame] | 208 | grpc_metadata md_entry; |
| 209 | md_entry.key = it->first.c_str(); |
| 210 | md_entry.value = it->second.data(); |
| 211 | md_entry.value_length = it->second.size(); |
| 212 | md_entry.flags = 0; |
| 213 | md.push_back(md_entry); |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 214 | } |
Julien Boeuf | 14929d4 | 2015-09-21 20:57:26 -0700 | [diff] [blame] | 215 | cb(user_data, md.empty() ? nullptr : &md[0], md.size(), |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 216 | static_cast<grpc_status_code>(status.error_code()), |
| 217 | status.error_message().c_str()); |
| 218 | } |
| 219 | |
| 220 | MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper( |
| 221 | std::unique_ptr<MetadataCredentialsPlugin> plugin) |
| 222 | : thread_pool_(CreateDefaultThreadPool()), plugin_(std::move(plugin)) {} |
| 223 | |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 224 | std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin( |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 225 | std::unique_ptr<MetadataCredentialsPlugin> plugin) { |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 226 | GrpcLibraryCodegen init; // To call grpc_init(). |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 227 | const char* type = plugin->GetType(); |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 228 | MetadataCredentialsPluginWrapper* wrapper = |
| 229 | new MetadataCredentialsPluginWrapper(std::move(plugin)); |
| 230 | grpc_metadata_credentials_plugin c_plugin = { |
| 231 | MetadataCredentialsPluginWrapper::GetMetadata, |
Julien Boeuf | 114f394 | 2015-11-19 21:45:52 -0800 | [diff] [blame] | 232 | MetadataCredentialsPluginWrapper::Destroy, wrapper, type}; |
Julien Boeuf | 54a902e | 2015-10-12 13:26:21 -0700 | [diff] [blame] | 233 | return WrapCallCredentials( |
Julien Boeuf | 2d04118 | 2015-08-31 20:30:09 -0700 | [diff] [blame] | 234 | grpc_metadata_credentials_create_from_plugin(c_plugin, nullptr)); |
| 235 | } |
| 236 | |
Craig Tiller | 47c83fd | 2015-02-21 22:45:35 -0800 | [diff] [blame] | 237 | } // namespace grpc |