11#include <boost/algorithm/string.hpp> 
   19template <
typename ElementPtrType>
 
   21redact(ElementPtrType 
const& element, list<string> json_path, 
string obscure) {
 
   26    string const next_key(json_path.empty() ? 
string() : json_path.front());
 
   30        if (next_key == 
"*" || next_key == 
"[]") {
 
   32            if (next_key == 
"[]") {
 
   34                json_path.pop_front();
 
   38            for (
ElementPtr const& child : element->listValue()) {
 
   39                result->add(redact(child, json_path, obscure));
 
   46        if (next_key == 
"*" || json_path.empty()) {
 
   49            for (
auto const& kv : element->mapValue()) {
 
   50                std::string 
const& key(kv.first);
 
   53                if (boost::algorithm::ends_with(key, 
"password") ||
 
   54                    boost::algorithm::ends_with(key, 
"secret")) {
 
   57                } 
else if (key == 
"user-context") {
 
   59                    result->set(key, value);
 
   61                    if (json_path.empty()) {
 
   64                        result->set(key, value);
 
   67                        result->set(key, redact(value, json_path, obscure));
 
   76                json_path.pop_front();
 
   77                result->set(next_key, redact(child, json_path, obscure));
 
   94    return redact(element, json_path, obscure);
 
 
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
ElementPtr copy(ConstElementPtr from, int level)
Copy the data up to a nesting level.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
ConstElementPtr redactConfig(ConstElementPtr const &element, list< string > const &json_path, string obscure)
Redact a configuration.
Defines the logger used by the top-level component of kea-lfc.