diff options
author | Ed Tanous <ed@tanous.net> | 2020-07-18 23:51:21 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2020-08-17 23:54:37 +0300 |
commit | 52cc112d962920b035c870127784bcbd98948fad (patch) | |
tree | cef270a89373ad55b15578d9a52c5956aa5d3f7e /redfish-core/lib/redfish_sessions.hpp | |
parent | d6c414f36c66b03f272f0cfc3a2e2d5dc0df1271 (diff) | |
download | bmcweb-52cc112d962920b035c870127784bcbd98948fad.tar.xz |
Remove middlewares
Middlewares, while kinda cool from an academic standpoint, make our
build times even worse than they already are. Given that we only really
use 1 real middleware today (token auth) and it needs to move into the
parser mode anyway (for security limiting buffer sizes), we might as well
use this as an opportunity to delete some code.
Some other things that happen:
1. Persistent data now moves out of the crow namespace
2. App is no longer a template
3. All request_routes implementations no longer become templates. This
should be a decent (unmeasured) win on compile times.
This commit was part of a commit previously called "various cleanups".
This separates ONLY the middleware deletion part of that.
Note, this also deletes about 400 lines of hard to understand code.
Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a
Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'redfish-core/lib/redfish_sessions.hpp')
-rw-r--r-- | redfish-core/lib/redfish_sessions.hpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp index 8080e6f69d..e54492d908 100644 --- a/redfish-core/lib/redfish_sessions.hpp +++ b/redfish-core/lib/redfish_sessions.hpp @@ -17,7 +17,7 @@ #include "error_messages.hpp" #include "node.hpp" -#include "persistent_data_middleware.hpp" +#include "persistent_data.hpp" namespace redfish { @@ -27,7 +27,7 @@ class SessionCollection; class Sessions : public Node { public: - Sessions(CrowApp& app) : + Sessions(App& app) : Node(app, "/redfish/v1/SessionService/Sessions/<str>/", std::string()) { entityPrivileges = { @@ -46,7 +46,7 @@ class Sessions : public Node { // Note that control also reaches here via doPost and doDelete. auto session = - crow::persistent_data::SessionStore::getInstance().getSessionByUid( + persistent_data::SessionStore::getInstance().getSessionByUid( params[0]); if (session == nullptr) @@ -88,7 +88,7 @@ class Sessions : public Node } auto session = - crow::persistent_data::SessionStore::getInstance().getSessionByUid( + persistent_data::SessionStore::getInstance().getSessionByUid( params[0]); if (session == nullptr) @@ -117,8 +117,7 @@ class Sessions : public Node // DELETE should return representation of object that will be removed doGet(res, req, params); - crow::persistent_data::SessionStore::getInstance().removeSession( - session); + persistent_data::SessionStore::getInstance().removeSession(session); } /** @@ -133,7 +132,7 @@ class Sessions : public Node class SessionCollection : public Node { public: - SessionCollection(CrowApp& app) : + SessionCollection(App& app) : Node(app, "/redfish/v1/SessionService/Sessions/"), memberSession(app) { entityPrivileges = { @@ -150,8 +149,8 @@ class SessionCollection : public Node const std::vector<std::string>& params) override { std::vector<const std::string*> sessionIds = - crow::persistent_data::SessionStore::getInstance().getUniqueIds( - false, crow::persistent_data::PersistenceType::TIMEOUT); + persistent_data::SessionStore::getInstance().getUniqueIds( + false, persistent_data::PersistenceType::TIMEOUT); res.jsonValue["Members@odata.count"] = sessionIds.size(); res.jsonValue["Members"] = nlohmann::json::array(); @@ -236,11 +235,10 @@ class SessionCollection : public Node #endif // User is authenticated - create session - std::shared_ptr<crow::persistent_data::UserSession> session = - crow::persistent_data::SessionStore::getInstance() - .generateUserSession( - username, crow::persistent_data::PersistenceType::TIMEOUT, - isConfigureSelfOnly, clientId, clientIp); + std::shared_ptr<persistent_data::UserSession> session = + persistent_data::SessionStore::getInstance().generateUserSession( + username, persistent_data::PersistenceType::TIMEOUT, + isConfigureSelfOnly, clientId, clientIp); res.addHeader("X-Auth-Token", session->sessionToken); res.addHeader("Location", "/redfish/v1/SessionService/Sessions/" + session->uniqueId); @@ -264,7 +262,7 @@ class SessionCollection : public Node class SessionService : public Node { public: - SessionService(CrowApp& app) : Node(app, "/redfish/v1/SessionService/") + SessionService(App& app) : Node(app, "/redfish/v1/SessionService/") { entityPrivileges = { @@ -286,8 +284,7 @@ class SessionService : public Node res.jsonValue["Id"] = "SessionService"; res.jsonValue["Description"] = "Session Service"; res.jsonValue["SessionTimeout"] = - crow::persistent_data::SessionStore::getInstance() - .getTimeoutInSeconds(); + persistent_data::SessionStore::getInstance().getTimeoutInSeconds(); res.jsonValue["ServiceEnabled"] = true; res.jsonValue["Sessions"] = { |