mgmt: NfdManagerBase::makeAuthorization uses CommandAuthenticator

This commit also eliminates Forwarder in Mgmt/TestFaceManager/CreateFace test suite
and uses FaceTable directly.

refs #2063

Change-Id: I596e8c2a12dad64ee75082f384955f30d574f53e
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index e3e0cb8..8b7057c 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -52,8 +52,8 @@
 
 NFD_LOG_INIT("FaceManager");
 
-FaceManager::FaceManager(FaceTable& faceTable, Dispatcher& dispatcher, CommandValidator& validator)
-  : NfdManagerBase(dispatcher, validator, "faces")
+FaceManager::FaceManager(FaceTable& faceTable, Dispatcher& dispatcher, CommandAuthenticator& authenticator)
+  : NfdManagerBase(dispatcher, authenticator, "faces")
   , m_faceTable(faceTable)
 {
   registerCommandHandler<ndn::nfd::FaceCreateCommand>("create",
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index ec0af92..f31f04b 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -46,7 +46,7 @@
 public:
   FaceManager(FaceTable& faceTable,
               Dispatcher& dispatcher,
-              CommandValidator& validator);
+              CommandAuthenticator& authenticator);
 
   /**
    * @brief Subscribe to face_system section for the config file
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index 1c15ebf..9992789 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -34,8 +34,8 @@
 FibManager::FibManager(Fib& fib,
                        const FaceTable& faceTable,
                        Dispatcher& dispatcher,
-                       CommandValidator& validator)
-  : NfdManagerBase(dispatcher, validator, "fib")
+                       CommandAuthenticator& authenticator)
+  : NfdManagerBase(dispatcher, authenticator, "fib")
   , m_fib(fib)
   , m_faceTable(faceTable)
 {
diff --git a/daemon/mgmt/fib-manager.hpp b/daemon/mgmt/fib-manager.hpp
index 9599a01..b5c6984 100644
--- a/daemon/mgmt/fib-manager.hpp
+++ b/daemon/mgmt/fib-manager.hpp
@@ -42,18 +42,10 @@
 class FibManager : public NfdManagerBase
 {
 public:
-  /**
-   * @brief construct a FibManger
-   *
-   * @param fib the managed FIB
-   * @param faceTable FaceTable for querying available faces
-   * @param dispatcher the management dispatcher
-   * @param validator the command validator
-   */
   FibManager(Fib& fib,
              const FaceTable& faceTable,
              Dispatcher& dispatcher,
-             CommandValidator& validator);
+             CommandAuthenticator& authenticator);
 
 private:
   void
diff --git a/daemon/mgmt/nfd-manager-base.cpp b/daemon/mgmt/nfd-manager-base.cpp
index b30eca7..b417934 100644
--- a/daemon/mgmt/nfd-manager-base.cpp
+++ b/daemon/mgmt/nfd-manager-base.cpp
@@ -28,28 +28,17 @@
 namespace nfd {
 
 NfdManagerBase::NfdManagerBase(Dispatcher& dispatcher,
-                               CommandValidator& validator,
+                               CommandAuthenticator& authenticator,
                                const std::string& module)
   : ManagerBase(dispatcher, module)
-  , m_validator(validator)
+  , m_authenticator(authenticator)
 {
-  m_validator.addSupportedPrivilege(module);
 }
 
 ndn::mgmt::Authorization
 NfdManagerBase::makeAuthorization(const std::string& verb)
 {
-  return [this] (const Name& prefix, const Interest& interest,
-                 const ndn::mgmt::ControlParameters* params,
-                 const ndn::mgmt::AcceptContinuation& accept,
-                 const ndn::mgmt::RejectContinuation& reject) {
-    BOOST_ASSERT(params != nullptr);
-    BOOST_ASSERT(typeid(*params) == typeid(ndn::nfd::ControlParameters));
-
-    m_validator.validate(interest,
-                         bind([&interest, this, accept] { extractRequester(interest, accept); }),
-                         bind([reject] { reject(ndn::mgmt::RejectReply::STATUS403); }));
-  };
+  return m_authenticator.makeAuthorization(this->getModule(), verb);
 }
 
 } // namespace nfd
diff --git a/daemon/mgmt/nfd-manager-base.hpp b/daemon/mgmt/nfd-manager-base.hpp
index 49a3ea2..27c3392 100644
--- a/daemon/mgmt/nfd-manager-base.hpp
+++ b/daemon/mgmt/nfd-manager-base.hpp
@@ -26,14 +26,8 @@
 #ifndef NFD_DAEMON_MGMT_NFD_MANAGER_BASE_HPP
 #define NFD_DAEMON_MGMT_NFD_MANAGER_BASE_HPP
 
-#include "core/common.hpp"
-#include "command-validator.hpp"
 #include "core/manager-base.hpp"
-
-#include <ndn-cxx/mgmt/dispatcher.hpp>
-#include <ndn-cxx/management/nfd-control-command.hpp>
-#include <ndn-cxx/management/nfd-control-response.hpp>
-#include <ndn-cxx/management/nfd-control-parameters.hpp>
+#include "command-authenticator.hpp"
 
 namespace nfd {
 
@@ -48,7 +42,7 @@
 {
 public:
   NfdManagerBase(Dispatcher& dispatcher,
-                 CommandValidator& validator,
+                 CommandAuthenticator& authenticator,
                  const std::string& module);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // command validation
@@ -56,7 +50,7 @@
   makeAuthorization(const std::string& verb) override;
 
 private:
-  CommandValidator& m_validator;
+  CommandAuthenticator& m_authenticator;
 };
 
 } // namespace nfd
diff --git a/daemon/mgmt/strategy-choice-manager.cpp b/daemon/mgmt/strategy-choice-manager.cpp
index 1f0c208..312a35c 100644
--- a/daemon/mgmt/strategy-choice-manager.cpp
+++ b/daemon/mgmt/strategy-choice-manager.cpp
@@ -33,8 +33,8 @@
 
 StrategyChoiceManager::StrategyChoiceManager(StrategyChoice& strategyChoice,
                                              Dispatcher& dispatcher,
-                                             CommandValidator& validator)
-  : NfdManagerBase(dispatcher, validator, "strategy-choice")
+                                             CommandAuthenticator& authenticator)
+  : NfdManagerBase(dispatcher, authenticator, "strategy-choice")
   , m_table(strategyChoice)
 {
   registerCommandHandler<ndn::nfd::StrategyChoiceSetCommand>("set",
diff --git a/daemon/mgmt/strategy-choice-manager.hpp b/daemon/mgmt/strategy-choice-manager.hpp
index 9fd4ad3..5520790 100644
--- a/daemon/mgmt/strategy-choice-manager.hpp
+++ b/daemon/mgmt/strategy-choice-manager.hpp
@@ -43,7 +43,7 @@
 public:
   StrategyChoiceManager(strategy_choice::StrategyChoice& table,
                         Dispatcher& dispatcher,
-                        CommandValidator& validator);
+                        CommandAuthenticator& authenticator);
 
 private:
   void