1
0
mirror of https://github.com/falk-werner/webfused synced 2026-03-02 04:09:19 +00:00

add authenticator to server config

This commit is contained in:
Falk Werner
2020-03-17 16:49:17 +01:00
parent d90afed1b2
commit 7e7cbd5d42
9 changed files with 268 additions and 96 deletions

View File

@@ -16,3 +16,9 @@ wfd_authenticator_authenticate(
credentials, authenticator.data);
}
char const *
wfd_authenticator_get_type(
struct wfd_authenticator authenticator)
{
return authenticator.vtable->get_type(authenticator.data);
}

View File

@@ -12,10 +12,15 @@ typedef void
wfd_authenticator_dispose_fn(
void * data);
typedef char const *
wfd_authenticator_get_type_fn(
void * data);
struct wfd_authenticator_vtable
{
wfd_authenticator_dispose_fn * dispose;
wf_authenticate_fn * authenticate;
wfd_authenticator_get_type_fn * get_type;
};
struct wfd_authenticator
@@ -33,6 +38,10 @@ wfd_authenticator_authenticate(
struct wfd_authenticator authenticator,
struct wf_credentials * credentials);
extern char const *
wfd_authenticator_get_type(
struct wfd_authenticator authenticator);
#ifdef __cplusplus
}
#endif

View File

@@ -48,11 +48,20 @@ wfd_file_authenticator_authenticate(
return result;
}
static char const *
wfd_file_authenticator_get_type(
void * data)
{
(void) data;
return "username";
}
static struct wfd_authenticator_vtable
wfd_file_authenticator_vtable =
{
.dispose = &wfd_file_authenticator_dispose,
.authenticate = &wfd_file_authenticator_authenticate
.authenticate = &wfd_file_authenticator_authenticate,
.get_type = &wfd_file_authenticator_get_type
};
bool