11/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-*/
22/*
3- * Copyright (c) 2014-2020 , Regents of the University of California.
3+ * Copyright (c) 2014-2022 , Regents of the University of California.
44 *
55 * This file is part of NDN repo-ng (Next generation of NDN repository).
66 * See AUTHORS.md for complete list of repo-ng authors and contributors.
1919
2020#include " command-base-handle.hpp"
2121
22- #include < ndn-cxx/util/random.hpp >
22+ #include < optional >
2323
2424namespace repo {
2525
@@ -29,43 +29,40 @@ using SignerTag = ndn::SimpleTag<ndn::Name, 20>;
2929
3030/* * \brief obtain signer from SignerTag attached to Interest, if available
3131*/
32- static ndn ::optional<std::string>
32+ static std ::optional<std::string>
3333getSignerFromTag (const ndn::Interest& interest)
3434{
35- std::shared_ptr<SignerTag> signerTag = interest.getTag <SignerTag>();
35+ auto signerTag = interest.getTag <SignerTag>();
3636if (signerTag ==nullptr ) {
37- return ndn ::nullopt ;
37+ return std ::nullopt ;
3838 }
3939else {
4040return signerTag->get ().toUri ();
4141 }
4242}
4343
44- CommandBaseHandle::CommandBaseHandle (Face& face, RepoStorage&storageHandle ,
45- Scheduler&scheduler, Validator& validator)
44+ CommandBaseHandle::CommandBaseHandle (Face& face, RepoStorage&storage ,
45+ Scheduler&sched, ndn::security:: Validator& validator)
4646 : face(face)
47- , storageHandle(storageHandle )
48- , scheduler(scheduler )
47+ , storageHandle(storage )
48+ , scheduler(sched )
4949 , m_validator(validator)
5050{
5151}
5252
5353ndn::mgmt::Authorization
5454CommandBaseHandle::makeAuthorization ()
5555{
56- return [=] (const ndn::Name& prefix ,const ndn::Interest & interest,
57- const ndn::mgmt::ControlParameters* params ,
58- const ndn::mgmt::AcceptContinuation& accept,
59- const ndn::mgmt::RejectContinuation& reject) {
56+ return [=] (const ndn::Name&,const auto & interest,
57+ const ndn::mgmt::ControlParameters*,
58+ const ndn::mgmt::AcceptContinuation& accept,
59+ const ndn::mgmt::RejectContinuation& reject) {
6060 m_validator.validate (interest,
61- [accept] (const ndn::Interest& request) {
62-
63- auto signer1 =getSignerFromTag (request);
64- std::string signer = signer1.value_or (" *" );
61+ [accept] (const auto & request) {
62+ auto signer =getSignerFromTag (request).value_or (" *" );
6563accept (signer);
6664 },
67- [reject] (const ndn::Interest& request,
68- const ndn::security::ValidationError& error) {
65+ [reject] (auto &&...) {
6966reject (ndn::mgmt::RejectReply::STATUS403);
7067 });
7168 };