lordgamez commented on code in PR #1882:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1882#discussion_r1853960462


##########
extensions/couchbase/controllerservices/CouchbaseClusterService.cpp:
##########
@@ -26,6 +26,50 @@
 
 namespace org::apache::nifi::minifi::couchbase {
 
+CouchbaseClient::CouchbaseClient(std::string connection_string, std::string 
username, std::string password, minifi::controllers::SSLContextService* 
ssl_context_service,
+  const std::shared_ptr<core::logging::Logger>& logger)
+    : connection_string_(std::move(connection_string)), logger_(logger), 
cluster_options_(buildClusterOptions(std::move(username), std::move(password), 
ssl_context_service)) {
+}
+
+::couchbase::cluster_options CouchbaseClient::buildClusterOptions(std::string 
username, std::string password, minifi::controllers::SSLContextService* 
ssl_context_service) {
+  if (username.empty() && (!ssl_context_service || (ssl_context_service && 
ssl_context_service->getCertificateFile().empty()))) {
+    throw minifi::Exception(ExceptionType::PROCESS_SCHEDULE_EXCEPTION, 
"Neither username and password nor SSLContextService is provided for Couchbase 
authentication");
+  }
+
+  if (!username.empty() && ssl_context_service && 
!ssl_context_service->getCertificateFile().empty()) {
+    throw minifi::Exception(ExceptionType::PROCESS_SCHEDULE_EXCEPTION, 
"Username and password authentication or mTLS authentication using certificate 
defined in SSLConextService "

Review Comment:
   Good catch, updated in 
https://github.com/apache/nifi-minifi-cpp/pull/1882/commits/0abf6fbc2bc0d13c0c28fa40a01da816911a12b8



##########
extensions/couchbase/controllerservices/CouchbaseClusterService.cpp:
##########
@@ -159,11 +202,24 @@ void CouchbaseClusterService::onEnable() {
   getProperty(UserName, username);
   std::string password;
   getProperty(UserPassword, password);
-  if (connection_string.empty() || username.empty() || password.empty()) {
-    throw minifi::Exception(ExceptionType::PROCESS_SCHEDULE_EXCEPTION, 
"Missing connection string, username or password");
+  if (connection_string.empty()) {
+    throw minifi::Exception(ExceptionType::PROCESS_SCHEDULE_EXCEPTION, 
"Missing connection string");
+  }
+
+  if ((username.empty() || password.empty()) && linked_services_.empty()) {
+    throw minifi::Exception(ExceptionType::PROCESS_SCHEDULE_EXCEPTION, 
"Missing username and password or SSLConextService as a linked service");

Review Comment:
   Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/1882/commits/0abf6fbc2bc0d13c0c28fa40a01da816911a12b8



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to