mirror of
https://github.com/falk-werner/webfused
synced 2026-03-02 04:09:19 +00:00
refactor: generalize auth_settings
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
#include "webfused/auth/factory.h"
|
||||
#include "webfused/auth/settings.h"
|
||||
#include "webfused/auth/file_authenticator.h"
|
||||
#include "webfused/config/settings.h"
|
||||
#include "webfused/log/log.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
bool
|
||||
wfd_authenticator_create(
|
||||
struct wfd_auth_settings * settings,
|
||||
char const * provider,
|
||||
struct wfd_settings * settings,
|
||||
struct wfd_authenticator * authenticator)
|
||||
{
|
||||
bool result = false;
|
||||
char const * provider_name = wfd_auth_settings_get_provider(settings);
|
||||
if (0 == strcmp("file", provider_name))
|
||||
if (0 == strcmp("file", provider))
|
||||
{
|
||||
result = wfd_file_authenticator_create(settings, authenticator);
|
||||
}
|
||||
else
|
||||
{
|
||||
WFD_ERROR("failed to create authenticator: unknown type \"%s\"", provider_name);
|
||||
WFD_ERROR("failed to create authenticator: unknown type \"%s\"", provider);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -11,11 +11,12 @@ extern "C"
|
||||
#endif
|
||||
|
||||
struct wfd_authenticator;
|
||||
struct wfd_auth_settings;
|
||||
struct wfd_settings;
|
||||
|
||||
extern bool
|
||||
wfd_authenticator_create(
|
||||
struct wfd_auth_settings * settings,
|
||||
char const * provider,
|
||||
struct wfd_settings * settings,
|
||||
struct wfd_authenticator * authenticator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "webfused/auth/file_authenticator.h"
|
||||
#include "webfused/auth/settings.h"
|
||||
#include "webfused/auth/authenticator.h"
|
||||
|
||||
#include "webfuse/adapter/credentials.h"
|
||||
#include "webfused/config/settings.h"
|
||||
#include "userdb/userdb.h"
|
||||
#include "webfused/log/log.h"
|
||||
|
||||
#include <webfuse/adapter/credentials.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -71,12 +71,12 @@ wfd_file_authenticator_vtable =
|
||||
|
||||
bool
|
||||
wfd_file_authenticator_create(
|
||||
struct wfd_auth_settings * settings,
|
||||
struct wfd_settings * settings,
|
||||
struct wfd_authenticator * authenticator)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
char const * filename = wfd_auth_settings_get(settings, "file");
|
||||
char const * filename = wfd_settings_get(settings, "file");
|
||||
if (NULL != filename)
|
||||
{
|
||||
struct wfd_file_authenticator * data = malloc(sizeof(struct wfd_file_authenticator));
|
||||
|
||||
@@ -12,11 +12,11 @@ extern "C"
|
||||
#endif
|
||||
|
||||
struct wfd_authenticator;
|
||||
struct wfd_auth_settings;
|
||||
struct wfd_settings;
|
||||
|
||||
extern bool
|
||||
wfd_file_authenticator_create(
|
||||
struct wfd_auth_settings * settings,
|
||||
struct wfd_settings * settings,
|
||||
struct wfd_authenticator * authenticator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef WFD_AUTH_SETTINGS_H
|
||||
#define WFD_AUTH_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfd_auth_settings;
|
||||
|
||||
|
||||
extern char const *
|
||||
wfd_auth_settings_get_provider(
|
||||
struct wfd_auth_settings * settings);
|
||||
|
||||
extern char const *
|
||||
wfd_auth_settings_get(
|
||||
struct wfd_auth_settings * settings,
|
||||
char const * key);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user