mgmt: fix construction of CertificateRequest in CommandAuthenticatorValidationPolicy

Just pass the KeyLocator name and let CertificateRequest deal
with constructing the Interest and setting CanBePrefix

Refs: #4582
Change-Id: I323d8ac5e16605bb978addc623e525b2536238bf
This commit is contained in:
Davide Pesavento committed 2021-03-18 22:08:03 -04:00
1 parent 432be57380
commit 22085365d2
4 files changed
+12 -11

No files matched your search

+4 -2
View File
@@ -83,7 +83,7 @@ public:
auto state1 = dynamic_pointer_cast<security::InterestValidationState>(state);
state1->getOriginalInterest().setTag(make_shared<SignerTag>(klName));
continueValidation(make_shared<security::CertificateRequest>(Interest(klName)), state);
continueValidation(make_shared<security::CertificateRequest>(klName), state);
}
void
@@ -115,7 +115,7 @@ void
CommandAuthenticator::processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename)
{
if (!isDryRun) {
NFD_LOG_INFO("clear-authorizations");
NFD_LOG_DEBUG("resetting authorizations");
for (auto& kv : m_validators) {
kv.second = make_shared<security::Validator>(
make_unique<security::ValidationPolicyCommandInterest>(make_unique<CommandAuthenticatorValidationPolicy>()),
@@ -212,6 +212,7 @@ CommandAuthenticator::makeAuthorization(const std::string& module, const std::st
const ndn::mgmt::AcceptContinuation& accept,
const ndn::mgmt::RejectContinuation& reject) {
auto validator = self->m_validators.at(module);
auto successCb = [accept, validator] (const Interest& interest1) {
auto signer1 = getSignerFromTag(interest1);
BOOST_ASSERT(signer1 || // signer must be available unless 'certfile any'
@@ -220,6 +221,7 @@ CommandAuthenticator::makeAuthorization(const std::string& module, const std::st
NFD_LOG_DEBUG("accept " << interest1.getName() << " signer=" << signer);
accept(signer);
};
auto failureCb = [reject] (const Interest& interest1, const security::ValidationError& err) {
using ndn::mgmt::RejectReply;
RejectReply reply = RejectReply::STATUS403;
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, Regents of the University of California,
* Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -46,7 +46,7 @@ namespace mpl = boost::mpl;
class FaceManagerUpdateFixture : public FaceManagerCommandFixture
{
public:
~FaceManagerUpdateFixture()
~FaceManagerUpdateFixture() override
{
destroyFace();
}
@@ -110,7 +110,7 @@ public:
if (isForOnDemandFace) {
auto face = target.faceTable.get(static_cast<FaceId>(this->faceId));
// to force creation of on-demand face
face->sendInterest(*make_shared<Interest>("/hello/world"));
face->sendInterest(*makeInterest("/hello/world"));
}
});
+3 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -64,8 +64,7 @@ protected:
Interest&
startInterest(const Name& name)
{
interest = make_shared<Interest>(name);
interest->setCanBePrefix(false);
interest = makeInterest(name);
return *interest;
}
@@ -74,7 +73,7 @@ protected:
{
bool hasResult = false;
cs.find(*interest,
[&] (const Interest& interest, const Data& data) {
[&] (const Interest&, const Data& data) {
hasResult = true;
const Block& content = data.getContent();
uint32_t found = 0;
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -115,7 +115,7 @@ MulticastDiscovery::setStrategy()
{
ControlParameters parameters;
parameters.setName(HUB_DISCOVERY_PREFIX)
.setStrategy("/localhost/nfd/strategy/multicast"),
.setStrategy("/localhost/nfd/strategy/multicast");
m_controller.start<nfd::StrategyChoiceSetCommand>(
parameters,