Lines Matching +full:redfish +full:- +full:messages
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation
37 namespace redfish namespace
46 roles.emplace_back(redfish::getRoleIdFromPrivilege(session.userRole)); in fillSessionObject()
49 "/redfish/v1/SessionService/Sessions/{}", session.uniqueId); in fillSessionObject()
65 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionHead()
69 asyncResp->res.addHeader( in handleSessionHead()
71 "</redfish/v1/JsonSchemas/Session/Session.json>; rel=describedby"); in handleSessionHead()
79 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionGet()
83 asyncResp->res.addHeader( in handleSessionGet()
85 "</redfish/v1/JsonSchemas/Session/Session.json>; rel=describedby"); in handleSessionGet()
93 messages::resourceNotFound(asyncResp->res, "Session", sessionId); in handleSessionGet()
97 fillSessionObject(asyncResp->res, *session); in handleSessionGet()
105 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionDelete()
114 messages::resourceNotFound(asyncResp->res, "Session", sessionId); in handleSessionDelete()
123 if (req.session != nullptr && !session->username.empty() && in handleSessionDelete()
124 session->username != req.session->username) in handleSessionDelete()
127 redfish::getUserPrivileges(*req.session); in handleSessionDelete()
131 messages::insufficientPrivilege(asyncResp->res); in handleSessionDelete()
136 if (req.session != nullptr && req.session->uniqueId == sessionId && in handleSessionDelete()
137 session->cookieAuth) in handleSessionDelete()
139 bmcweb::clearSessionCookies(asyncResp->res); in handleSessionDelete()
143 messages::success(asyncResp->res); in handleSessionDelete()
155 boost::urls::format("/redfish/v1/SessionService/Sessions/{}", uid); in getSessionCollectionMembers()
165 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionCollectionHead()
169 asyncResp->res.addHeader( in handleSessionCollectionHead()
171 "</redfish/v1/JsonSchemas/SessionCollection.json>; rel=describedby"); in handleSessionCollectionHead()
178 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionCollectionGet()
182 asyncResp->res.addHeader( in handleSessionCollectionGet()
184 "</redfish/v1/JsonSchemas/SessionCollection.json>; rel=describedby"); in handleSessionCollectionGet()
186 asyncResp->res.jsonValue["Members"] = getSessionCollectionMembers(); in handleSessionCollectionGet()
187 asyncResp->res.jsonValue["Members@odata.count"] = in handleSessionCollectionGet()
188 asyncResp->res.jsonValue["Members"].size(); in handleSessionCollectionGet()
189 asyncResp->res.jsonValue["@odata.type"] = in handleSessionCollectionGet()
191 asyncResp->res.jsonValue["@odata.id"] = in handleSessionCollectionGet()
192 "/redfish/v1/SessionService/Sessions"; in handleSessionCollectionGet()
193 asyncResp->res.jsonValue["Name"] = "Session Collection"; in handleSessionCollectionGet()
194 asyncResp->res.jsonValue["Description"] = "Session Collection"; in handleSessionCollectionGet()
201 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionCollectionMembersGet()
205 asyncResp->res.jsonValue = getSessionCollectionMembers(); in handleSessionCollectionMembersGet()
213 // When session is created by webui-vue give it session cookies as a in processAfterSessionCreation()
214 // non-standard Redfish extension. This is needed for authentication for in processAfterSessionCreation()
215 // WebSockets-based functionality. in processAfterSessionCreation()
216 if (!req.getHeaderValue("X-Requested-With").empty()) in processAfterSessionCreation()
218 bmcweb::setSessionCookies(asyncResp->res, *session); in processAfterSessionCreation()
222 asyncResp->res.addHeader("X-Auth-Token", session->sessionToken); in processAfterSessionCreation()
225 asyncResp->res.addHeader( in processAfterSessionCreation()
226 "Location", "/redfish/v1/SessionService/Sessions/" + session->uniqueId); in processAfterSessionCreation()
227 asyncResp->res.result(boost::beast::http::status::created); in processAfterSessionCreation()
228 if (session->isConfigureSelfOnly) in processAfterSessionCreation()
230 messages::passwordChangeRequired( in processAfterSessionCreation()
231 asyncResp->res, in processAfterSessionCreation()
232 boost::urls::format("/redfish/v1/AccountService/Accounts/{}", in processAfterSessionCreation()
233 session->username)); in processAfterSessionCreation()
237 fillSessionObject(asyncResp->res, *session); in processAfterSessionCreation()
245 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionCollectionPost()
254 req, asyncResp->res, // in handleSessionCollectionPost()
264 asyncResp->res.result() != boost::beast::http::status::ok) in handleSessionCollectionPost()
268 messages::propertyMissing(asyncResp->res, "UserName"); in handleSessionCollectionPost()
273 messages::propertyMissing(asyncResp->res, "Password"); in handleSessionCollectionPost()
283 messages::resourceAtUriUnauthorized(asyncResp->res, req.url(), in handleSessionCollectionPost()
288 // User is authenticated - create session in handleSessionCollectionPost()
295 messages::internalError(asyncResp->res); in handleSessionCollectionPost()
305 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionServiceHead()
309 asyncResp->res.addHeader( in handleSessionServiceHead()
311 "</redfish/v1/JsonSchemas/SessionService/SessionService.json>; rel=describedby"); in handleSessionServiceHead()
318 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionServiceGet()
322 asyncResp->res.addHeader( in handleSessionServiceGet()
324 "</redfish/v1/JsonSchemas/SessionService/SessionService.json>; rel=describedby"); in handleSessionServiceGet()
326 asyncResp->res.jsonValue["@odata.type"] = in handleSessionServiceGet()
328 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/SessionService"; in handleSessionServiceGet()
329 asyncResp->res.jsonValue["Name"] = "Session Service"; in handleSessionServiceGet()
330 asyncResp->res.jsonValue["Id"] = "SessionService"; in handleSessionServiceGet()
331 asyncResp->res.jsonValue["Description"] = "Session Service"; in handleSessionServiceGet()
332 asyncResp->res.jsonValue["SessionTimeout"] = in handleSessionServiceGet()
334 asyncResp->res.jsonValue["ServiceEnabled"] = true; in handleSessionServiceGet()
336 asyncResp->res.jsonValue["Sessions"]["@odata.id"] = in handleSessionServiceGet()
337 "/redfish/v1/SessionService/Sessions"; in handleSessionServiceGet()
344 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleSessionServicePatch()
350 req, asyncResp->res, // in handleSessionServicePatch()
362 // https://redfish.dmtf.org/schemas/v1/SessionService.v1_1_7.json in handleSessionServicePatch()
369 messages::propertyValueModified(asyncResp->res, "SessionTimeOut", in handleSessionServicePatch()
374 messages::propertyValueNotInList(asyncResp->res, *sessionTimeout, in handleSessionServicePatch()
382 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/") in requestRoutesSession()
383 .privileges(redfish::privileges::headSession) in requestRoutesSession()
387 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/") in requestRoutesSession()
388 .privileges(redfish::privileges::getSession) in requestRoutesSession()
392 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/<str>/") in requestRoutesSession()
393 .privileges(redfish::privileges::deleteSession) in requestRoutesSession()
397 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/") in requestRoutesSession()
398 .privileges(redfish::privileges::headSessionCollection) in requestRoutesSession()
402 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/") in requestRoutesSession()
403 .privileges(redfish::privileges::getSessionCollection) in requestRoutesSession()
412 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/") in requestRoutesSession()
417 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/Sessions/Members/") in requestRoutesSession()
422 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/") in requestRoutesSession()
423 .privileges(redfish::privileges::headSessionService) in requestRoutesSession()
427 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/") in requestRoutesSession()
428 .privileges(redfish::privileges::getSessionService) in requestRoutesSession()
432 BMCWEB_ROUTE(app, "/redfish/v1/SessionService/") in requestRoutesSession()
433 .privileges(redfish::privileges::patchSessionService) in requestRoutesSession()
438 } // namespace redfish