|
|
|
@ -152,43 +152,61 @@ wfd_config_read_server(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
wfd_config_read_authentication(
|
|
|
|
|
config_t * config,
|
|
|
|
|
wfd_config_read_authenticator(
|
|
|
|
|
config_setting_t * authenticator,
|
|
|
|
|
struct wfd_config_builder builder)
|
|
|
|
|
{
|
|
|
|
|
bool result = true;
|
|
|
|
|
bool result = (NULL != authenticator);
|
|
|
|
|
|
|
|
|
|
bool hasAuthentication = (NULL != config_lookup(config, "authentication"));
|
|
|
|
|
if (hasAuthentication)
|
|
|
|
|
char const * provider_name = NULL;
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
char const * provider_name = NULL;
|
|
|
|
|
int rc = config_setting_lookup_string(authenticator, "provider", &provider_name);
|
|
|
|
|
if (CONFIG_TRUE != rc)
|
|
|
|
|
{
|
|
|
|
|
int rc = config_lookup_string(config, "authentication.provider", &provider_name);
|
|
|
|
|
if (CONFIG_TRUE != rc)
|
|
|
|
|
{
|
|
|
|
|
WFD_ERROR("missing authentication provider");
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
WFD_ERROR("missing authentication provider");
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct config_setting_t * settings = NULL;
|
|
|
|
|
if (result)
|
|
|
|
|
struct config_setting_t * settings = NULL;
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
settings = config_setting_lookup(authenticator, "settings");
|
|
|
|
|
if (NULL == settings)
|
|
|
|
|
{
|
|
|
|
|
settings = config_lookup(config, "authentication.settings");
|
|
|
|
|
if (NULL == settings)
|
|
|
|
|
{
|
|
|
|
|
WFD_ERROR("missing authentication settings");
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
WFD_ERROR("missing authentication settings");
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
struct wfd_settings auth_settings;
|
|
|
|
|
wfd_settings_init(&auth_settings, settings);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
struct wfd_settings auth_settings;
|
|
|
|
|
wfd_settings_init(&auth_settings, settings);
|
|
|
|
|
|
|
|
|
|
result = wfd_config_builder_add_auth_provider(builder, provider_name, &auth_settings);
|
|
|
|
|
wfd_settings_cleanup(&auth_settings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = wfd_config_builder_add_auth_provider(builder, provider_name, &auth_settings);
|
|
|
|
|
wfd_settings_cleanup(&auth_settings);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
wfd_config_read_authentication(
|
|
|
|
|
config_t * config,
|
|
|
|
|
struct wfd_config_builder builder)
|
|
|
|
|
{
|
|
|
|
|
bool result = true;
|
|
|
|
|
|
|
|
|
|
config_setting_t * authentication = config_lookup(config, "authentication");
|
|
|
|
|
if (NULL != authentication)
|
|
|
|
|
{
|
|
|
|
|
int length = config_setting_length(authentication);
|
|
|
|
|
for (int i = 0; (result) && (i < length); i++)
|
|
|
|
|
{
|
|
|
|
|
config_setting_t * authenticator = config_setting_get_elem(authentication, i);
|
|
|
|
|
result = wfd_config_read_authenticator(authenticator, builder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|