// This optional parameter can be used to specify a common
// prefix for files handling client credentials.
- "directory": "/tmp/ca",
+ "directory": "/tmp/kea-creds",
// This list specifies the user ids and passwords to use for
// basic HTTP authentication. If empty or not present any client
// If password is not specified an empty password is used.
"password": "1234"
- }/* temporary disabled because it requires files ,
+ },
// This specifies a hiddent client.
{
// The secret is the content of the file /tmp/ca/hiddens
// which must be in the <user-id>:<password> format.
"password-file": "hiddens"
- }*/
+ }
]
},
first_lib->set("library", Element::create(lib_path));
}
+/// @brief Replace the credential directory
+void
+dirReplacer(ConstElementPtr ca_cfg) {
+ ConstElementPtr auth = ca_cfg->get("authentication");
+ if (!auth || auth->empty()) {
+ return;
+ }
+ ElementPtr mutable_auth = boost::const_pointer_cast<Element>(auth);
+ std::string dir_path(CA_TEST_DATA_DIR);
+ mutable_auth->set("directory", Element::create(dir_path));
+}
+
/// @brief Almost regular agent CfgMgr with internal parse method exposed.
class NakedAgentCfgMgr : public CtrlAgentCfgMgr {
public:
// update hooks-libraries
pathReplacer(ca);
+ // update authentication directory
+ dirReplacer(ca);
+
// try AGENT configure
ConstElementPtr status;
try {
ASSERT_NO_THROW(jsonj = parseJSON(expected));
// the generic JSON parser does not handle comments
EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
- // replace the path by its actual value
+ // replace the paths by their actual values
ConstElementPtr ca;
ASSERT_NO_THROW(ca = jsonj->get("Control-agent"));
ASSERT_TRUE(ca);
pathReplacer(ca);
+ dirReplacer(ca);
// check that unparsed and updated expected values match
EXPECT_TRUE(isEquivalent(unparsed, jsonj));
// check on pretty prints too
"user-context": {
"comment": "admin is authorized"
}
+ },
+ {
+ "password-file": "hiddenp",
+ "user-file": "hiddenu"
+ },
+ {
+ "password-file": "hiddens"
}
],
- "directory": "/tmp/ca",
+ "directory": "/tmp/kea-creds",
"realm": "kea-control-agent",
"type": "basic"
},