jduo commented on a change in pull request #8325:
URL: https://github.com/apache/arrow/pull/8325#discussion_r502531900



##########
File path: cpp/src/arrow/flight/client.cc
##########
@@ -845,18 +878,48 @@ class FlightClient::FlightClientImpl {
     if (scheme == kSchemeGrpc || scheme == kSchemeGrpcTcp || scheme == 
kSchemeGrpcTls) {
       grpc_uri << location.uri_->host() << ":" << location.uri_->port_text();
 
-      if (scheme == "grpc+tls") {
-        grpc::SslCredentialsOptions ssl_options;
-        if (!options.tls_root_certs.empty()) {
-          ssl_options.pem_root_certs = options.tls_root_certs;
-        }
-        if (!options.cert_chain.empty()) {
-          ssl_options.pem_cert_chain = options.cert_chain;
-        }
-        if (!options.private_key.empty()) {
-          ssl_options.pem_private_key = options.private_key;
+      if (scheme == kSchemeGrpcTls) {
+        if (options.disable_server_verification) {
+#if !defined(GRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS)
+          return Status::NotImplemented(
+              "Using encryption with server verification is unsupported.");
+#else
+          namespace ge = GRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS;
+
+          // A callback to supply to TlsCredentialsOptions that accepts any 
server
+          // arguments.
+          struct NoOpTlsAuthorizationCheck
+              : public ge::TlsServerAuthorizationCheckInterface {
+            int Schedule(ge::TlsServerAuthorizationCheckArg* arg) override {
+              arg->set_success(1);
+              arg->set_status(GRPC_STATUS_OK);
+              return 0;
+            }
+          };
+
+          noop_auth_check_ = 
std::make_shared<ge::TlsServerAuthorizationCheckConfig>(
+              std::make_shared<NoOpTlsAuthorizationCheck>());
+          auto materials_config = 
std::make_shared<ge::TlsKeyMaterialsConfig>();
+          materials_config->set_pem_root_certs(BLANK_ROOT_PEM);
+          ge::TlsCredentialsOptions tls_options(

Review comment:
       Yes, but they aren't interchangeable. One works against TlsCredentials 
and one works against SslCredentials. TlsCredentials is a newer, currently 
experimental API that can do everything SslCredentials can do and more, such as 
do certificate reloading and supplying custom callbacks for cert verification.

##########
File path: cpp/src/arrow/flight/client.cc
##########
@@ -845,18 +878,48 @@ class FlightClient::FlightClientImpl {
     if (scheme == kSchemeGrpc || scheme == kSchemeGrpcTcp || scheme == 
kSchemeGrpcTls) {
       grpc_uri << location.uri_->host() << ":" << location.uri_->port_text();
 
-      if (scheme == "grpc+tls") {
-        grpc::SslCredentialsOptions ssl_options;
-        if (!options.tls_root_certs.empty()) {
-          ssl_options.pem_root_certs = options.tls_root_certs;
-        }
-        if (!options.cert_chain.empty()) {
-          ssl_options.pem_cert_chain = options.cert_chain;
-        }
-        if (!options.private_key.empty()) {
-          ssl_options.pem_private_key = options.private_key;
+      if (scheme == kSchemeGrpcTls) {
+        if (options.disable_server_verification) {
+#if !defined(GRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS)
+          return Status::NotImplemented(
+              "Using encryption with server verification is unsupported.");

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to