leekeiabstraction commented on code in PR #375:
URL: https://github.com/apache/fluss-rust/pull/375#discussion_r2855498040


##########
website/docs/user-guide/python/example/configuration.md:
##########
@@ -32,6 +32,28 @@ with await fluss.FlussConnection.create(config) as conn:
 | `scanner.remote-log.prefetch-num` | Number of remote log segments to 
prefetch                                             | `4`                |
 | `remote-file.download-thread-num` | Number of threads for remote log 
downloads                                            | `3`                |
 | `scanner.log.max-poll-records`    | Max records returned in a single poll()  
                                             | `500`              |
+| `client.connect-timeout`          | TCP connect timeout in milliseconds      
                                             | `120000`           |
+| `client.security.protocol`        | `PLAINTEXT` (default) or `sasl` for SASL 
auth                                        | `PLAINTEXT`        |
+| `client.security.sasl.mechanism`  | SASL mechanism (only `PLAIN` is 
supported)                                            | `PLAIN`            |
+| `client.security.sasl.username`   | SASL username (required when protocol is 
`sasl`)                                      | (empty)            |
+| `client.security.sasl.password`   | SASL password (required when protocol is 
`sasl`)                                      | (empty)            |

Review Comment:
   Thanks for the consistent config keys! I'm starting to think that we should 
make the others consistent as well. E.g. `writer.acks` -> `client.writer.acks`



##########
bindings/cpp/test/test_sasl_auth.cpp:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include "test_utils.h"
+
+class SaslAuthTest : public ::testing::Test {
+   protected:
+    const std::string& sasl_servers() {
+        return 
fluss_test::FlussTestEnvironment::Instance()->GetSaslBootstrapServers();
+    }
+};
+
+TEST_F(SaslAuthTest, SaslConnectWithValidCredentials) {
+    fluss::Configuration config;
+    config.bootstrap_servers = sasl_servers();
+    config.security_protocol = "sasl";
+    config.security_sasl_mechanism = "PLAIN";
+    config.security_sasl_username = "admin";

Review Comment:
   nit: Missing second user verification



##########
bindings/python/test/test_sasl_auth.py:
##########
@@ -0,0 +1,78 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Integration tests for SASL/PLAIN authentication.
+
+Mirrors the Rust integration tests in 
crates/fluss/tests/integration/sasl_auth.rs.
+"""
+
+import pytest
+
+import fluss
+
+
+async def test_sasl_connect_with_valid_credentials(sasl_bootstrap_servers):
+    """Verify that a client with correct SASL credentials can connect and 
perform operations."""
+    config = fluss.Config({
+        "bootstrap.servers": sasl_bootstrap_servers,
+        "client.security.protocol": "sasl",
+        "client.security.sasl.mechanism": "PLAIN",
+        "client.security.sasl.username": "admin",

Review Comment:
   nit: Missing second user verification



##########
crates/fluss/tests/integration/sasl_auth.rs:
##########
@@ -0,0 +1,124 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#[cfg(test)]
+mod sasl_auth_test {

Review Comment:
   Should we also test sasl configured client connecting to non-configured 
server?
   
   What happens currently with Java client in such scenario and should we make 
it consistent on Rust/bindings side as well?



##########
bindings/cpp/test/test_utils.h:
##########
@@ -126,22 +124,32 @@ class FlussTestCluster {
         // Wait for ZooKeeper to be ready before starting Fluss servers
         std::this_thread::sleep_for(std::chrono::seconds(5));
 
-        // Start Coordinator Server
+        // Start Coordinator Server (dual listeners: CLIENT=SASL on 9123, 
PLAIN_CLIENT=plaintext on
+        // 9223)
+        std::string sasl_jaas =
+            "org.apache.fluss.security.auth.sasl.plain.PlainLoginModule 
required"
+            " user_admin=\"admin-secret\" user_alice=\"alice-secret\";";
         std::string coord_props =
-            "zookeeper.address: " + std::string(kZookeeperName) + ":2181\\n"
-            "bind.listeners: INTERNAL://" + std::string(kCoordinatorName) + 
":0, CLIENT://" +
-            std::string(kCoordinatorName) + ":9123\\n"
-            "advertised.listeners: CLIENT://localhost:9123\\n"
+            "zookeeper.address: " + std::string(kZookeeperName) +
+            ":2181\\n"
+            "bind.listeners: INTERNAL://" +

Review Comment:
   nit: maybe we can improve the readability of these



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