Extract capability token module
This commit is contained in:
parent
d07dae5252
commit
578aa09860
|
|
@ -24,7 +24,7 @@ target_link_libraries(amduat_federation
|
|||
PRIVATE amduat_asl amduat_enc amduat_util amduat_fed
|
||||
)
|
||||
|
||||
set(amduatd_sources src/amduatd.c)
|
||||
set(amduatd_sources src/amduatd.c src/amduatd_caps.c)
|
||||
if(AMDUATD_ENABLE_UI)
|
||||
list(APPEND amduatd_sources src/amduatd_ui.c)
|
||||
endif()
|
||||
|
|
|
|||
1738
src/amduatd.c
1738
src/amduatd.c
File diff suppressed because it is too large
Load diff
1947
src/amduatd_caps.c
Normal file
1947
src/amduatd_caps.c
Normal file
File diff suppressed because it is too large
Load diff
48
src/amduatd_caps.h
Normal file
48
src/amduatd_caps.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef AMDUATD_CAPS_H
|
||||
#define AMDUATD_CAPS_H
|
||||
|
||||
#include "amduatd_ui.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct amduatd_cfg_t {
|
||||
const char *space_id;
|
||||
bool space_enabled;
|
||||
bool migrate_unscoped_edges;
|
||||
} amduatd_cfg_t;
|
||||
|
||||
typedef enum {
|
||||
AMDUATD_REF_OK = 0,
|
||||
AMDUATD_REF_ERR_INVALID = 1,
|
||||
AMDUATD_REF_ERR_NOT_FOUND = 2,
|
||||
AMDUATD_REF_ERR_INTERNAL = 3
|
||||
} amduatd_ref_status_t;
|
||||
|
||||
typedef struct amduatd_caps_t {
|
||||
bool enabled;
|
||||
bool enable_cap_reads;
|
||||
amduat_octets_t hmac_key;
|
||||
} amduatd_caps_t;
|
||||
|
||||
bool amduatd_caps_init(amduatd_caps_t *caps,
|
||||
const amduatd_cfg_t *cfg,
|
||||
const char *root_path);
|
||||
|
||||
void amduatd_caps_free(amduatd_caps_t *caps);
|
||||
|
||||
bool amduatd_caps_can_handle(const amduatd_http_req_t *req);
|
||||
|
||||
bool amduatd_caps_handle(amduatd_ctx_t *ctx,
|
||||
const amduatd_http_req_t *req,
|
||||
amduatd_http_resp_t *resp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AMDUATD_CAPS_H */
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef AMDUATD_UI_H
|
||||
#define AMDUATD_UI_H
|
||||
|
||||
#include "amduat/asl/asl_store_fs_meta.h"
|
||||
#include "amduat/asl/store.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
|
@ -11,6 +12,10 @@
|
|||
#define AMDUATD_ENABLE_UI 1
|
||||
#endif
|
||||
|
||||
typedef struct amduatd_caps_t amduatd_caps_t;
|
||||
typedef struct amduatd_cfg_t amduatd_cfg_t;
|
||||
typedef struct amduatd_concepts_t amduatd_concepts_t;
|
||||
|
||||
typedef struct {
|
||||
char method[8];
|
||||
char path[1024];
|
||||
|
|
@ -33,6 +38,11 @@ typedef struct {
|
|||
typedef struct {
|
||||
amduat_asl_store_t *store;
|
||||
amduat_reference_t ui_ref;
|
||||
const amduat_asl_store_fs_config_t *store_cfg;
|
||||
amduatd_concepts_t *concepts;
|
||||
const amduatd_cfg_t *daemon_cfg;
|
||||
const char *root_path;
|
||||
amduatd_caps_t *caps;
|
||||
} amduatd_ctx_t;
|
||||
|
||||
#if AMDUATD_ENABLE_UI
|
||||
|
|
|
|||
Loading…
Reference in a new issue