Add meson options for all authentication methods.
Add meson options to enabled/disabled authentication methods:
- basic-auth : For enable basic authentication, default is enabled
- session-auth : For enable session token authentication, default is
enabled
- xtoken-auth : For enable x-token authentication, default is enabled
- cookie-auth : For enabled cookie authentication, default is enabled
Signed-off-by: Alan Kuo <Alan_Kuo@quantatw.com>
Change-Id: I52e636f2534a14897cb57d35e563ea8841cc68b9
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 5b06b37..71f9430 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -916,26 +916,57 @@
if (basicAuth)
{
+#ifndef BMCWEB_ENABLE_BASIC_AUTHENTICATION
+ messages::actionNotSupported(
+ asyncResp->res, "Setting BasicAuth when basic-auth feature "
+ "is disabled");
+ return;
+#endif
authMethodsConfig.basic = *basicAuth;
}
if (cookie)
{
+#ifndef BMCWEB_ENABLE_COOKIE_AUTHENTICATION
+ messages::actionNotSupported(
+ asyncResp->res, "Setting Cookie when cookie-auth feature "
+ "is disabled");
+ return;
+#endif
authMethodsConfig.cookie = *cookie;
}
if (sessionToken)
{
+#ifndef BMCWEB_ENABLE_SESSION_AUTHENTICATION
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting SessionToken when session-auth feature "
+ "is disabled");
+ return;
+#endif
authMethodsConfig.sessionToken = *sessionToken;
}
if (xToken)
{
+#ifndef BMCWEB_ENABLE_XTOKEN_AUTHENTICATION
+ messages::actionNotSupported(
+ asyncResp->res, "Setting XToken when xtoken-auth feature "
+ "is disabled");
+ return;
+#endif
authMethodsConfig.xtoken = *xToken;
}
if (tls)
{
+#ifndef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
+ messages::actionNotSupported(
+ asyncResp->res, "Setting TLS when mutual-tls-auth feature "
+ "is disabled");
+ return;
+#endif
authMethodsConfig.tls = *tls;
}