You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ptupitsyn (via GitHub)" <gi...@apache.org> on 2023/04/18 15:42:37 UTC

[GitHub] [ignite-3] ptupitsyn commented on a diff in pull request #1953: IGNITE-19101 Basic authentication for C++ client

ptupitsyn commented on code in PR #1953:
URL: https://github.com/apache/ignite-3/pull/1953#discussion_r1170229796


##########
modules/platforms/cpp/ignite/client/basic_authenticator.h:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "ignite/client/ignite_client_authenticator.h"
+
+#include <string>
+
+namespace ignite {
+
+/**
+ * Basic authenticator with username and password.
+ *
+ * Credentials are sent to the server in plain text, unless SSL/TLS is enabled.
+ */
+class basic_authenticator : public ignite_client_authenticator {
+public:
+    /** Type constant. */
+    inline static const std::string TYPE{"basic"};
+
+    // Default
+    basic_authenticator() = default;
+
+    /**
+     * Get authenticator type.
+     *
+     * @return Authenticator type.
+     */
+    [[nodiscard]] const std::string& get_type() const override {
+        return TYPE;
+    }
+
+    /**
+     * Get identity.
+     *
+     * @return Identity.
+     */
+    [[nodiscard]] const std::string& get_identity() const override {
+        return m_identity;
+    }
+
+    /**
+     * Set identity.
+     *
+     * @param identity Identity.
+     */
+    void set_identity(std::string identity) {

Review Comment:
   In my opinion, `identity` and `secret` are generic terms, common for all authenticators.
   
   Basic authenticator works with `username` and `password` and should expose those properties to the user. Future use cases may include a `CertificateAuthenticator`, for example, where only `certificate` property can be set by the user. And so on.
   
   See https://github.com/apache/ignite-3/blob/f6e5179214485c0826bdef6b6c745e25860671fa/modules/client/src/main/java/org/apache/ignite/client/BasicAuthenticator.java, https://github.com/apache/ignite-3/blob/af3fdd9485e2caa135eca251d3007f9ca93ad992/modules/platforms/dotnet/Apache.Ignite/BasicAuthenticator.cs



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org