2020-03-16 20:50:31 +00:00
|
|
|
#include "webfused/auth/factory.h"
|
|
|
|
#include "webfused/auth/file_authenticator.h"
|
2020-03-19 20:53:49 +00:00
|
|
|
#include "webfused/auth/pam_authenticator.h"
|
2020-03-18 09:17:17 +00:00
|
|
|
#include "webfused/config/settings.h"
|
2020-03-16 20:50:31 +00:00
|
|
|
#include "webfused/log/log.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
bool
|
|
|
|
wfd_authenticator_create(
|
2020-03-18 09:17:17 +00:00
|
|
|
char const * provider,
|
|
|
|
struct wfd_settings * settings,
|
2020-03-16 20:50:31 +00:00
|
|
|
struct wfd_authenticator * authenticator)
|
|
|
|
{
|
|
|
|
bool result = false;
|
2020-03-18 09:17:17 +00:00
|
|
|
if (0 == strcmp("file", provider))
|
2020-03-16 20:50:31 +00:00
|
|
|
{
|
|
|
|
result = wfd_file_authenticator_create(settings, authenticator);
|
|
|
|
}
|
2020-03-19 20:53:49 +00:00
|
|
|
else if (0 == strcmp("pam", provider))
|
|
|
|
{
|
|
|
|
result = wfd_pam_authenticator_create(settings, authenticator);
|
|
|
|
}
|
2020-03-16 20:50:31 +00:00
|
|
|
else
|
|
|
|
{
|
2020-03-18 09:17:17 +00:00
|
|
|
WFD_ERROR("failed to create authenticator: unknown type \"%s\"", provider);
|
2020-03-16 20:50:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|