meson_options: implement disable-auth; delete pam
Implemented the disable-auth option.
This patch also removed the pam option which never worked.
Tested:
With disable-auth,
```
~# wget -qO- http://localhost/redfish/v1/Systems/
{
"@odata.id": "/redfish/v1/Systems",
"@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"Members@odata.count": 1,
"Name": "Computer System Collection"
}
```
Without disable-auth,
```
~# wget -qO- http://localhost/redfish/
{
"v1": "/redfish/v1/"
}
~# wget -qO- http://localhost/redfish/v1/Systems/system
wget: server returned error: HTTP/1.1 401 Unauthorized
```
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I88e4e6fa6ed71096bc866b42b9af283645a65988
diff --git a/include/authorization.hpp b/include/authorization.hpp
index 40a6119..202628c 100644
--- a/include/authorization.hpp
+++ b/include/authorization.hpp
@@ -223,7 +223,8 @@
#endif
// checks if request can be forwarded without authentication
-static bool isOnAllowlist(std::string_view url, boost::beast::http::verb method)
+[[maybe_unused]] static bool isOnAllowlist(std::string_view url,
+ boost::beast::http::verb method)
{
if (boost::beast::http::verb::get == method)
{
@@ -255,12 +256,13 @@
return false;
}
-static std::shared_ptr<persistent_data::UserSession> authenticate(
- boost::asio::ip::address& ipAddress [[maybe_unused]],
- Response& res [[maybe_unused]], boost::beast::http::verb method,
- const boost::beast::http::header<true>& reqHeader,
- [[maybe_unused]] const std::shared_ptr<persistent_data::UserSession>&
- session)
+[[maybe_unused]] static std::shared_ptr<persistent_data::UserSession>
+ authenticate(
+ boost::asio::ip::address& ipAddress [[maybe_unused]],
+ Response& res [[maybe_unused]], boost::beast::http::verb method,
+ const boost::beast::http::header<true>& reqHeader,
+ [[maybe_unused]] const std::shared_ptr<persistent_data::UserSession>&
+ session)
{
const persistent_data::AuthConfigMethods& authMethodsConfig =
persistent_data::SessionStore::getInstance().getAuthMethodsConfig();