authn: correct meson behaviors
Today `basic-auth` (and other options) can be enabled even if
`insecure-disable-auth` is enabled, which doesn't make sense.
With this block this commit added in meson, If we disable authx with
`insecure-disable-auth`, then all these auth options will be ignored.
Tested:
1. code compiles with and without 'insecure-disable-auth'.
2. No new service validator errors when 'insecure-disable-auth' is
turned on.
3. No new service validator errors when 'insecure-disable-auth' is
turned off.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I2c634851f7aa7b9e57158770c5d40c12954c93a7
diff --git a/include/authentication.hpp b/include/authentication.hpp
index ac2a7d1..6a9e6ad 100644
--- a/include/authentication.hpp
+++ b/include/authentication.hpp
@@ -260,7 +260,8 @@
[[maybe_unused]] static std::shared_ptr<persistent_data::UserSession>
authenticate(
const boost::asio::ip::address& ipAddress [[maybe_unused]],
- Response& res [[maybe_unused]], boost::beast::http::verb method,
+ Response& res [[maybe_unused]],
+ boost::beast::http::verb method [[maybe_unused]],
const boost::beast::http::header<true>& reqHeader,
[[maybe_unused]] const std::shared_ptr<persistent_data::UserSession>&
session)
diff --git a/meson.build b/meson.build
index 7be259b..ec70510 100644
--- a/meson.build
+++ b/meson.build
@@ -101,6 +101,11 @@
add_project_arguments(option_value,language:'cpp')
summary(option_key,option_value, section : 'Enabled Features')
endif
+ elif (option_key in ['basic-auth', 'cookie-auth', 'session-auth', 'xtoken-auth', 'mutual-tls-auth'])
+ if (get_option('insecure-disable-auth').disabled())
+ add_project_arguments(option_value, language:'cpp')
+ summary(option_key,option_value, section : 'Enabled Features')
+ endif
else
summary(option_key,option_value, section : 'Enabled Features')
add_project_arguments(option_value,language:'cpp')