Lines Matching +full:redfish +full:- +full:messages
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
26 namespace redfish namespace
72 req, asyncResp->res, // in getCertificateFromReqBody()
78 messages::internalError(asyncResp->res); in getCertificateFromReqBody()
84 messages::propertyValueNotInList(asyncResp->res, *certificateType, in getCertificateFromReqBody()
158 // example: O=openbmc-project.xyz,CN=localhost in updateCertIssuerOrSubject()
171 std::string_view key(tokenBegin, static_cast<size_t>(i - tokenBegin)); in updateCertIssuerOrSubject()
178 std::string_view val(tokenBegin, static_cast<size_t>(i - tokenBegin)); in updateCertIssuerOrSubject()
235 messages::internalError(asyncResp->res); in getCertificateList()
239 nlohmann::json& links = asyncResp->res.jsonValue[listPtr]; in getCertificateList()
256 "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates/{}", in getCertificateList()
262 "/redfish/v1/AccountService/LDAP/Certificates/{}", in getCertificateList()
268 "/redfish/v1/Managers/{}/Truststore/Certificates/{}", in getCertificateList()
281 asyncResp->res.jsonValue[countPtr] = links.size(); in getCertificateList()
290 * @param[in] objectPath Path of the D-Bus service object
312 messages::resourceNotFound(asyncResp->res, "Certificate", in getCertificateProperties()
332 messages::internalError(asyncResp->res); in getCertificateProperties()
336 asyncResp->res.jsonValue["@odata.id"] = certURL; in getCertificateProperties()
337 asyncResp->res.jsonValue["@odata.type"] = in getCertificateProperties()
339 asyncResp->res.jsonValue["Id"] = certId; in getCertificateProperties()
340 asyncResp->res.jsonValue["Name"] = name; in getCertificateProperties()
341 asyncResp->res.jsonValue["Description"] = name; in getCertificateProperties()
342 asyncResp->res.jsonValue["CertificateString"] = ""; in getCertificateProperties()
343 asyncResp->res.jsonValue["KeyUsage"] = nlohmann::json::array(); in getCertificateProperties()
347 asyncResp->res.jsonValue["CertificateString"] = in getCertificateProperties()
353 asyncResp->res.jsonValue["KeyUsage"] = *keyUsage; in getCertificateProperties()
358 updateCertIssuerOrSubject(asyncResp->res.jsonValue["Issuer"], in getCertificateProperties()
364 updateCertIssuerOrSubject(asyncResp->res.jsonValue["Subject"], in getCertificateProperties()
370 asyncResp->res.jsonValue["ValidNotAfter"] = in getCertificateProperties()
371 redfish::time_utils::getDateTimeUint(*validNotAfter); in getCertificateProperties()
376 asyncResp->res.jsonValue["ValidNotBefore"] = in getCertificateProperties()
377 redfish::time_utils::getDateTimeUint(*validNotBefore); in getCertificateProperties()
380 asyncResp->res.addHeader( in getCertificateProperties()
391 crow::connections::systemBus->async_method_call( in deleteCertificate()
396 messages::resourceNotFound(asyncResp->res, "Certificate", id); in deleteCertificate()
400 asyncResp->res.result(boost::beast::http::status::no_content); in deleteCertificate()
409 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleCertificateServiceGet()
416 messages::internalError(asyncResp->res); in handleCertificateServiceGet()
420 asyncResp->res.jsonValue["@odata.type"] = in handleCertificateServiceGet()
422 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/CertificateService"; in handleCertificateServiceGet()
423 asyncResp->res.jsonValue["Id"] = "CertificateService"; in handleCertificateServiceGet()
424 asyncResp->res.jsonValue["Name"] = "Certificate Service"; in handleCertificateServiceGet()
425 asyncResp->res.jsonValue["Description"] = in handleCertificateServiceGet()
427 // /redfish/v1/CertificateService/CertificateLocations is something in handleCertificateServiceGet()
431 redfish::getUserPrivileges(*req.session); in handleCertificateServiceGet()
435 asyncResp->res.jsonValue["CertificateLocations"]["@odata.id"] = in handleCertificateServiceGet()
436 "/redfish/v1/CertificateService/CertificateLocations"; in handleCertificateServiceGet()
438 nlohmann::json& actions = asyncResp->res.jsonValue["Actions"]; in handleCertificateServiceGet()
441 "/redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate"; in handleCertificateServiceGet()
444 replace["CertificateType@Redfish.AllowableValues"] = std::move(allowed); in handleCertificateServiceGet()
446 "/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR"; in handleCertificateServiceGet()
453 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleCertificateLocationsGet()
457 asyncResp->res.jsonValue["@odata.id"] = in handleCertificateLocationsGet()
458 "/redfish/v1/CertificateService/CertificateLocations"; in handleCertificateLocationsGet()
459 asyncResp->res.jsonValue["@odata.type"] = in handleCertificateLocationsGet()
461 asyncResp->res.jsonValue["Name"] = "Certificate Locations"; in handleCertificateLocationsGet()
462 asyncResp->res.jsonValue["Id"] = "CertificateLocations"; in handleCertificateLocationsGet()
463 asyncResp->res.jsonValue["Description"] = in handleCertificateLocationsGet()
478 messages::resourceNotFound(asyncResp->res, "Certificate", id); in handleError()
483 messages::propertyValueIncorrect(asyncResp->res, "Certificate", in handleError()
488 messages::internalError(asyncResp->res); in handleError()
496 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleReplaceCertificateAction()
505 req, asyncResp->res, // in handleReplaceCertificateAction()
522 messages::actionParameterNotSupported(asyncResp->res, "CertificateType", in handleReplaceCertificateAction()
533 messages::actionParameterValueFormatError( in handleReplaceCertificateAction()
534 asyncResp->res, certURI, "CertificateUri", "ReplaceCertificate"); in handleReplaceCertificateAction()
542 if (crow::utility::readUrlSegments(*parsedUrl, "redfish", "v1", "Managers", in handleReplaceCertificateAction()
551 else if (crow::utility::readUrlSegments(*parsedUrl, "redfish", "v1", in handleReplaceCertificateAction()
560 else if (crow::utility::readUrlSegments(*parsedUrl, "redfish", "v1", in handleReplaceCertificateAction()
571 messages::actionParameterNotSupported(asyncResp->res, "CertificateUri", in handleReplaceCertificateAction()
578 crow::connections::systemBus->async_method_call( in handleReplaceCertificateAction()
586 if ((dbusError != nullptr) && (dbusError->name != nullptr)) in handleReplaceCertificateAction()
588 handleError(dbusError->name, id, certificate, asyncResp); in handleReplaceCertificateAction()
592 messages::internalError(asyncResp->res); in handleReplaceCertificateAction()
599 certFile->getCertFilePath()); in handleReplaceCertificateAction()
602 certFile->getCertFilePath()); in handleReplaceCertificateAction()
605 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
608 * @brief Read data from CSR D-bus object and set to response
612 * @param[in] service D-Bus service name
613 * @param[in] certObjPath certificate D-Bus object path
614 * @param[in] csrObjPath CSR D-Bus object path
624 crow::connections::systemBus->async_method_call( in getCSR()
630 messages::internalError(asyncResp->res); in getCSR()
636 messages::internalError(asyncResp->res); in getCSR()
639 asyncResp->res.jsonValue["CSRString"] = csr; in getCSR()
640 asyncResp->res.jsonValue["CertificateCollection"]["@odata.id"] = in getCSR()
650 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleGenerateCSRAction()
681 req, asyncResp->res, // in handleGenerateCSRAction()
710 if (!optChallengePassword->empty()) in handleGenerateCSRAction()
712 messages::actionParameterNotSupported(asyncResp->res, "GenerateCSR", in handleGenerateCSRAction()
720 "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates", in handleGenerateCSRAction()
727 "/redfish/v1/AccountService/LDAP/Certificates")) in handleGenerateCSRAction()
734 messages::actionParameterNotSupported( in handleGenerateCSRAction()
735 asyncResp->res, "CertificateCollection", "GenerateCSR"); in handleGenerateCSRAction()
742 messages::actionParameterNotSupported( in handleGenerateCSRAction()
743 asyncResp->res, "KeyPairAlgorithm", "GenerateCSR"); in handleGenerateCSRAction()
751 messages::propertyValueNotInList(asyncResp->res, *optKeyBitLength, in handleGenerateCSRAction()
758 "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates", in handleGenerateCSRAction()
761 if (optKeyUsage->empty()) in handleGenerateCSRAction()
763 optKeyUsage->emplace_back("ServerAuthentication"); in handleGenerateCSRAction()
765 else if (optKeyUsage->size() == 1) in handleGenerateCSRAction()
769 messages::propertyValueNotInList(asyncResp->res, in handleGenerateCSRAction()
776 messages::actionParameterNotSupported(asyncResp->res, "KeyUsage", in handleGenerateCSRAction()
782 "/redfish/v1/AccountService/LDAP/Certificates")) in handleGenerateCSRAction()
784 if (optKeyUsage->empty()) in handleGenerateCSRAction()
786 optKeyUsage->emplace_back("ClientAuthentication"); in handleGenerateCSRAction()
788 else if (optKeyUsage->size() == 1) in handleGenerateCSRAction()
792 messages::propertyValueNotInList(asyncResp->res, in handleGenerateCSRAction()
799 messages::actionParameterNotSupported(asyncResp->res, "KeyUsage", in handleGenerateCSRAction()
806 // time-out and timer expiry to 10 seconds for now. in handleGenerateCSRAction()
810 messages::serviceTemporarilyUnavailable(asyncResp->res, in handleGenerateCSRAction()
817 messages::internalError(asyncResp->res); in handleGenerateCSRAction()
837 messages::internalError(asyncResp->res); in handleGenerateCSRAction()
855 messages::internalError(asyncResp->res); in handleGenerateCSRAction()
874 crow::connections::systemBus->async_method_call( in handleGenerateCSRAction()
879 messages::internalError(asyncResp->res); in handleGenerateCSRAction()
893 BMCWEB_ROUTE(app, "/redfish/v1/CertificateService/") in requestRoutesCertificateService()
894 .privileges(redfish::privileges::getCertificateService) in requestRoutesCertificateService()
898 BMCWEB_ROUTE(app, "/redfish/v1/CertificateService/CertificateLocations/") in requestRoutesCertificateService()
899 .privileges(redfish::privileges::getCertificateLocations) in requestRoutesCertificateService()
905 "/redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate/") in requestRoutesCertificateService()
906 .privileges(redfish::privileges::postCertificateService) in requestRoutesCertificateService()
912 "/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR/") in requestRoutesCertificateService()
913 .privileges(redfish::privileges::postCertificateService) in requestRoutesCertificateService()
923 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleHTTPSCertificateCollectionGet()
930 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleHTTPSCertificateCollectionGet()
934 asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( in handleHTTPSCertificateCollectionGet()
935 "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates", in handleHTTPSCertificateCollectionGet()
937 asyncResp->res.jsonValue["@odata.type"] = in handleHTTPSCertificateCollectionGet()
939 asyncResp->res.jsonValue["Name"] = "HTTPS Certificates Collection"; in handleHTTPSCertificateCollectionGet()
940 asyncResp->res.jsonValue["Description"] = in handleHTTPSCertificateCollectionGet()
953 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleHTTPSCertificateCollectionPost()
960 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleHTTPSCertificateCollectionPost()
966 asyncResp->res.jsonValue["Name"] = "HTTPS Certificate"; in handleHTTPSCertificateCollectionPost()
967 asyncResp->res.jsonValue["Description"] = "HTTPS Certificate"; in handleHTTPSCertificateCollectionPost()
974 messages::unrecognizedRequestBody(asyncResp->res); in handleHTTPSCertificateCollectionPost()
981 crow::connections::systemBus->async_method_call( in handleHTTPSCertificateCollectionPost()
987 messages::internalError(asyncResp->res); in handleHTTPSCertificateCollectionPost()
994 "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates/{}", in handleHTTPSCertificateCollectionPost()
1000 certFile->getCertFilePath()); in handleHTTPSCertificateCollectionPost()
1003 "Install", certFile->getCertFilePath()); in handleHTTPSCertificateCollectionPost()
1011 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleHTTPSCertificateGet()
1018 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleHTTPSCertificateGet()
1024 "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates/{}", in handleHTTPSCertificateGet()
1035 app, "/redfish/v1/Managers/<str>/NetworkProtocol/HTTPS/Certificates/") in requestRoutesHTTPSCertificate()
1036 .privileges(redfish::privileges::getCertificateCollection) in requestRoutesHTTPSCertificate()
1041 app, "/redfish/v1/Managers/<str>/NetworkProtocol/HTTPS/Certificates/") in requestRoutesHTTPSCertificate()
1042 .privileges(redfish::privileges::postCertificateCollection) in requestRoutesHTTPSCertificate()
1048 "/redfish/v1/Managers/<str>/NetworkProtocol/HTTPS/Certificates/<str>/") in requestRoutesHTTPSCertificate()
1049 .privileges(redfish::privileges::getCertificate) in requestRoutesHTTPSCertificate()
1058 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleLDAPCertificateCollectionGet()
1063 asyncResp->res.jsonValue["@odata.id"] = in handleLDAPCertificateCollectionGet()
1064 "/redfish/v1/AccountService/LDAP/Certificates"; in handleLDAPCertificateCollectionGet()
1065 asyncResp->res.jsonValue["@odata.type"] = in handleLDAPCertificateCollectionGet()
1067 asyncResp->res.jsonValue["Name"] = "LDAP Certificates Collection"; in handleLDAPCertificateCollectionGet()
1068 asyncResp->res.jsonValue["Description"] = in handleLDAPCertificateCollectionGet()
1080 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleLDAPCertificateCollectionPost()
1089 messages::unrecognizedRequestBody(asyncResp->res); in handleLDAPCertificateCollectionPost()
1096 crow::connections::systemBus->async_method_call( in handleLDAPCertificateCollectionPost()
1102 messages::internalError(asyncResp->res); in handleLDAPCertificateCollectionPost()
1109 "/redfish/v1/AccountService/LDAP/Certificates/{}", certId); in handleLDAPCertificateCollectionPost()
1114 certFile->getCertFilePath()); in handleLDAPCertificateCollectionPost()
1117 "Install", certFile->getCertFilePath()); in handleLDAPCertificateCollectionPost()
1124 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleLDAPCertificateGet()
1131 "/redfish/v1/AccountService/LDAP/Certificates/{}", id); in handleLDAPCertificateGet()
1142 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleLDAPCertificateDelete()
1156 BMCWEB_ROUTE(app, "/redfish/v1/AccountService/LDAP/Certificates/") in requestRoutesLDAPCertificate()
1157 .privileges(redfish::privileges::getCertificateCollection) in requestRoutesLDAPCertificate()
1161 BMCWEB_ROUTE(app, "/redfish/v1/AccountService/LDAP/Certificates/") in requestRoutesLDAPCertificate()
1162 .privileges(redfish::privileges::postCertificateCollection) in requestRoutesLDAPCertificate()
1166 BMCWEB_ROUTE(app, "/redfish/v1/AccountService/LDAP/Certificates/<str>/") in requestRoutesLDAPCertificate()
1167 .privileges(redfish::privileges::getCertificate) in requestRoutesLDAPCertificate()
1171 BMCWEB_ROUTE(app, "/redfish/v1/AccountService/LDAP/Certificates/<str>/") in requestRoutesLDAPCertificate()
1172 .privileges(redfish::privileges::deleteCertificate) in requestRoutesLDAPCertificate()
1182 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleTrustStoreCertificateCollectionGet()
1189 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleTrustStoreCertificateCollectionGet()
1193 asyncResp->res.jsonValue["@odata.id"] = in handleTrustStoreCertificateCollectionGet()
1194 boost::urls::format("/redfish/v1/Managers/{}/Truststore/Certificates/", in handleTrustStoreCertificateCollectionGet()
1196 asyncResp->res.jsonValue["@odata.type"] = in handleTrustStoreCertificateCollectionGet()
1198 asyncResp->res.jsonValue["Name"] = "TrustStore Certificates Collection"; in handleTrustStoreCertificateCollectionGet()
1199 asyncResp->res.jsonValue["Description"] = in handleTrustStoreCertificateCollectionGet()
1212 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleTrustStoreCertificateCollectionPost()
1219 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleTrustStoreCertificateCollectionPost()
1228 messages::unrecognizedRequestBody(asyncResp->res); in handleTrustStoreCertificateCollectionPost()
1234 crow::connections::systemBus->async_method_call( in handleTrustStoreCertificateCollectionPost()
1240 messages::internalError(asyncResp->res); in handleTrustStoreCertificateCollectionPost()
1247 "/redfish/v1/Managers/{}/Truststore/Certificates/{}", in handleTrustStoreCertificateCollectionPost()
1253 certFile->getCertFilePath()); in handleTrustStoreCertificateCollectionPost()
1256 certs::certInstallIntf, "Install", certFile->getCertFilePath()); in handleTrustStoreCertificateCollectionPost()
1264 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleTrustStoreCertificateGet()
1271 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleTrustStoreCertificateGet()
1277 "/redfish/v1/Managers/{}/Truststore/Certificates/{}", in handleTrustStoreCertificateGet()
1290 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in handleTrustStoreCertificateDelete()
1297 messages::resourceNotFound(asyncResp->res, "Manager", managerId); in handleTrustStoreCertificateDelete()
1310 BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/Truststore/Certificates/") in requestRoutesTrustStoreCertificate()
1311 .privileges(redfish::privileges::getCertificate) in requestRoutesTrustStoreCertificate()
1315 BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/Truststore/Certificates/") in requestRoutesTrustStoreCertificate()
1316 .privileges(redfish::privileges::postCertificateCollection) in requestRoutesTrustStoreCertificate()
1321 "/redfish/v1/Managers/<str>/Truststore/Certificates/<str>/") in requestRoutesTrustStoreCertificate()
1322 .privileges(redfish::privileges::getCertificate) in requestRoutesTrustStoreCertificate()
1327 "/redfish/v1/Managers/<str>/Truststore/Certificates/<str>/") in requestRoutesTrustStoreCertificate()
1328 .privileges(redfish::privileges::deleteCertificate) in requestRoutesTrustStoreCertificate()
1332 } // namespace redfish