core: change ManagerBase::authorize to makeAuthorization

refs #2063

Change-Id: I0e6faced6e4e1733362e3ec018e2ee60fcefafa1
diff --git a/daemon/mgmt/nfd-manager-base.cpp b/daemon/mgmt/nfd-manager-base.cpp
index c0ecaae..b30eca7 100644
--- a/daemon/mgmt/nfd-manager-base.cpp
+++ b/daemon/mgmt/nfd-manager-base.cpp
@@ -36,18 +36,20 @@
   m_validator.addSupportedPrivilege(module);
 }
 
-void
-NfdManagerBase::authorize(const Name& prefix, const Interest& interest,
-                          const ndn::mgmt::ControlParameters* params,
-                          ndn::mgmt::AcceptContinuation accept,
-                          ndn::mgmt::RejectContinuation reject)
+ndn::mgmt::Authorization
+NfdManagerBase::makeAuthorization(const std::string& verb)
 {
-  BOOST_ASSERT(params != nullptr);
-  BOOST_ASSERT(typeid(*params) == typeid(ndn::nfd::ControlParameters));
+  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); }));
+    m_validator.validate(interest,
+                         bind([&interest, this, accept] { extractRequester(interest, accept); }),
+                         bind([reject] { reject(ndn::mgmt::RejectReply::STATUS403); }));
+  };
 }
 
 } // namespace nfd
diff --git a/daemon/mgmt/nfd-manager-base.hpp b/daemon/mgmt/nfd-manager-base.hpp
index c7f30ff..49a3ea2 100644
--- a/daemon/mgmt/nfd-manager-base.hpp
+++ b/daemon/mgmt/nfd-manager-base.hpp
@@ -52,25 +52,8 @@
                  const std::string& module);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // command validation
-  /**
-   * @brief validate a request for ControlCommand.
-   *
-   * This is called by the dispatcher.
-   *
-   * @pre params != null
-   * @pre typeid(*params) == typeid(ndn::nfd::ControlParameters)
-   *
-   * @param prefix the top prefix
-   * @param interest a request for ControlCommand
-   * @param params the parameters for ControlCommand
-   * @param accept callback of successful validation, take the requester string as a argument
-   * @param reject callback of failure in validation, take the action code as a argument
-   */
-  virtual void
-  authorize(const Name& prefix, const Interest& interest,
-            const ndn::mgmt::ControlParameters* params,
-            ndn::mgmt::AcceptContinuation accept,
-            ndn::mgmt::RejectContinuation reject) override;
+  virtual ndn::mgmt::Authorization
+  makeAuthorization(const std::string& verb) override;
 
 private:
   CommandValidator& m_validator;