mgmt, main: add support for authorized commands
refs: #1227
Change-Id: I907d1fa6e78775470c5376fcdfe898be4c311001
diff --git a/daemon/mgmt/manager-base.cpp b/daemon/mgmt/manager-base.cpp
index 1994416..bd94b18 100644
--- a/daemon/mgmt/manager-base.cpp
+++ b/daemon/mgmt/manager-base.cpp
@@ -5,16 +5,15 @@
*/
#include "manager-base.hpp"
-#include "mgmt/app-face.hpp"
namespace nfd {
NFD_LOG_INIT("ManagerBase");
-ManagerBase::ManagerBase(shared_ptr<AppFace> face)
+ManagerBase::ManagerBase(shared_ptr<InternalFace> face, const std::string& privilege)
: m_face(face)
{
-
+ face->getValidator().addSupportedPrivilege(privilege);
}
ManagerBase::~ManagerBase()
@@ -49,5 +48,13 @@
m_face->put(*responseData);
}
+void
+ManagerBase::onCommandValidationFailed(const shared_ptr<const Interest>& command,
+ const std::string& error)
+{
+ NFD_LOG_INFO("command result: unauthorized verb: " << command);
+ sendResponse(command->getName(), 403, "Unauthorized command");
+}
+
} // namespace nfd