xref: /openbmc/bmcweb/features/redfish/lib/redfish_sessions.hpp (revision ef4c65b741724d724452a3a0efe8dff0d450514a)
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 
26*ef4c65b7SEd Tanous #include <boost/url/format.hpp>
27*ef4c65b7SEd Tanous 
281abe55efSEd Tanous namespace redfish
291abe55efSEd Tanous {
302b7981f6SKowalski, Kamil 
314f48d5f6SEd Tanous inline void fillSessionObject(crow::Response& res,
32faa34ccfSEd Tanous                               const persistent_data::UserSession& session)
331abe55efSEd Tanous {
34faa34ccfSEd Tanous     res.jsonValue["Id"] = session.uniqueId;
35faa34ccfSEd Tanous     res.jsonValue["UserName"] = session.username;
36*ef4c65b7SEd Tanous     res.jsonValue["@odata.id"] = boost::urls::format(
37*ef4c65b7SEd Tanous         "/redfish/v1/SessionService/Sessions/{}", session.uniqueId);
38bb759e3aSEd Tanous     res.jsonValue["@odata.type"] = "#Session.v1_5_0.Session";
39faa34ccfSEd Tanous     res.jsonValue["Name"] = "User Session";
40faa34ccfSEd Tanous     res.jsonValue["Description"] = "Manager User Session";
41faa34ccfSEd Tanous     res.jsonValue["ClientOriginIPAddress"] = session.clientIp;
42bb759e3aSEd Tanous     if (session.clientId)
43bb759e3aSEd Tanous     {
44bb759e3aSEd Tanous         res.jsonValue["Context"] = *session.clientId;
45bb759e3aSEd Tanous     }
462b7981f6SKowalski, Kamil }
472b7981f6SKowalski, Kamil 
48724340d7SEd Tanous inline void
49a1e0871dSEd Tanous     handleSessionHead(crow::App& app, const crow::Request& req,
50faa34ccfSEd Tanous                       const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
51a1e0871dSEd Tanous                       const std::string& /*sessionId*/)
52724340d7SEd Tanous {
533ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
5445ca1b86SEd Tanous     {
5545ca1b86SEd Tanous         return;
5645ca1b86SEd Tanous     }
57a1e0871dSEd Tanous     asyncResp->res.addHeader(
58a1e0871dSEd Tanous         boost::beast::http::field::link,
59a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/Session/Session.json>; rel=describedby");
60a1e0871dSEd Tanous }
61a1e0871dSEd Tanous 
62a1e0871dSEd Tanous inline void
63a1e0871dSEd Tanous     handleSessionGet(crow::App& app, const crow::Request& req,
64a1e0871dSEd Tanous                      const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
65a1e0871dSEd Tanous                      const std::string& sessionId)
66a1e0871dSEd Tanous {
67a1e0871dSEd Tanous     handleSessionHead(app, req, asyncResp, sessionId);
68a1e0871dSEd Tanous 
69faa34ccfSEd Tanous     // Note that control also reaches here via doPost and doDelete.
70724340d7SEd Tanous     auto session =
71724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getSessionByUid(sessionId);
722b7981f6SKowalski, Kamil 
731abe55efSEd Tanous     if (session == nullptr)
741abe55efSEd Tanous     {
75724340d7SEd Tanous         messages::resourceNotFound(asyncResp->res, "Session", sessionId);
76faa34ccfSEd Tanous         return;
77faa34ccfSEd Tanous     }
78faa34ccfSEd Tanous 
79faa34ccfSEd Tanous     fillSessionObject(asyncResp->res, *session);
80724340d7SEd Tanous }
81faa34ccfSEd Tanous 
82724340d7SEd Tanous inline void
8345ca1b86SEd Tanous     handleSessionDelete(crow::App& app, const crow::Request& req,
84faa34ccfSEd Tanous                         const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
85724340d7SEd Tanous                         const std::string& sessionId)
86724340d7SEd Tanous {
873ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
8845ca1b86SEd Tanous     {
8945ca1b86SEd Tanous         return;
9045ca1b86SEd Tanous     }
91724340d7SEd Tanous     auto session =
92724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getSessionByUid(sessionId);
93faa34ccfSEd Tanous 
94faa34ccfSEd Tanous     if (session == nullptr)
95faa34ccfSEd Tanous     {
96724340d7SEd Tanous         messages::resourceNotFound(asyncResp->res, "Session", sessionId);
972b7981f6SKowalski, Kamil         return;
982b7981f6SKowalski, Kamil     }
992b7981f6SKowalski, Kamil 
100900f9497SJoseph Reynolds     // Perform a proper ConfigureSelf authority check.  If a
101900f9497SJoseph Reynolds     // session is being used to DELETE some other user's session,
102900f9497SJoseph Reynolds     // then the ConfigureSelf privilege does not apply.  In that
103900f9497SJoseph Reynolds     // case, perform the authority check again without the user's
104900f9497SJoseph Reynolds     // ConfigureSelf privilege.
1050fd29865Swukaihua-fii-na     if (req.session != nullptr && !session->username.empty() &&
1060fd29865Swukaihua-fii-na         session->username != req.session->username)
107900f9497SJoseph Reynolds     {
1086c51eab1SEd Tanous         Privileges effectiveUserPrivileges =
1096c51eab1SEd Tanous             redfish::getUserPrivileges(req.userRole);
1106c51eab1SEd Tanous 
111724340d7SEd Tanous         if (!effectiveUserPrivileges.isSupersetOf({"ConfigureUsers"}))
112900f9497SJoseph Reynolds         {
1138d1b46d7Szhanghch05             messages::insufficientPrivilege(asyncResp->res);
114900f9497SJoseph Reynolds             return;
115900f9497SJoseph Reynolds         }
116900f9497SJoseph Reynolds     }
117900f9497SJoseph Reynolds 
118724340d7SEd Tanous     persistent_data::SessionStore::getInstance().removeSession(session);
1195cc148afSEd Tanous     messages::success(asyncResp->res);
120724340d7SEd Tanous }
121f4c4dcf4SKowalski, Kamil 
122724340d7SEd Tanous inline nlohmann::json getSessionCollectionMembers()
123724340d7SEd Tanous {
12455c7b7a2SEd Tanous     std::vector<const std::string*> sessionIds =
12552cc112dSEd Tanous         persistent_data::SessionStore::getInstance().getUniqueIds(
12652cc112dSEd Tanous             false, persistent_data::PersistenceType::TIMEOUT);
127724340d7SEd Tanous     nlohmann::json ret = nlohmann::json::array();
1281abe55efSEd Tanous     for (const std::string* uid : sessionIds)
1291abe55efSEd Tanous     {
1301476687dSEd Tanous         nlohmann::json::object_t session;
131*ef4c65b7SEd Tanous         session["@odata.id"] =
132*ef4c65b7SEd Tanous             boost::urls::format("/redfish/v1/SessionService/Sessions/{}", *uid);
133b2ba3072SPatrick Williams         ret.emplace_back(std::move(session));
1342b7981f6SKowalski, Kamil     }
135724340d7SEd Tanous     return ret;
136724340d7SEd Tanous }
137724340d7SEd Tanous 
138a1e0871dSEd Tanous inline void handleSessionCollectionHead(
13945ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
140724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
141724340d7SEd Tanous {
1423ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
14345ca1b86SEd Tanous     {
14445ca1b86SEd Tanous         return;
14545ca1b86SEd Tanous     }
146a1e0871dSEd Tanous     asyncResp->res.addHeader(
147a1e0871dSEd Tanous         boost::beast::http::field::link,
148a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/SessionCollection.json>; rel=describedby");
149a1e0871dSEd Tanous }
150a1e0871dSEd Tanous 
151a1e0871dSEd Tanous inline void handleSessionCollectionGet(
152a1e0871dSEd Tanous     crow::App& app, const crow::Request& req,
153a1e0871dSEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
154a1e0871dSEd Tanous {
155a1e0871dSEd Tanous     handleSessionCollectionHead(app, req, asyncResp);
156724340d7SEd Tanous     asyncResp->res.jsonValue["Members"] = getSessionCollectionMembers();
157faa34ccfSEd Tanous     asyncResp->res.jsonValue["Members@odata.count"] =
158724340d7SEd Tanous         asyncResp->res.jsonValue["Members"].size();
1598d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.type"] =
1608d1b46d7Szhanghch05         "#SessionCollection.SessionCollection";
1618d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.id"] =
1628d1b46d7Szhanghch05         "/redfish/v1/SessionService/Sessions/";
1638d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Session Collection";
1648d1b46d7Szhanghch05     asyncResp->res.jsonValue["Description"] = "Session Collection";
165724340d7SEd Tanous }
1662b7981f6SKowalski, Kamil 
167724340d7SEd Tanous inline void handleSessionCollectionMembersGet(
16845ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
169724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
170724340d7SEd Tanous {
1713ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
17245ca1b86SEd Tanous     {
17345ca1b86SEd Tanous         return;
17445ca1b86SEd Tanous     }
175724340d7SEd Tanous     asyncResp->res.jsonValue = getSessionCollectionMembers();
176724340d7SEd Tanous }
177724340d7SEd Tanous 
1784ee8e211SEd Tanous inline void handleSessionCollectionPost(
17945ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
180724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
181724340d7SEd Tanous {
1823ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
18345ca1b86SEd Tanous     {
18445ca1b86SEd Tanous         return;
18545ca1b86SEd Tanous     }
1869712f8acSEd Tanous     std::string username;
1879712f8acSEd Tanous     std::string password;
188bb759e3aSEd Tanous     std::optional<std::string> clientId;
189724340d7SEd Tanous     if (!json_util::readJsonPatch(req, asyncResp->res, "UserName", username,
190d678d4fcSEd Tanous                                   "Password", password, "Context", clientId))
1911abe55efSEd Tanous     {
1922b7981f6SKowalski, Kamil         return;
1932b7981f6SKowalski, Kamil     }
1942b7981f6SKowalski, Kamil 
195820ce598SEd Tanous     if (password.empty() || username.empty() ||
1968d1b46d7Szhanghch05         asyncResp->res.result() != boost::beast::http::status::ok)
1971abe55efSEd Tanous     {
1981abe55efSEd Tanous         if (username.empty())
1991abe55efSEd Tanous         {
2008d1b46d7Szhanghch05             messages::propertyMissing(asyncResp->res, "UserName");
201f4c4dcf4SKowalski, Kamil         }
202f4c4dcf4SKowalski, Kamil 
2031abe55efSEd Tanous         if (password.empty())
2041abe55efSEd Tanous         {
2058d1b46d7Szhanghch05             messages::propertyMissing(asyncResp->res, "Password");
206820ce598SEd Tanous         }
207820ce598SEd Tanous 
208820ce598SEd Tanous         return;
209f4c4dcf4SKowalski, Kamil     }
2102b7981f6SKowalski, Kamil 
2113bf4e632SJoseph Reynolds     int pamrc = pamAuthenticateUser(username, password);
2123bf4e632SJoseph Reynolds     bool isConfigureSelfOnly = pamrc == PAM_NEW_AUTHTOK_REQD;
2133bf4e632SJoseph Reynolds     if ((pamrc != PAM_SUCCESS) && !isConfigureSelfOnly)
2141abe55efSEd Tanous     {
21539662a3bSEd Tanous         messages::resourceAtUriUnauthorized(asyncResp->res, req.url(),
216f12894f8SJason M. Bills                                             "Invalid username or password");
217820ce598SEd Tanous         return;
2182b7981f6SKowalski, Kamil     }
2196f115bbbSManojkiran Eda 
220820ce598SEd Tanous     // User is authenticated - create session
22152cc112dSEd Tanous     std::shared_ptr<persistent_data::UserSession> session =
222724340d7SEd Tanous         persistent_data::SessionStore::getInstance().generateUserSession(
22341d61c82SJiaqing Zhao             username, req.ipAddress, clientId,
224724340d7SEd Tanous             persistent_data::PersistenceType::TIMEOUT, isConfigureSelfOnly);
22502e53aefSBrad Bishop     if (session == nullptr)
22602e53aefSBrad Bishop     {
22702e53aefSBrad Bishop         messages::internalError(asyncResp->res);
22802e53aefSBrad Bishop         return;
22902e53aefSBrad Bishop     }
23002e53aefSBrad Bishop 
2318d1b46d7Szhanghch05     asyncResp->res.addHeader("X-Auth-Token", session->sessionToken);
232faa34ccfSEd Tanous     asyncResp->res.addHeader(
233724340d7SEd Tanous         "Location", "/redfish/v1/SessionService/Sessions/" + session->uniqueId);
2348d1b46d7Szhanghch05     asyncResp->res.result(boost::beast::http::status::created);
2353bf4e632SJoseph Reynolds     if (session->isConfigureSelfOnly)
2363bf4e632SJoseph Reynolds     {
2373bf4e632SJoseph Reynolds         messages::passwordChangeRequired(
238724340d7SEd Tanous             asyncResp->res,
239*ef4c65b7SEd Tanous             boost::urls::format("/redfish/v1/AccountService/Accounts/{}",
240*ef4c65b7SEd Tanous                                 session->username));
2412b7981f6SKowalski, Kamil     }
2422b7981f6SKowalski, Kamil 
243faa34ccfSEd Tanous     fillSessionObject(asyncResp->res, *session);
244724340d7SEd Tanous }
245a1e0871dSEd Tanous inline void handleSessionServiceHead(
246a1e0871dSEd Tanous     crow::App& app, const crow::Request& req,
247a1e0871dSEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
248a1e0871dSEd Tanous {
249a1e0871dSEd Tanous     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
250a1e0871dSEd Tanous     {
251a1e0871dSEd Tanous         return;
252a1e0871dSEd Tanous     }
253a1e0871dSEd Tanous     asyncResp->res.addHeader(
254a1e0871dSEd Tanous         boost::beast::http::field::link,
255a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/SessionService/SessionService.json>; rel=describedby");
256a1e0871dSEd Tanous }
257724340d7SEd Tanous inline void
25845ca1b86SEd Tanous     handleSessionServiceGet(crow::App& app, const crow::Request& req,
259724340d7SEd Tanous                             const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
2602b7981f6SKowalski, Kamil 
261724340d7SEd Tanous {
262a1e0871dSEd Tanous     handleSessionServiceHead(app, req, asyncResp);
2638d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.type"] =
2648d1b46d7Szhanghch05         "#SessionService.v1_0_2.SessionService";
265724340d7SEd Tanous     asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/SessionService/";
2668d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Session Service";
2678d1b46d7Szhanghch05     asyncResp->res.jsonValue["Id"] = "SessionService";
2688d1b46d7Szhanghch05     asyncResp->res.jsonValue["Description"] = "Session Service";
2698d1b46d7Szhanghch05     asyncResp->res.jsonValue["SessionTimeout"] =
270724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getTimeoutInSeconds();
2718d1b46d7Szhanghch05     asyncResp->res.jsonValue["ServiceEnabled"] = true;
2720f74e643SEd Tanous 
2731476687dSEd Tanous     asyncResp->res.jsonValue["Sessions"]["@odata.id"] =
2741476687dSEd Tanous         "/redfish/v1/SessionService/Sessions";
275724340d7SEd Tanous }
276f2a4a606SManojkiran Eda 
277724340d7SEd Tanous inline void handleSessionServicePatch(
27845ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
279724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
280724340d7SEd Tanous {
2813ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
28245ca1b86SEd Tanous     {
28345ca1b86SEd Tanous         return;
28445ca1b86SEd Tanous     }
285f2a4a606SManojkiran Eda     std::optional<int64_t> sessionTimeout;
286724340d7SEd Tanous     if (!json_util::readJsonPatch(req, asyncResp->res, "SessionTimeout",
287724340d7SEd Tanous                                   sessionTimeout))
288f2a4a606SManojkiran Eda     {
289f2a4a606SManojkiran Eda         return;
290f2a4a606SManojkiran Eda     }
291f2a4a606SManojkiran Eda 
292f2a4a606SManojkiran Eda     if (sessionTimeout)
293f2a4a606SManojkiran Eda     {
294faa34ccfSEd Tanous         // The mininum & maximum allowed values for session timeout
295faa34ccfSEd Tanous         // are 30 seconds and 86400 seconds respectively as per the
296faa34ccfSEd Tanous         // session service schema mentioned at
297f2a4a606SManojkiran Eda         // https://redfish.dmtf.org/schemas/v1/SessionService.v1_1_7.json
298f2a4a606SManojkiran Eda 
299f2a4a606SManojkiran Eda         if (*sessionTimeout <= 86400 && *sessionTimeout >= 30)
300f2a4a606SManojkiran Eda         {
301724340d7SEd Tanous             std::chrono::seconds sessionTimeoutInseconds(*sessionTimeout);
302724340d7SEd Tanous             persistent_data::SessionStore::getInstance().updateSessionTimeout(
303724340d7SEd Tanous                 sessionTimeoutInseconds);
304724340d7SEd Tanous             messages::propertyValueModified(asyncResp->res, "SessionTimeOut",
305f2a4a606SManojkiran Eda                                             std::to_string(*sessionTimeout));
306f2a4a606SManojkiran Eda         }
307f2a4a606SManojkiran Eda         else
308f2a4a606SManojkiran Eda         {
309724340d7SEd Tanous             messages::propertyValueNotInList(asyncResp->res,
310724340d7SEd Tanous                                              std::to_string(*sessionTimeout),
3118d1b46d7Szhanghch05                                              "SessionTimeOut");
312f2a4a606SManojkiran Eda         }
313f2a4a606SManojkiran Eda     }
314724340d7SEd Tanous }
315724340d7SEd Tanous 
316724340d7SEd Tanous inline void requestRoutesSession(App& app)
317724340d7SEd Tanous {
318724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
319a1e0871dSEd Tanous         .privileges(redfish::privileges::headSession)
320a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
321a1e0871dSEd Tanous             std::bind_front(handleSessionHead, std::ref(app)));
322a1e0871dSEd Tanous 
323a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
324724340d7SEd Tanous         .privileges(redfish::privileges::getSession)
32545ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
32645ca1b86SEd Tanous             std::bind_front(handleSessionGet, std::ref(app)));
327724340d7SEd Tanous 
328724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
329724340d7SEd Tanous         .privileges(redfish::privileges::deleteSession)
33045ca1b86SEd Tanous         .methods(boost::beast::http::verb::delete_)(
33145ca1b86SEd Tanous             std::bind_front(handleSessionDelete, std::ref(app)));
332724340d7SEd Tanous 
333724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
334a1e0871dSEd Tanous         .privileges(redfish::privileges::headSessionCollection)
335a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
336a1e0871dSEd Tanous             std::bind_front(handleSessionCollectionHead, std::ref(app)));
337a1e0871dSEd Tanous 
338a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
339724340d7SEd Tanous         .privileges(redfish::privileges::getSessionCollection)
34045ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
34145ca1b86SEd Tanous             std::bind_front(handleSessionCollectionGet, std::ref(app)));
342724340d7SEd Tanous 
343e76cd868SEd Tanous     // Note, the next two routes technically don't match the privilege
344724340d7SEd Tanous     // registry given the way login mechanisms work.  The base privilege
345724340d7SEd Tanous     // registry lists this endpoint as requiring login privilege, but because
346724340d7SEd Tanous     // this is the endpoint responsible for giving the login privilege, and it
347724340d7SEd Tanous     // is itself its own route, it needs to not require Login
348724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
349724340d7SEd Tanous         .privileges({})
35045ca1b86SEd Tanous         .methods(boost::beast::http::verb::post)(
35145ca1b86SEd Tanous             std::bind_front(handleSessionCollectionPost, std::ref(app)));
352724340d7SEd Tanous 
353e76cd868SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/Members/")
354e76cd868SEd Tanous         .privileges({})
35545ca1b86SEd Tanous         .methods(boost::beast::http::verb::post)(
35645ca1b86SEd Tanous             std::bind_front(handleSessionCollectionPost, std::ref(app)));
357e76cd868SEd Tanous 
358724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
359a1e0871dSEd Tanous         .privileges(redfish::privileges::headSessionService)
360a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
361a1e0871dSEd Tanous             std::bind_front(handleSessionServiceHead, std::ref(app)));
362a1e0871dSEd Tanous 
363a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
364724340d7SEd Tanous         .privileges(redfish::privileges::getSessionService)
36545ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
36645ca1b86SEd Tanous             std::bind_front(handleSessionServiceGet, std::ref(app)));
367724340d7SEd Tanous 
368724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
369724340d7SEd Tanous         .privileges(redfish::privileges::patchSessionService)
37045ca1b86SEd Tanous         .methods(boost::beast::http::verb::patch)(
37145ca1b86SEd Tanous             std::bind_front(handleSessionServicePatch, std::ref(app)));
372f2a4a606SManojkiran Eda }
3735d27b854SBorawski.Lukasz 
3742b7981f6SKowalski, Kamil } // namespace redfish
375