xref: /openbmc/bmcweb/features/redfish/lib/redfish_sessions.hpp (revision b2ba30728fc644b206af43b3f807098b5fa470b6)
12b7981f6SKowalski, Kamil /*
22b7981f6SKowalski, Kamil // Copyright (c) 2018 Intel Corporation
32b7981f6SKowalski, Kamil //
42b7981f6SKowalski, Kamil // Licensed under the Apache License, Version 2.0 (the "License");
52b7981f6SKowalski, Kamil // you may not use this file except in compliance with the License.
62b7981f6SKowalski, Kamil // You may obtain a copy of the License at
72b7981f6SKowalski, Kamil //
82b7981f6SKowalski, Kamil //      http://www.apache.org/licenses/LICENSE-2.0
92b7981f6SKowalski, Kamil //
102b7981f6SKowalski, Kamil // Unless required by applicable law or agreed to in writing, software
112b7981f6SKowalski, Kamil // distributed under the License is distributed on an "AS IS" BASIS,
122b7981f6SKowalski, Kamil // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132b7981f6SKowalski, Kamil // See the License for the specific language governing permissions and
142b7981f6SKowalski, Kamil // limitations under the License.
152b7981f6SKowalski, Kamil */
162b7981f6SKowalski, Kamil #pragma once
1743a095abSBorawski.Lukasz 
183ccb3adbSEd Tanous #include "app.hpp"
19f4c4dcf4SKowalski, Kamil #include "error_messages.hpp"
203ccb3adbSEd Tanous #include "http/utility.hpp"
2152cc112dSEd Tanous #include "persistent_data.hpp"
223ccb3adbSEd Tanous #include "query.hpp"
233ccb3adbSEd Tanous #include "registries/privilege_registry.hpp"
243ccb3adbSEd Tanous #include "utils/json_utils.hpp"
257e860f15SJohn Edward Broadbent 
261abe55efSEd Tanous namespace redfish
271abe55efSEd Tanous {
282b7981f6SKowalski, Kamil 
294f48d5f6SEd Tanous inline void fillSessionObject(crow::Response& res,
30faa34ccfSEd Tanous                               const persistent_data::UserSession& session)
311abe55efSEd Tanous {
32faa34ccfSEd Tanous     res.jsonValue["Id"] = session.uniqueId;
33faa34ccfSEd Tanous     res.jsonValue["UserName"] = session.username;
34eddfc437SWilly Tu     res.jsonValue["@odata.id"] = crow::utility::urlFromPieces(
3503457a9cSGunnar Mills         "redfish", "v1", "SessionService", "Sessions", session.uniqueId);
36bb759e3aSEd Tanous     res.jsonValue["@odata.type"] = "#Session.v1_5_0.Session";
37faa34ccfSEd Tanous     res.jsonValue["Name"] = "User Session";
38faa34ccfSEd Tanous     res.jsonValue["Description"] = "Manager User Session";
39faa34ccfSEd Tanous     res.jsonValue["ClientOriginIPAddress"] = session.clientIp;
40bb759e3aSEd Tanous     if (session.clientId)
41bb759e3aSEd Tanous     {
42bb759e3aSEd Tanous         res.jsonValue["Context"] = *session.clientId;
43bb759e3aSEd Tanous     }
442b7981f6SKowalski, Kamil }
452b7981f6SKowalski, Kamil 
46724340d7SEd Tanous inline void
47a1e0871dSEd Tanous     handleSessionHead(crow::App& app, const crow::Request& req,
48faa34ccfSEd Tanous                       const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
49a1e0871dSEd Tanous                       const std::string& /*sessionId*/)
50724340d7SEd Tanous {
513ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
5245ca1b86SEd Tanous     {
5345ca1b86SEd Tanous         return;
5445ca1b86SEd Tanous     }
55a1e0871dSEd Tanous     asyncResp->res.addHeader(
56a1e0871dSEd Tanous         boost::beast::http::field::link,
57a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/Session/Session.json>; rel=describedby");
58a1e0871dSEd Tanous }
59a1e0871dSEd Tanous 
60a1e0871dSEd Tanous inline void
61a1e0871dSEd Tanous     handleSessionGet(crow::App& app, const crow::Request& req,
62a1e0871dSEd Tanous                      const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
63a1e0871dSEd Tanous                      const std::string& sessionId)
64a1e0871dSEd Tanous {
65a1e0871dSEd Tanous     handleSessionHead(app, req, asyncResp, sessionId);
66a1e0871dSEd Tanous 
67faa34ccfSEd Tanous     // Note that control also reaches here via doPost and doDelete.
68724340d7SEd Tanous     auto session =
69724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getSessionByUid(sessionId);
702b7981f6SKowalski, Kamil 
711abe55efSEd Tanous     if (session == nullptr)
721abe55efSEd Tanous     {
73724340d7SEd Tanous         messages::resourceNotFound(asyncResp->res, "Session", sessionId);
74faa34ccfSEd Tanous         return;
75faa34ccfSEd Tanous     }
76faa34ccfSEd Tanous 
77faa34ccfSEd Tanous     fillSessionObject(asyncResp->res, *session);
78724340d7SEd Tanous }
79faa34ccfSEd Tanous 
80724340d7SEd Tanous inline void
8145ca1b86SEd Tanous     handleSessionDelete(crow::App& app, const crow::Request& req,
82faa34ccfSEd Tanous                         const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
83724340d7SEd Tanous                         const std::string& sessionId)
84724340d7SEd Tanous {
853ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
8645ca1b86SEd Tanous     {
8745ca1b86SEd Tanous         return;
8845ca1b86SEd Tanous     }
89724340d7SEd Tanous     auto session =
90724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getSessionByUid(sessionId);
91faa34ccfSEd Tanous 
92faa34ccfSEd Tanous     if (session == nullptr)
93faa34ccfSEd Tanous     {
94724340d7SEd Tanous         messages::resourceNotFound(asyncResp->res, "Session", sessionId);
952b7981f6SKowalski, Kamil         return;
962b7981f6SKowalski, Kamil     }
972b7981f6SKowalski, Kamil 
98900f9497SJoseph Reynolds     // Perform a proper ConfigureSelf authority check.  If a
99900f9497SJoseph Reynolds     // session is being used to DELETE some other user's session,
100900f9497SJoseph Reynolds     // then the ConfigureSelf privilege does not apply.  In that
101900f9497SJoseph Reynolds     // case, perform the authority check again without the user's
102900f9497SJoseph Reynolds     // ConfigureSelf privilege.
1030fd29865Swukaihua-fii-na     if (req.session != nullptr && !session->username.empty() &&
1040fd29865Swukaihua-fii-na         session->username != req.session->username)
105900f9497SJoseph Reynolds     {
1066c51eab1SEd Tanous         Privileges effectiveUserPrivileges =
1076c51eab1SEd Tanous             redfish::getUserPrivileges(req.userRole);
1086c51eab1SEd Tanous 
109724340d7SEd Tanous         if (!effectiveUserPrivileges.isSupersetOf({"ConfigureUsers"}))
110900f9497SJoseph Reynolds         {
1118d1b46d7Szhanghch05             messages::insufficientPrivilege(asyncResp->res);
112900f9497SJoseph Reynolds             return;
113900f9497SJoseph Reynolds         }
114900f9497SJoseph Reynolds     }
115900f9497SJoseph Reynolds 
116724340d7SEd Tanous     persistent_data::SessionStore::getInstance().removeSession(session);
1175cc148afSEd Tanous     messages::success(asyncResp->res);
118724340d7SEd Tanous }
119f4c4dcf4SKowalski, Kamil 
120724340d7SEd Tanous inline nlohmann::json getSessionCollectionMembers()
121724340d7SEd Tanous {
12255c7b7a2SEd Tanous     std::vector<const std::string*> sessionIds =
12352cc112dSEd Tanous         persistent_data::SessionStore::getInstance().getUniqueIds(
12452cc112dSEd Tanous             false, persistent_data::PersistenceType::TIMEOUT);
125724340d7SEd Tanous     nlohmann::json ret = nlohmann::json::array();
1261abe55efSEd Tanous     for (const std::string* uid : sessionIds)
1271abe55efSEd Tanous     {
1281476687dSEd Tanous         nlohmann::json::object_t session;
129eddfc437SWilly Tu         session["@odata.id"] = crow::utility::urlFromPieces(
13003457a9cSGunnar Mills             "redfish", "v1", "SessionService", "Sessions", *uid);
131*b2ba3072SPatrick Williams         ret.emplace_back(std::move(session));
1322b7981f6SKowalski, Kamil     }
133724340d7SEd Tanous     return ret;
134724340d7SEd Tanous }
135724340d7SEd Tanous 
136a1e0871dSEd Tanous inline void handleSessionCollectionHead(
13745ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
138724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
139724340d7SEd Tanous {
1403ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
14145ca1b86SEd Tanous     {
14245ca1b86SEd Tanous         return;
14345ca1b86SEd Tanous     }
144a1e0871dSEd Tanous     asyncResp->res.addHeader(
145a1e0871dSEd Tanous         boost::beast::http::field::link,
146a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/SessionCollection.json>; rel=describedby");
147a1e0871dSEd Tanous }
148a1e0871dSEd Tanous 
149a1e0871dSEd Tanous inline void handleSessionCollectionGet(
150a1e0871dSEd Tanous     crow::App& app, const crow::Request& req,
151a1e0871dSEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
152a1e0871dSEd Tanous {
153a1e0871dSEd Tanous     handleSessionCollectionHead(app, req, asyncResp);
154724340d7SEd Tanous     asyncResp->res.jsonValue["Members"] = getSessionCollectionMembers();
155faa34ccfSEd Tanous     asyncResp->res.jsonValue["Members@odata.count"] =
156724340d7SEd Tanous         asyncResp->res.jsonValue["Members"].size();
1578d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.type"] =
1588d1b46d7Szhanghch05         "#SessionCollection.SessionCollection";
1598d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.id"] =
1608d1b46d7Szhanghch05         "/redfish/v1/SessionService/Sessions/";
1618d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Session Collection";
1628d1b46d7Szhanghch05     asyncResp->res.jsonValue["Description"] = "Session Collection";
163724340d7SEd Tanous }
1642b7981f6SKowalski, Kamil 
165724340d7SEd Tanous inline void handleSessionCollectionMembersGet(
16645ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
167724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
168724340d7SEd Tanous {
1693ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
17045ca1b86SEd Tanous     {
17145ca1b86SEd Tanous         return;
17245ca1b86SEd Tanous     }
173724340d7SEd Tanous     asyncResp->res.jsonValue = getSessionCollectionMembers();
174724340d7SEd Tanous }
175724340d7SEd Tanous 
1764ee8e211SEd Tanous inline void handleSessionCollectionPost(
17745ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
178724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
179724340d7SEd Tanous {
1803ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
18145ca1b86SEd Tanous     {
18245ca1b86SEd Tanous         return;
18345ca1b86SEd Tanous     }
1849712f8acSEd Tanous     std::string username;
1859712f8acSEd Tanous     std::string password;
186bb759e3aSEd Tanous     std::optional<std::string> clientId;
187724340d7SEd Tanous     if (!json_util::readJsonPatch(req, asyncResp->res, "UserName", username,
188d678d4fcSEd Tanous                                   "Password", password, "Context", clientId))
1891abe55efSEd Tanous     {
1902b7981f6SKowalski, Kamil         return;
1912b7981f6SKowalski, Kamil     }
1922b7981f6SKowalski, Kamil 
193820ce598SEd Tanous     if (password.empty() || username.empty() ||
1948d1b46d7Szhanghch05         asyncResp->res.result() != boost::beast::http::status::ok)
1951abe55efSEd Tanous     {
1961abe55efSEd Tanous         if (username.empty())
1971abe55efSEd Tanous         {
1988d1b46d7Szhanghch05             messages::propertyMissing(asyncResp->res, "UserName");
199f4c4dcf4SKowalski, Kamil         }
200f4c4dcf4SKowalski, Kamil 
2011abe55efSEd Tanous         if (password.empty())
2021abe55efSEd Tanous         {
2038d1b46d7Szhanghch05             messages::propertyMissing(asyncResp->res, "Password");
204820ce598SEd Tanous         }
205820ce598SEd Tanous 
206820ce598SEd Tanous         return;
207f4c4dcf4SKowalski, Kamil     }
2082b7981f6SKowalski, Kamil 
2093bf4e632SJoseph Reynolds     int pamrc = pamAuthenticateUser(username, password);
2103bf4e632SJoseph Reynolds     bool isConfigureSelfOnly = pamrc == PAM_NEW_AUTHTOK_REQD;
2113bf4e632SJoseph Reynolds     if ((pamrc != PAM_SUCCESS) && !isConfigureSelfOnly)
2121abe55efSEd Tanous     {
21339662a3bSEd Tanous         messages::resourceAtUriUnauthorized(asyncResp->res, req.url(),
214f12894f8SJason M. Bills                                             "Invalid username or password");
215820ce598SEd Tanous         return;
2162b7981f6SKowalski, Kamil     }
2176f115bbbSManojkiran Eda 
218820ce598SEd Tanous     // User is authenticated - create session
21952cc112dSEd Tanous     std::shared_ptr<persistent_data::UserSession> session =
220724340d7SEd Tanous         persistent_data::SessionStore::getInstance().generateUserSession(
22141d61c82SJiaqing Zhao             username, req.ipAddress, clientId,
222724340d7SEd Tanous             persistent_data::PersistenceType::TIMEOUT, isConfigureSelfOnly);
22302e53aefSBrad Bishop     if (session == nullptr)
22402e53aefSBrad Bishop     {
22502e53aefSBrad Bishop         messages::internalError(asyncResp->res);
22602e53aefSBrad Bishop         return;
22702e53aefSBrad Bishop     }
22802e53aefSBrad Bishop 
2298d1b46d7Szhanghch05     asyncResp->res.addHeader("X-Auth-Token", session->sessionToken);
230faa34ccfSEd Tanous     asyncResp->res.addHeader(
231724340d7SEd Tanous         "Location", "/redfish/v1/SessionService/Sessions/" + session->uniqueId);
2328d1b46d7Szhanghch05     asyncResp->res.result(boost::beast::http::status::created);
2333bf4e632SJoseph Reynolds     if (session->isConfigureSelfOnly)
2343bf4e632SJoseph Reynolds     {
2353bf4e632SJoseph Reynolds         messages::passwordChangeRequired(
236724340d7SEd Tanous             asyncResp->res,
237724340d7SEd Tanous             crow::utility::urlFromPieces("redfish", "v1", "AccountService",
23885e6471bSBrad Bishop                                          "Accounts", session->username));
2392b7981f6SKowalski, Kamil     }
2402b7981f6SKowalski, Kamil 
241faa34ccfSEd Tanous     fillSessionObject(asyncResp->res, *session);
242724340d7SEd Tanous }
243a1e0871dSEd Tanous inline void handleSessionServiceHead(
244a1e0871dSEd Tanous     crow::App& app, const crow::Request& req,
245a1e0871dSEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
246a1e0871dSEd Tanous {
247a1e0871dSEd Tanous     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
248a1e0871dSEd Tanous     {
249a1e0871dSEd Tanous         return;
250a1e0871dSEd Tanous     }
251a1e0871dSEd Tanous     asyncResp->res.addHeader(
252a1e0871dSEd Tanous         boost::beast::http::field::link,
253a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/SessionService/SessionService.json>; rel=describedby");
254a1e0871dSEd Tanous }
255724340d7SEd Tanous inline void
25645ca1b86SEd Tanous     handleSessionServiceGet(crow::App& app, const crow::Request& req,
257724340d7SEd Tanous                             const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
2582b7981f6SKowalski, Kamil 
259724340d7SEd Tanous {
260a1e0871dSEd Tanous     handleSessionServiceHead(app, req, asyncResp);
2618d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.type"] =
2628d1b46d7Szhanghch05         "#SessionService.v1_0_2.SessionService";
263724340d7SEd Tanous     asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/SessionService/";
2648d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Session Service";
2658d1b46d7Szhanghch05     asyncResp->res.jsonValue["Id"] = "SessionService";
2668d1b46d7Szhanghch05     asyncResp->res.jsonValue["Description"] = "Session Service";
2678d1b46d7Szhanghch05     asyncResp->res.jsonValue["SessionTimeout"] =
268724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getTimeoutInSeconds();
2698d1b46d7Szhanghch05     asyncResp->res.jsonValue["ServiceEnabled"] = true;
2700f74e643SEd Tanous 
2711476687dSEd Tanous     asyncResp->res.jsonValue["Sessions"]["@odata.id"] =
2721476687dSEd Tanous         "/redfish/v1/SessionService/Sessions";
273724340d7SEd Tanous }
274f2a4a606SManojkiran Eda 
275724340d7SEd Tanous inline void handleSessionServicePatch(
27645ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
277724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
278724340d7SEd Tanous {
2793ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
28045ca1b86SEd Tanous     {
28145ca1b86SEd Tanous         return;
28245ca1b86SEd Tanous     }
283f2a4a606SManojkiran Eda     std::optional<int64_t> sessionTimeout;
284724340d7SEd Tanous     if (!json_util::readJsonPatch(req, asyncResp->res, "SessionTimeout",
285724340d7SEd Tanous                                   sessionTimeout))
286f2a4a606SManojkiran Eda     {
287f2a4a606SManojkiran Eda         return;
288f2a4a606SManojkiran Eda     }
289f2a4a606SManojkiran Eda 
290f2a4a606SManojkiran Eda     if (sessionTimeout)
291f2a4a606SManojkiran Eda     {
292faa34ccfSEd Tanous         // The mininum & maximum allowed values for session timeout
293faa34ccfSEd Tanous         // are 30 seconds and 86400 seconds respectively as per the
294faa34ccfSEd Tanous         // session service schema mentioned at
295f2a4a606SManojkiran Eda         // https://redfish.dmtf.org/schemas/v1/SessionService.v1_1_7.json
296f2a4a606SManojkiran Eda 
297f2a4a606SManojkiran Eda         if (*sessionTimeout <= 86400 && *sessionTimeout >= 30)
298f2a4a606SManojkiran Eda         {
299724340d7SEd Tanous             std::chrono::seconds sessionTimeoutInseconds(*sessionTimeout);
300724340d7SEd Tanous             persistent_data::SessionStore::getInstance().updateSessionTimeout(
301724340d7SEd Tanous                 sessionTimeoutInseconds);
302724340d7SEd Tanous             messages::propertyValueModified(asyncResp->res, "SessionTimeOut",
303f2a4a606SManojkiran Eda                                             std::to_string(*sessionTimeout));
304f2a4a606SManojkiran Eda         }
305f2a4a606SManojkiran Eda         else
306f2a4a606SManojkiran Eda         {
307724340d7SEd Tanous             messages::propertyValueNotInList(asyncResp->res,
308724340d7SEd Tanous                                              std::to_string(*sessionTimeout),
3098d1b46d7Szhanghch05                                              "SessionTimeOut");
310f2a4a606SManojkiran Eda         }
311f2a4a606SManojkiran Eda     }
312724340d7SEd Tanous }
313724340d7SEd Tanous 
314724340d7SEd Tanous inline void requestRoutesSession(App& app)
315724340d7SEd Tanous {
316724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
317a1e0871dSEd Tanous         .privileges(redfish::privileges::headSession)
318a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
319a1e0871dSEd Tanous             std::bind_front(handleSessionHead, std::ref(app)));
320a1e0871dSEd Tanous 
321a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
322724340d7SEd Tanous         .privileges(redfish::privileges::getSession)
32345ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
32445ca1b86SEd Tanous             std::bind_front(handleSessionGet, std::ref(app)));
325724340d7SEd Tanous 
326724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
327724340d7SEd Tanous         .privileges(redfish::privileges::deleteSession)
32845ca1b86SEd Tanous         .methods(boost::beast::http::verb::delete_)(
32945ca1b86SEd Tanous             std::bind_front(handleSessionDelete, std::ref(app)));
330724340d7SEd Tanous 
331724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
332a1e0871dSEd Tanous         .privileges(redfish::privileges::headSessionCollection)
333a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
334a1e0871dSEd Tanous             std::bind_front(handleSessionCollectionHead, std::ref(app)));
335a1e0871dSEd Tanous 
336a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
337724340d7SEd Tanous         .privileges(redfish::privileges::getSessionCollection)
33845ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
33945ca1b86SEd Tanous             std::bind_front(handleSessionCollectionGet, std::ref(app)));
340724340d7SEd Tanous 
341e76cd868SEd Tanous     // Note, the next two routes technically don't match the privilege
342724340d7SEd Tanous     // registry given the way login mechanisms work.  The base privilege
343724340d7SEd Tanous     // registry lists this endpoint as requiring login privilege, but because
344724340d7SEd Tanous     // this is the endpoint responsible for giving the login privilege, and it
345724340d7SEd Tanous     // is itself its own route, it needs to not require Login
346724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
347724340d7SEd Tanous         .privileges({})
34845ca1b86SEd Tanous         .methods(boost::beast::http::verb::post)(
34945ca1b86SEd Tanous             std::bind_front(handleSessionCollectionPost, std::ref(app)));
350724340d7SEd Tanous 
351e76cd868SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/Members/")
352e76cd868SEd Tanous         .privileges({})
35345ca1b86SEd Tanous         .methods(boost::beast::http::verb::post)(
35445ca1b86SEd Tanous             std::bind_front(handleSessionCollectionPost, std::ref(app)));
355e76cd868SEd Tanous 
356724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
357a1e0871dSEd Tanous         .privileges(redfish::privileges::headSessionService)
358a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
359a1e0871dSEd Tanous             std::bind_front(handleSessionServiceHead, std::ref(app)));
360a1e0871dSEd Tanous 
361a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
362724340d7SEd Tanous         .privileges(redfish::privileges::getSessionService)
36345ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
36445ca1b86SEd Tanous             std::bind_front(handleSessionServiceGet, std::ref(app)));
365724340d7SEd Tanous 
366724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
367724340d7SEd Tanous         .privileges(redfish::privileges::patchSessionService)
36845ca1b86SEd Tanous         .methods(boost::beast::http::verb::patch)(
36945ca1b86SEd Tanous             std::bind_front(handleSessionServicePatch, std::ref(app)));
370f2a4a606SManojkiran Eda }
3715d27b854SBorawski.Lukasz 
3722b7981f6SKowalski, Kamil } // namespace redfish
373