1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/lib/webfuse_provider/impl/credentials.c

47 lines
999 B
C
Raw Normal View History

2020-06-16 21:39:45 +00:00
#include "webfuse_provider/impl/credentials.h"
2020-02-25 21:05:48 +00:00
#include <stdlib.h>
#include <string.h>
void wfp_impl_credentials_init(
struct wfp_credentials * credentials)
{
credentials->type = NULL;
credentials->contents = json_object();
}
void wfp_impl_credentials_cleanup(
struct wfp_credentials * credentials)
{
free(credentials->type);
json_decref(credentials->contents);
}
void wfp_impl_credentials_set_type(
struct wfp_credentials * credentials,
char const * type)
{
free(credentials->type);
credentials->type = strdup(type);
}
void wfp_impl_credentials_add(
struct wfp_credentials * credentials,
char const * key,
char const * value)
{
json_object_set_new(credentials->contents, key, json_string(value));
}
2020-03-01 12:42:46 +00:00
char const * wfp_impl_credentials_get_type(
struct wfp_credentials * credentials)
{
return credentials->type;
}
json_t * wfp_impl_credentials_get(
struct wfp_credentials * credentials)
{
return credentials->contents;
}