diff options
author | James Feist <james.feist@linux.intel.com> | 2019-11-04 21:19:48 +0000 |
---|---|---|
committer | James Feist <james.feist@linux.intel.com> | 2019-11-04 21:25:46 +0000 |
commit | eecd51a46e6d44ae3408d889ed037f4e4270d653 (patch) | |
tree | a0cbbd26cf1adc0d9c73623cf9b5df3a67b1bbe9 /redfish-core/lib/account_service.hpp | |
parent | 2ad9c2f694b9a75b5f14f485ebab28bd32d0f575 (diff) | |
download | bmcweb-eecd51a46e6d44ae3408d889ed037f4e4270d653.tar.gz bmcweb-eecd51a46e6d44ae3408d889ed037f4e4270d653.zip |
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>
Diffstat (limited to 'redfish-core/lib/account_service.hpp')
-rw-r--r-- | redfish-core/lib/account_service.hpp | 109 |
1 files changed, 8 insertions, 101 deletions
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 @@ inline void getLDAPConfigData(const std::string& ldapType, 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 @@ class AccountService : public Node 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 @@ class AccountService : public Node 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 @@ class AccountService : public Node {"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 @@ class AccountService : public Node 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 @@ class AccountService : public Node 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 @@ class AccountService : public Node std::variant<uint16_t>(*lockoutThreshold)); } } - - CrowApp& app; }; class AccountsCollection : public Node |