Revert "Auth methods configuration"
This reverts commit 0ff64dc2cd3a15b4204a477ad2eb5219d66e6110.
Reason for revert: <breaks redfish validator, <edmx:Reference Uri="/redfish/v1/schema/OemAccountService_v1.xml"> but the file name unversioned static/redfish/v1/schema/OemAccountService.xml>
Change-Id: I696dd09bf519e364f5f529a674e047a8eeead578
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index f8647b9..07efeb5 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -505,8 +505,7 @@
class AccountService : public Node
{
public:
- AccountService(CrowApp& app) :
- Node(app, "/redfish/v1/AccountService/"), app(app)
+ AccountService(CrowApp& app) : Node(app, "/redfish/v1/AccountService/")
{
entityPrivileges = {
{boost::beast::http::verb::get,
@@ -840,65 +839,6 @@
ldapEnableInterface, "Enabled", std::variant<bool>(serviceEnabled));
}
- void handleAuthMethodsPatch(nlohmann::json& input,
- const std::shared_ptr<AsyncResp>& asyncResp)
- {
- std::optional<bool> basicAuth;
- std::optional<bool> cookie;
- std::optional<bool> sessionToken;
- std::optional<bool> xToken;
-
- if (!json_util::readJson(input, asyncResp->res, "BasicAuth", basicAuth,
- "Cookie", cookie, "SessionToken", sessionToken,
- "XToken", xToken))
- {
- BMCWEB_LOG_ERROR << "Cannot read values from AuthMethod tag";
- return;
- }
-
- // Make a copy of methods configuration
- crow::persistent_data::AuthConfigMethods authMethodsConfig =
- crow::persistent_data::SessionStore::getInstance()
- .getAuthMethodsConfig();
-
- if (basicAuth)
- {
- authMethodsConfig.basic = *basicAuth;
- }
-
- if (cookie)
- {
- authMethodsConfig.cookie = *cookie;
- }
-
- if (sessionToken)
- {
- authMethodsConfig.sessionToken = *sessionToken;
- }
-
- if (xToken)
- {
- authMethodsConfig.xtoken = *xToken;
- }
-
- if (!authMethodsConfig.basic && !authMethodsConfig.cookie &&
- !authMethodsConfig.sessionToken && !authMethodsConfig.xtoken)
- {
- // Do not allow user to disable everything
- messages::actionNotSupported(asyncResp->res,
- "of disabling all available methods");
- return;
- }
-
- crow::persistent_data::SessionStore::getInstance()
- .updateAuthMethodsConfig(authMethodsConfig);
- // Save configuration immediately
- app.template getMiddleware<crow::persistent_data::Middleware>()
- .writeData();
-
- messages::success(asyncResp->res);
- }
-
/**
* @brief Get the required values from the given JSON, validates the
* value and create the LDAP config object.
@@ -1075,10 +1015,6 @@
void doGet(crow::Response& res, const crow::Request& req,
const std::vector<std::string>& params) override
{
- const crow::persistent_data::AuthConfigMethods& authMethodsConfig =
- crow::persistent_data::SessionStore::getInstance()
- .getAuthMethodsConfig();
-
auto asyncResp = std::make_shared<AsyncResp>(res);
res.jsonValue = {
{"@odata.context", "/redfish/v1/"
@@ -1094,16 +1030,6 @@
{"Accounts",
{{"@odata.id", "/redfish/v1/AccountService/Accounts"}}},
{"Roles", {{"@odata.id", "/redfish/v1/AccountService/Roles"}}},
- {"Oem",
- {{"OpenBMC",
- {{"@odata.type", "#OemAccountService.v1_0_0.AccountService"},
- {"AuthMethods",
- {
- {"BasicAuth", authMethodsConfig.basic},
- {"SessionToken", authMethodsConfig.sessionToken},
- {"XToken", authMethodsConfig.xtoken},
- {"Cookie", authMethodsConfig.cookie},
- }}}}}},
{"LDAP",
{{"Certificates",
{{"@odata.id",
@@ -1181,14 +1107,13 @@
std::optional<uint16_t> maxPasswordLength;
std::optional<nlohmann::json> ldapObject;
std::optional<nlohmann::json> activeDirectoryObject;
- std::optional<nlohmann::json> oemObject;
- if (!json_util::readJson(
- req, res, "AccountLockoutDuration", unlockTimeout,
- "AccountLockoutThreshold", lockoutThreshold,
- "MaxPasswordLength", maxPasswordLength, "MinPasswordLength",
- minPasswordLength, "LDAP", ldapObject, "ActiveDirectory",
- activeDirectoryObject, "Oem", oemObject))
+ if (!json_util::readJson(req, res, "AccountLockoutDuration",
+ unlockTimeout, "AccountLockoutThreshold",
+ lockoutThreshold, "MaxPasswordLength",
+ maxPasswordLength, "MinPasswordLength",
+ minPasswordLength, "LDAP", ldapObject,
+ "ActiveDirectory", activeDirectoryObject))
{
return;
}
@@ -1208,22 +1133,6 @@
handleLDAPPatch(*ldapObject, asyncResp, req, params, "LDAP");
}
- if (std::optional<nlohmann::json> oemOpenBMCObject;
- oemObject &&
- json_util::readJson(*oemObject, res, "OpenBMC", oemOpenBMCObject))
- {
- if (std::optional<nlohmann::json> authMethodsObject;
- oemOpenBMCObject &&
- json_util::readJson(*oemOpenBMCObject, res, "AuthMethods",
- authMethodsObject))
- {
- if (authMethodsObject)
- {
- handleAuthMethodsPatch(*authMethodsObject, asyncResp);
- }
- }
- }
-
if (activeDirectoryObject)
{
handleLDAPPatch(*activeDirectoryObject, asyncResp, req, params,
@@ -1264,8 +1173,6 @@
std::variant<uint16_t>(*lockoutThreshold));
}
}
-
- CrowApp& app;
};
class AccountsCollection : public Node