xref: /openbmc/bmcweb/features/redfish/lib/redfish_sessions.hpp (revision 65ffbcb3c80bb5147897e5fa16b7073b439ed609)
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 
26ef4c65b7SEd Tanous #include <boost/url/format.hpp>
27ef4c65b7SEd 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;
36ef4c65b7SEd Tanous     res.jsonValue["@odata.id"] = boost::urls::format(
37ef4c65b7SEd 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 {
67*65ffbcb3SEd Tanous     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
68*65ffbcb3SEd Tanous     {
69*65ffbcb3SEd Tanous         return;
70*65ffbcb3SEd Tanous     }
71*65ffbcb3SEd Tanous     asyncResp->res.addHeader(
72*65ffbcb3SEd Tanous         boost::beast::http::field::link,
73*65ffbcb3SEd Tanous         "</redfish/v1/JsonSchemas/Session/Session.json>; rel=describedby");
74a1e0871dSEd Tanous 
75faa34ccfSEd Tanous     // Note that control also reaches here via doPost and doDelete.
76724340d7SEd Tanous     auto session =
77724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getSessionByUid(sessionId);
782b7981f6SKowalski, Kamil 
791abe55efSEd Tanous     if (session == nullptr)
801abe55efSEd Tanous     {
81724340d7SEd Tanous         messages::resourceNotFound(asyncResp->res, "Session", sessionId);
82faa34ccfSEd Tanous         return;
83faa34ccfSEd Tanous     }
84faa34ccfSEd Tanous 
85faa34ccfSEd Tanous     fillSessionObject(asyncResp->res, *session);
86724340d7SEd Tanous }
87faa34ccfSEd Tanous 
88724340d7SEd Tanous inline void
8945ca1b86SEd Tanous     handleSessionDelete(crow::App& app, const crow::Request& req,
90faa34ccfSEd Tanous                         const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
91724340d7SEd Tanous                         const std::string& sessionId)
92724340d7SEd Tanous {
933ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
9445ca1b86SEd Tanous     {
9545ca1b86SEd Tanous         return;
9645ca1b86SEd Tanous     }
97724340d7SEd Tanous     auto session =
98724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getSessionByUid(sessionId);
99faa34ccfSEd Tanous 
100faa34ccfSEd Tanous     if (session == nullptr)
101faa34ccfSEd Tanous     {
102724340d7SEd Tanous         messages::resourceNotFound(asyncResp->res, "Session", sessionId);
1032b7981f6SKowalski, Kamil         return;
1042b7981f6SKowalski, Kamil     }
1052b7981f6SKowalski, Kamil 
106900f9497SJoseph Reynolds     // Perform a proper ConfigureSelf authority check.  If a
107900f9497SJoseph Reynolds     // session is being used to DELETE some other user's session,
108900f9497SJoseph Reynolds     // then the ConfigureSelf privilege does not apply.  In that
109900f9497SJoseph Reynolds     // case, perform the authority check again without the user's
110900f9497SJoseph Reynolds     // ConfigureSelf privilege.
1110fd29865Swukaihua-fii-na     if (req.session != nullptr && !session->username.empty() &&
1120fd29865Swukaihua-fii-na         session->username != req.session->username)
113900f9497SJoseph Reynolds     {
1146c51eab1SEd Tanous         Privileges effectiveUserPrivileges =
1156c51eab1SEd Tanous             redfish::getUserPrivileges(req.userRole);
1166c51eab1SEd Tanous 
117724340d7SEd Tanous         if (!effectiveUserPrivileges.isSupersetOf({"ConfigureUsers"}))
118900f9497SJoseph Reynolds         {
1198d1b46d7Szhanghch05             messages::insufficientPrivilege(asyncResp->res);
120900f9497SJoseph Reynolds             return;
121900f9497SJoseph Reynolds         }
122900f9497SJoseph Reynolds     }
123900f9497SJoseph Reynolds 
124724340d7SEd Tanous     persistent_data::SessionStore::getInstance().removeSession(session);
1255cc148afSEd Tanous     messages::success(asyncResp->res);
126724340d7SEd Tanous }
127f4c4dcf4SKowalski, Kamil 
128724340d7SEd Tanous inline nlohmann::json getSessionCollectionMembers()
129724340d7SEd Tanous {
13055c7b7a2SEd Tanous     std::vector<const std::string*> sessionIds =
13152cc112dSEd Tanous         persistent_data::SessionStore::getInstance().getUniqueIds(
13252cc112dSEd Tanous             false, persistent_data::PersistenceType::TIMEOUT);
133724340d7SEd Tanous     nlohmann::json ret = nlohmann::json::array();
1341abe55efSEd Tanous     for (const std::string* uid : sessionIds)
1351abe55efSEd Tanous     {
1361476687dSEd Tanous         nlohmann::json::object_t session;
137ef4c65b7SEd Tanous         session["@odata.id"] =
138ef4c65b7SEd Tanous             boost::urls::format("/redfish/v1/SessionService/Sessions/{}", *uid);
139b2ba3072SPatrick Williams         ret.emplace_back(std::move(session));
1402b7981f6SKowalski, Kamil     }
141724340d7SEd Tanous     return ret;
142724340d7SEd Tanous }
143724340d7SEd Tanous 
144a1e0871dSEd Tanous inline void handleSessionCollectionHead(
14545ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
146724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
147724340d7SEd Tanous {
1483ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
14945ca1b86SEd Tanous     {
15045ca1b86SEd Tanous         return;
15145ca1b86SEd Tanous     }
152a1e0871dSEd Tanous     asyncResp->res.addHeader(
153a1e0871dSEd Tanous         boost::beast::http::field::link,
154a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/SessionCollection.json>; rel=describedby");
155a1e0871dSEd Tanous }
156a1e0871dSEd Tanous 
157a1e0871dSEd Tanous inline void handleSessionCollectionGet(
158a1e0871dSEd Tanous     crow::App& app, const crow::Request& req,
159a1e0871dSEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
160a1e0871dSEd Tanous {
161a1e0871dSEd Tanous     handleSessionCollectionHead(app, req, asyncResp);
162724340d7SEd Tanous     asyncResp->res.jsonValue["Members"] = getSessionCollectionMembers();
163faa34ccfSEd Tanous     asyncResp->res.jsonValue["Members@odata.count"] =
164724340d7SEd Tanous         asyncResp->res.jsonValue["Members"].size();
1658d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.type"] =
1668d1b46d7Szhanghch05         "#SessionCollection.SessionCollection";
1678d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.id"] =
1688d1b46d7Szhanghch05         "/redfish/v1/SessionService/Sessions/";
1698d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Session Collection";
1708d1b46d7Szhanghch05     asyncResp->res.jsonValue["Description"] = "Session Collection";
171724340d7SEd Tanous }
1722b7981f6SKowalski, Kamil 
173724340d7SEd Tanous inline void handleSessionCollectionMembersGet(
17445ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
175724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
176724340d7SEd Tanous {
1773ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
17845ca1b86SEd Tanous     {
17945ca1b86SEd Tanous         return;
18045ca1b86SEd Tanous     }
181724340d7SEd Tanous     asyncResp->res.jsonValue = getSessionCollectionMembers();
182724340d7SEd Tanous }
183724340d7SEd Tanous 
1844ee8e211SEd Tanous inline void handleSessionCollectionPost(
18545ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
186724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
187724340d7SEd Tanous {
1883ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
18945ca1b86SEd Tanous     {
19045ca1b86SEd Tanous         return;
19145ca1b86SEd Tanous     }
1929712f8acSEd Tanous     std::string username;
1939712f8acSEd Tanous     std::string password;
194bb759e3aSEd Tanous     std::optional<std::string> clientId;
195724340d7SEd Tanous     if (!json_util::readJsonPatch(req, asyncResp->res, "UserName", username,
196d678d4fcSEd Tanous                                   "Password", password, "Context", clientId))
1971abe55efSEd Tanous     {
1982b7981f6SKowalski, Kamil         return;
1992b7981f6SKowalski, Kamil     }
2002b7981f6SKowalski, Kamil 
201820ce598SEd Tanous     if (password.empty() || username.empty() ||
2028d1b46d7Szhanghch05         asyncResp->res.result() != boost::beast::http::status::ok)
2031abe55efSEd Tanous     {
2041abe55efSEd Tanous         if (username.empty())
2051abe55efSEd Tanous         {
2068d1b46d7Szhanghch05             messages::propertyMissing(asyncResp->res, "UserName");
207f4c4dcf4SKowalski, Kamil         }
208f4c4dcf4SKowalski, Kamil 
2091abe55efSEd Tanous         if (password.empty())
2101abe55efSEd Tanous         {
2118d1b46d7Szhanghch05             messages::propertyMissing(asyncResp->res, "Password");
212820ce598SEd Tanous         }
213820ce598SEd Tanous 
214820ce598SEd Tanous         return;
215f4c4dcf4SKowalski, Kamil     }
2162b7981f6SKowalski, Kamil 
2173bf4e632SJoseph Reynolds     int pamrc = pamAuthenticateUser(username, password);
2183bf4e632SJoseph Reynolds     bool isConfigureSelfOnly = pamrc == PAM_NEW_AUTHTOK_REQD;
2193bf4e632SJoseph Reynolds     if ((pamrc != PAM_SUCCESS) && !isConfigureSelfOnly)
2201abe55efSEd Tanous     {
22139662a3bSEd Tanous         messages::resourceAtUriUnauthorized(asyncResp->res, req.url(),
222f12894f8SJason M. Bills                                             "Invalid username or password");
223820ce598SEd Tanous         return;
2242b7981f6SKowalski, Kamil     }
2256f115bbbSManojkiran Eda 
226820ce598SEd Tanous     // User is authenticated - create session
22752cc112dSEd Tanous     std::shared_ptr<persistent_data::UserSession> session =
228724340d7SEd Tanous         persistent_data::SessionStore::getInstance().generateUserSession(
22941d61c82SJiaqing Zhao             username, req.ipAddress, clientId,
230724340d7SEd Tanous             persistent_data::PersistenceType::TIMEOUT, isConfigureSelfOnly);
23102e53aefSBrad Bishop     if (session == nullptr)
23202e53aefSBrad Bishop     {
23302e53aefSBrad Bishop         messages::internalError(asyncResp->res);
23402e53aefSBrad Bishop         return;
23502e53aefSBrad Bishop     }
23602e53aefSBrad Bishop 
2378d1b46d7Szhanghch05     asyncResp->res.addHeader("X-Auth-Token", session->sessionToken);
238faa34ccfSEd Tanous     asyncResp->res.addHeader(
239724340d7SEd Tanous         "Location", "/redfish/v1/SessionService/Sessions/" + session->uniqueId);
2408d1b46d7Szhanghch05     asyncResp->res.result(boost::beast::http::status::created);
2413bf4e632SJoseph Reynolds     if (session->isConfigureSelfOnly)
2423bf4e632SJoseph Reynolds     {
2433bf4e632SJoseph Reynolds         messages::passwordChangeRequired(
244724340d7SEd Tanous             asyncResp->res,
245ef4c65b7SEd Tanous             boost::urls::format("/redfish/v1/AccountService/Accounts/{}",
246ef4c65b7SEd Tanous                                 session->username));
2472b7981f6SKowalski, Kamil     }
2482b7981f6SKowalski, Kamil 
249faa34ccfSEd Tanous     fillSessionObject(asyncResp->res, *session);
250724340d7SEd Tanous }
251a1e0871dSEd Tanous inline void handleSessionServiceHead(
252a1e0871dSEd Tanous     crow::App& app, const crow::Request& req,
253a1e0871dSEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
254a1e0871dSEd Tanous {
255a1e0871dSEd Tanous     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
256a1e0871dSEd Tanous     {
257a1e0871dSEd Tanous         return;
258a1e0871dSEd Tanous     }
259a1e0871dSEd Tanous     asyncResp->res.addHeader(
260a1e0871dSEd Tanous         boost::beast::http::field::link,
261a1e0871dSEd Tanous         "</redfish/v1/JsonSchemas/SessionService/SessionService.json>; rel=describedby");
262a1e0871dSEd Tanous }
263724340d7SEd Tanous inline void
26445ca1b86SEd Tanous     handleSessionServiceGet(crow::App& app, const crow::Request& req,
265724340d7SEd Tanous                             const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
2662b7981f6SKowalski, Kamil 
267724340d7SEd Tanous {
268a1e0871dSEd Tanous     handleSessionServiceHead(app, req, asyncResp);
2698d1b46d7Szhanghch05     asyncResp->res.jsonValue["@odata.type"] =
2708d1b46d7Szhanghch05         "#SessionService.v1_0_2.SessionService";
271724340d7SEd Tanous     asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/SessionService/";
2728d1b46d7Szhanghch05     asyncResp->res.jsonValue["Name"] = "Session Service";
2738d1b46d7Szhanghch05     asyncResp->res.jsonValue["Id"] = "SessionService";
2748d1b46d7Szhanghch05     asyncResp->res.jsonValue["Description"] = "Session Service";
2758d1b46d7Szhanghch05     asyncResp->res.jsonValue["SessionTimeout"] =
276724340d7SEd Tanous         persistent_data::SessionStore::getInstance().getTimeoutInSeconds();
2778d1b46d7Szhanghch05     asyncResp->res.jsonValue["ServiceEnabled"] = true;
2780f74e643SEd Tanous 
2791476687dSEd Tanous     asyncResp->res.jsonValue["Sessions"]["@odata.id"] =
2801476687dSEd Tanous         "/redfish/v1/SessionService/Sessions";
281724340d7SEd Tanous }
282f2a4a606SManojkiran Eda 
283724340d7SEd Tanous inline void handleSessionServicePatch(
28445ca1b86SEd Tanous     crow::App& app, const crow::Request& req,
285724340d7SEd Tanous     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
286724340d7SEd Tanous {
2873ba00073SCarson Labrado     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
28845ca1b86SEd Tanous     {
28945ca1b86SEd Tanous         return;
29045ca1b86SEd Tanous     }
291f2a4a606SManojkiran Eda     std::optional<int64_t> sessionTimeout;
292724340d7SEd Tanous     if (!json_util::readJsonPatch(req, asyncResp->res, "SessionTimeout",
293724340d7SEd Tanous                                   sessionTimeout))
294f2a4a606SManojkiran Eda     {
295f2a4a606SManojkiran Eda         return;
296f2a4a606SManojkiran Eda     }
297f2a4a606SManojkiran Eda 
298f2a4a606SManojkiran Eda     if (sessionTimeout)
299f2a4a606SManojkiran Eda     {
300faa34ccfSEd Tanous         // The mininum & maximum allowed values for session timeout
301faa34ccfSEd Tanous         // are 30 seconds and 86400 seconds respectively as per the
302faa34ccfSEd Tanous         // session service schema mentioned at
303f2a4a606SManojkiran Eda         // https://redfish.dmtf.org/schemas/v1/SessionService.v1_1_7.json
304f2a4a606SManojkiran Eda 
305f2a4a606SManojkiran Eda         if (*sessionTimeout <= 86400 && *sessionTimeout >= 30)
306f2a4a606SManojkiran Eda         {
307724340d7SEd Tanous             std::chrono::seconds sessionTimeoutInseconds(*sessionTimeout);
308724340d7SEd Tanous             persistent_data::SessionStore::getInstance().updateSessionTimeout(
309724340d7SEd Tanous                 sessionTimeoutInseconds);
310724340d7SEd Tanous             messages::propertyValueModified(asyncResp->res, "SessionTimeOut",
311f2a4a606SManojkiran Eda                                             std::to_string(*sessionTimeout));
312f2a4a606SManojkiran Eda         }
313f2a4a606SManojkiran Eda         else
314f2a4a606SManojkiran Eda         {
315724340d7SEd Tanous             messages::propertyValueNotInList(asyncResp->res,
316724340d7SEd Tanous                                              std::to_string(*sessionTimeout),
3178d1b46d7Szhanghch05                                              "SessionTimeOut");
318f2a4a606SManojkiran Eda         }
319f2a4a606SManojkiran Eda     }
320724340d7SEd Tanous }
321724340d7SEd Tanous 
322724340d7SEd Tanous inline void requestRoutesSession(App& app)
323724340d7SEd Tanous {
324724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
325a1e0871dSEd Tanous         .privileges(redfish::privileges::headSession)
326a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
327a1e0871dSEd Tanous             std::bind_front(handleSessionHead, std::ref(app)));
328a1e0871dSEd Tanous 
329a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
330724340d7SEd Tanous         .privileges(redfish::privileges::getSession)
33145ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
33245ca1b86SEd Tanous             std::bind_front(handleSessionGet, std::ref(app)));
333724340d7SEd Tanous 
334724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/")
335724340d7SEd Tanous         .privileges(redfish::privileges::deleteSession)
33645ca1b86SEd Tanous         .methods(boost::beast::http::verb::delete_)(
33745ca1b86SEd Tanous             std::bind_front(handleSessionDelete, std::ref(app)));
338724340d7SEd Tanous 
339724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
340a1e0871dSEd Tanous         .privileges(redfish::privileges::headSessionCollection)
341a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
342a1e0871dSEd Tanous             std::bind_front(handleSessionCollectionHead, std::ref(app)));
343a1e0871dSEd Tanous 
344a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
345724340d7SEd Tanous         .privileges(redfish::privileges::getSessionCollection)
34645ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
34745ca1b86SEd Tanous             std::bind_front(handleSessionCollectionGet, std::ref(app)));
348724340d7SEd Tanous 
349e76cd868SEd Tanous     // Note, the next two routes technically don't match the privilege
350724340d7SEd Tanous     // registry given the way login mechanisms work.  The base privilege
351724340d7SEd Tanous     // registry lists this endpoint as requiring login privilege, but because
352724340d7SEd Tanous     // this is the endpoint responsible for giving the login privilege, and it
353724340d7SEd Tanous     // is itself its own route, it needs to not require Login
354724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/")
355724340d7SEd Tanous         .privileges({})
35645ca1b86SEd Tanous         .methods(boost::beast::http::verb::post)(
35745ca1b86SEd Tanous             std::bind_front(handleSessionCollectionPost, std::ref(app)));
358724340d7SEd Tanous 
359e76cd868SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/Members/")
360e76cd868SEd Tanous         .privileges({})
36145ca1b86SEd Tanous         .methods(boost::beast::http::verb::post)(
36245ca1b86SEd Tanous             std::bind_front(handleSessionCollectionPost, std::ref(app)));
363e76cd868SEd Tanous 
364724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
365a1e0871dSEd Tanous         .privileges(redfish::privileges::headSessionService)
366a1e0871dSEd Tanous         .methods(boost::beast::http::verb::head)(
367a1e0871dSEd Tanous             std::bind_front(handleSessionServiceHead, std::ref(app)));
368a1e0871dSEd Tanous 
369a1e0871dSEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
370724340d7SEd Tanous         .privileges(redfish::privileges::getSessionService)
37145ca1b86SEd Tanous         .methods(boost::beast::http::verb::get)(
37245ca1b86SEd Tanous             std::bind_front(handleSessionServiceGet, std::ref(app)));
373724340d7SEd Tanous 
374724340d7SEd Tanous     BMCWEB_ROUTE(app, "/redfish/v1/SessionService/")
375724340d7SEd Tanous         .privileges(redfish::privileges::patchSessionService)
37645ca1b86SEd Tanous         .methods(boost::beast::http::verb::patch)(
37745ca1b86SEd Tanous             std::bind_front(handleSessionServicePatch, std::ref(app)));
378f2a4a606SManojkiran Eda }
3795d27b854SBorawski.Lukasz 
3802b7981f6SKowalski, Kamil } // namespace redfish
381