diff options
author | molotkov-and <molotkov-and@ydb.tech> | 2022-11-18 12:50:29 +0300 |
---|---|---|
committer | molotkov-and <molotkov-and@ydb.tech> | 2022-11-18 12:50:29 +0300 |
commit | a45acb262bfb6f7d06d70f9f04a763d61e811966 (patch) | |
tree | 2e4eacaa4f1ecfba0bea894abf4888b7718712ad /library/cpp/grpc/client/grpc_common.h | |
parent | d563b5b3a6578243440353c5cfafdb56cc05fff3 (diff) | |
download | ydb-a45acb262bfb6f7d06d70f9f04a763d61e811966.tar.gz |
Authorization of registration node
Diffstat (limited to 'library/cpp/grpc/client/grpc_common.h')
-rw-r--r-- | library/cpp/grpc/client/grpc_common.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/cpp/grpc/client/grpc_common.h b/library/cpp/grpc/client/grpc_common.h index ffcdafe045..d19e42d4ac 100644 --- a/library/cpp/grpc/client/grpc_common.h +++ b/library/cpp/grpc/client/grpc_common.h @@ -19,7 +19,7 @@ struct TGRpcClientConfig { ui64 MaxOutboundMessageSize = 0; // overrides MaxMessageSize for outgoing requests ui32 MaxInFlight = 0; bool EnableSsl = false; - TString SslCaCert; //Implicitly enables Ssl if not empty + grpc::SslCredentialsOptions SslCredentials; grpc_compression_algorithm CompressionAlgoritm = GRPC_COMPRESS_NONE; ui64 MemQuota = 0; std::unordered_map<TString, TString> StringChannelParams; @@ -34,14 +34,14 @@ struct TGRpcClientConfig { TGRpcClientConfig& operator=(TGRpcClientConfig&&) = default; TGRpcClientConfig(const TString& locator, TDuration timeout = TDuration::Max(), - ui64 maxMessageSize = DEFAULT_GRPC_MESSAGE_SIZE_LIMIT, ui32 maxInFlight = 0, TString caCert = "", - grpc_compression_algorithm compressionAlgorithm = GRPC_COMPRESS_NONE, bool enableSsl = false) + ui64 maxMessageSize = DEFAULT_GRPC_MESSAGE_SIZE_LIMIT, ui32 maxInFlight = 0, const TString& caCert = "", const TString& clientCert = "", + const TString& clientPrivateKey = "", grpc_compression_algorithm compressionAlgorithm = GRPC_COMPRESS_NONE, bool enableSsl = false) : Locator(locator) , Timeout(timeout) , MaxMessageSize(maxMessageSize) , MaxInFlight(maxInFlight) , EnableSsl(enableSsl) - , SslCaCert(caCert) + , SslCredentials{.pem_root_certs = caCert, .pem_private_key = clientPrivateKey, .pem_cert_chain = clientCert} , CompressionAlgoritm(compressionAlgorithm) {} }; @@ -74,8 +74,8 @@ inline std::shared_ptr<grpc::ChannelInterface> CreateChannelInterface(const TGRp if (!config.SslTargetNameOverride.empty()) { args.SetSslTargetNameOverride(config.SslTargetNameOverride); } - if (config.EnableSsl || config.SslCaCert) { - return grpc::CreateCustomChannel(config.Locator, grpc::SslCredentials(grpc::SslCredentialsOptions{config.SslCaCert, "", ""}), args); + if (config.EnableSsl || config.SslCredentials.pem_root_certs) { + return grpc::CreateCustomChannel(config.Locator, grpc::SslCredentials(config.SslCredentials), args); } else { return grpc::CreateCustomChannel(config.Locator, grpc::InsecureChannelCredentials(), args); } |