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/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