]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3907] NETCONF: Turn authentication.clients into a string just like hooks-libraries...
authorAndrei Pavel <andrei@isc.org>
Fri, 20 Jun 2025 13:06:31 +0000 (16:06 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 20 Jun 2025 13:29:10 +0000 (13:29 +0000)
doc/examples/kea4/comments.json
doc/examples/kea6/comments.json
src/lib/yang/translator_control_socket.cc
src/share/yang/modules/hashes/kea-types@2025-06-25.hash
src/share/yang/modules/kea-types@2025-06-25.yang

index 0762fd2298b0e4e20a4123822e7b12c3d76b0496..3eab9dff0b8d14ea36112762a52759a3588918bf 100644 (file)
@@ -70,7 +70,6 @@
                "type": "basic",
                // In basic HTTP authentication clients
                "clients": [ {
-                   "comment": "admin is authorized",
                    "user": "admin",
                    "password": "1234"
                } ]
index fdeb352bb815b1a93baabb43029a6339b4f47889..0aa85d18722a09733bacec64325adb80fc326f7e 100644 (file)
@@ -70,7 +70,6 @@
                "type": "basic",
                // In basic HTTP authentication clients
                "clients": [ {
-                   "comment": "admin is authorized",
                    "user": "admin",
                    "password": "1234"
                } ]
index b208f94b7b8ef2b9ea40aa25d0167a87471efda1..e6bc9f75364dbd67de5589d262ca29a9de86c5a8 100644 (file)
@@ -89,11 +89,12 @@ TranslatorControlSocket::getControlSocketKea(DataNode const& data_node) {
                         checkAndGetDivergingLeaf(authentication, node, "type", "auth-type");
                         checkAndGetLeaf(authentication, node, "realm");
                         checkAndGetLeaf(authentication, node, "directory");
+                        checkAndGetAndJsonifyLeaf(authentication, node, "clients");
                         checkAndGetAndJsonifyLeaf(authentication, node, "user-context");
-                        ConstElementPtr clients = getControlSocketAuthenticationClients(node);
-                        if (clients) {
-                            authentication->set("clients", clients);
-                        }
+                        // ConstElementPtr clients = getControlSocketAuthenticationClients(node);
+                        // if (clients) {
+                        //     authentication->set("clients", clients);
+                        // }
                         return (authentication);
                     });
         ConstElementPtr headers = getControlSocketHttpHeaders(data_node);
@@ -134,7 +135,6 @@ TranslatorControlSocket::getControlSocketAuthenticationClient(DataNode const& da
     getMandatoryLeaf(result, data_node, "user-file");
     getMandatoryLeaf(result, data_node, "password-file");
     checkAndGetAndJsonifyLeaf(result, data_node, "user-context");
-
     return (result->empty() ? ElementPtr() : result);
 }
 
@@ -239,8 +239,9 @@ TranslatorControlSocket::setControlSocketKea(string const& xpath,
             checkAndSetLeaf(authentication, xpath + "/authentication", "realm", LeafBaseType::String);
             checkAndSetLeaf(authentication, xpath + "/authentication", "directory", LeafBaseType::String);
             checkAndSetUserContext(authentication, xpath + "/authentication");
-            ConstElementPtr clients = authentication->get("clients");
-            setControlSocketAuthenticationClients(xpath + "/authentication/clients", clients);
+            checkAndStringifyAndSetLeaf(authentication, xpath + "/authentication", "clients");
+            // ConstElementPtr clients = authentication->get("clients");
+            // setControlSocketAuthenticationClients(xpath + "/authentication/clients", clients);
         }
         ConstElementPtr http_headers = elem->get("http-headers");
         if (http_headers && !http_headers->empty()) {
@@ -259,7 +260,6 @@ TranslatorControlSocket::setControlSocketAuthenticationClients(string const& xpa
     }
     for (size_t i = 0; i < elem->size(); ++i) {
         ElementPtr client = elem->getNonConst(i);
-        ostringstream key;
         auto user = client->get("user");
         string user_str;
         if (user) {
@@ -280,6 +280,7 @@ TranslatorControlSocket::setControlSocketAuthenticationClients(string const& xpa
         if (password_file) {
             password_file_str = password_file->stringValue();
         }
+        ostringstream key;
         key << xpath << "[user='" << user_str << "'][password='" << password_str
                      << "'][user-file='" << user_file_str << "'][password-file='"
                      << password_file_str << "']";
index c708553205135503aa60c3bacdace601d656c61f..c0feac45342a47dd6561f6e42847da02b5723274 100644 (file)
@@ -1 +1 @@
-b5f9e40815ea19641d64eefaf4acd429526e5f58c7ac8154fa89cd6c0033722e
+7880835d105232e5575e324ec4db82481e7c07157adfe6028f4ec0949be1718f
index 639baef170848db0629e24fde23477b5474d050c..13a35ca53a1cb3aa1707cf3a8a701529f0d479e6 100644 (file)
@@ -138,28 +138,9 @@ module kea-types {
 
   grouping clients {
     description "HTTP client authentication.";
-    list clients {
-      leaf user {
-        type string;
-        description "HTTP user.";
-      }
-      leaf password {
-        type string;
-        description "HTTP password.";
-      }
-      leaf user-file {
-        type string;
-        description "HTTP user file.";
-      }
-      leaf password-file {
-        type string;
-        description "HTTP password file.";
-      }
-      leaf user-context {
-        type user-context;
-        description "Logger user context.";
-      }
-      key "user password user-file password-file";
+    leaf clients {
+      type string;
+      description "Clients (JSON value).";
     }
   }