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

Feature/authentication (#14)

* makes wsfs_server_config opaque

* feature: try to create mount point, if not present

* fixes server start failure due to existing mountpoint

* added basic authentication infrastructure

* makes wsfs_server_config opaque

* feature: try to create mount point, if not present

* fixes server start failure due to existing mountpoint

* added basic authentication infrastructure

* added unit tests for credentials

* added unit tests for authenticators

* propagates authenticators to server protocol

* enabled username authentication in daemon example

* adds example to compute password hash

* adds infrastructure to execute commands

* added userdb to encapsulate authentication stuff

* adds session and session_manager

* fixes warning about unused param

* moves some logic from server_protocol to session

* makes wsfs_server_config opaque

* feature: try to create mount point, if not present

* fixes server start failure due to existing mountpoint

* added basic authentication infrastructure

* makes wsfs_server_config opaque

* added unit tests for credentials

* added unit tests for authenticators

* propagates authenticators to server protocol

* enabled username authentication in daemon example

* adds example to compute password hash

* adds infrastructure to execute commands

* added userdb to encapsulate authentication stuff

* adds session and session_manager

* fixes warning about unused param

* moves some logic from server_protocol to session

* updates libcrypto to version 1.1.0
This commit is contained in:
Falk Werner
2019-03-23 22:53:14 +01:00
committed by GitHub
parent de9095a978
commit 48185776b6
32 changed files with 1969 additions and 112 deletions

View File

@@ -0,0 +1,15 @@
#ifndef WSFS_ADAPTER_AUTHENTICATE_H
#define WSFS_ADAPTER_AUTHENTICATE_H
#ifndef __cplusplus
#include <stdbool.h>
#endif
struct wsfs_credentials;
typedef bool wsfs_authenticate_fn(
struct wsfs_credentials * credentials,
void * user_data);
#endif

View File

@@ -0,0 +1,25 @@
#ifndef WSFS_ADAPTER_CREDENTIALS_H
#define WSFS_ADAPTER_CREDENTIALS_H
#include "wsfs/adapter/api.h"
struct wsfs_credentials;
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSA_API char const * wsfs_credentials_type(
struct wsfs_credentials const * credentials);
extern WSFSA_API char const * wsfs_credentials_get(
struct wsfs_credentials const * credentials,
char const * key);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -2,31 +2,51 @@
#define WSFS_ADAPTER_SERVER_CONFIG_H
#include "wsfs/adapter/api.h"
#include "wsfs/adapter/authenticate.h"
struct wsfs_server_config
{
char * mount_point;
char * document_root;
char * key_path;
char * cert_path;
char * vhost_name;
int port;
};
struct wsfs_server_config;
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSA_API void wsfs_server_config_init(
extern WSFSA_API struct wsfs_server_config * wsfs_server_config_create(void);
extern WSFSA_API void wsfs_server_config_dispose(
struct wsfs_server_config * config);
extern WSFSA_API void wsfs_server_config_cleanup(
struct wsfs_server_config * config);
extern WSFSA_API void wsfs_server_config_clone(
struct wsfs_server_config * config,
struct wsfs_server_config * clone);
extern WSFSA_API void wsfs_server_config_set_mountpoint(
struct wsfs_server_config * config,
char const * mount_point);
extern WSFSA_API void wsfs_server_config_set_documentroot(
struct wsfs_server_config * config,
char const * document_root);
extern WSFSA_API void wsfs_server_config_set_keypath(
struct wsfs_server_config * config,
char const * key_path);
extern WSFSA_API void wsfs_server_config_set_certpath(
struct wsfs_server_config * config,
char const * cert_path);
extern WSFSA_API void wsfs_server_config_set_vhostname(
struct wsfs_server_config * config,
char const * vhost_name);
extern WSFSA_API void wsfs_server_config_set_port(
struct wsfs_server_config * config,
int port);
extern WSFSA_API void wsfs_server_config_add_authenticator(
struct wsfs_server_config * config,
char const * type,
wsfs_authenticate_fn * authenticate,
void * user_data
);
#ifdef __cplusplus
}

View File

@@ -1,7 +1,8 @@
#ifndef WSFS_ADAPTER_SERVER_PROTOCOL_H
#define WSFS_ADAPTER_SERVER_PROTOCOL_H
#include "wsfs/adapter/api.h"
#include <wsfs/adapter/api.h>
#include <wsfs/adapter/authenticate.h>
struct wsfs_server_protocol;
struct lws_protocols;
@@ -21,6 +22,12 @@ extern WSFSA_API void wsfs_server_protocol_init_lws(
struct wsfs_server_protocol * protocol,
struct lws_protocols * lws_protocol);
extern WSFSA_API void wsfs_server_protocol_add_authenticator(
struct wsfs_server_protocol * protocol,
char const * type,
wsfs_authenticate_fn * authenticate,
void * user_data);
#ifdef __cplusplus
}
#endif

View File

@@ -7,5 +7,7 @@
#include <wsfs/adapter/server.h>
#include <wsfs/adapter/server_config.h>
#include <wsfs/adapter/server_protocol.h>
#include <wsfs/adapter/authenticate.h>
#include <wsfs/adapter/credentials.h>
#endif