28 #include "microhttpd.h"
38 #include "gnunet_signatures.h"
43 #define GNUNET_REST_API_NS_RECLAIM "/reclaim"
48 #define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes"
53 #define GNUNET_REST_API_NS_RECLAIM_CREDENTIAL "/reclaim/credential"
58 #define GNUNET_REST_API_NS_IDENTITY_TICKETS "/reclaim/tickets"
63 #define GNUNET_REST_API_NS_IDENTITY_REVOKE "/reclaim/revoke"
68 #define GNUNET_REST_API_NS_IDENTITY_CONSUME "/reclaim/consume"
73 #define ID_REST_STATE_INIT 0
78 #define ID_REST_STATE_POST_INIT 1
279 if (NULL !=
handle->resp_object)
280 json_decref (
handle->resp_object);
281 if (NULL !=
handle->timeout_task)
283 if (NULL !=
handle->attr_it)
285 if (NULL !=
handle->cred_it)
287 if (NULL !=
handle->ticket_it)
293 if (NULL !=
handle->attr_list)
311 struct MHD_Response *resp;
315 if (0 ==
handle->response_code)
320 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
"Content-Type",
"application/json"));
337 handle->timeout_task = NULL;
353 struct MHD_Response *resp;
364 "application/json"));
366 "Access-Control-Allow-Methods",
377 struct MHD_Response *resp;
386 "Access-Control-Allow-Methods",
403 struct MHD_Response *resp;
405 result_str = json_dumps (
handle->resp_object, 0);
409 MHD_add_response_header (resp,
410 "Access-Control-Allow-Methods",
438 json_t *json_resource;
445 json_resource = json_object ();
447 json_array_append (
handle->resp_object, json_resource);
453 value = json_string (tmp);
454 json_object_set_new (json_resource,
"issuer",
value);
460 value = json_string (tmp);
461 json_object_set_new (json_resource,
"audience",
value);
464 value = json_string (tmp);
465 json_object_set_new (json_resource,
"rnd",
value);
482 char term_data[
handle->rest_handle->data_size + 1];
490 "Adding an credential for %s.\n",
502 for (ego_entry =
ego_head; NULL != ego_entry;
503 ego_entry = ego_entry->
next)
507 if (NULL == ego_entry)
514 if (0 >=
handle->rest_handle->data_size)
520 term_data[
handle->rest_handle->data_size] =
'\0';
522 handle->rest_handle->data,
523 handle->rest_handle->data_size);
524 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
527 json_decref (data_json);
529 "Unable to parse JSON from %s\n",
534 json_decref (data_json);
535 if (NULL == attribute)
538 "Unable to parse credential from %s\n",
587 cred_obj = json_object ();
588 json_object_set_new (cred_obj,
"value", json_string (tmp_value));
589 json_object_set_new (cred_obj,
"name", json_string (cred->
name));
591 json_object_set_new (cred_obj,
"type", json_string (
type));
594 json_object_set_new (cred_obj,
"issuer", json_string (issuer));
600 json_object_set_new (cred_obj,
"expiration", json_integer (
605 json_object_set_new (cred_obj,
"id", json_string (id_str));
610 json_t *attr_arr = json_array ();
617 attr_obj = json_object ();
618 json_object_set_new (attr_obj,
"value", json_string (tmp_value));
619 json_object_set_new (attr_obj,
"name", json_string (
622 json_object_set_new (attr_obj,
"flag", json_string (
"1"));
624 json_object_set_new (attr_obj,
"type", json_string (
type));
625 json_object_set_new (attr_obj,
"id", json_string (
""));
626 json_object_set_new (attr_obj,
"credential", json_string (
""));
627 json_array_append_new (attr_arr, attr_obj);
630 json_object_set_new (cred_obj,
"attributes", attr_arr);
632 json_array_append_new (
handle->resp_object, cred_obj);
657 "Getting credentials for %s.\n",
669 for (ego_entry =
ego_head; NULL != ego_entry;
670 ego_entry = ego_entry->
next)
673 handle->resp_object = json_array ();
676 if (NULL == ego_entry)
712 char *identity_id_str;
725 strdup (
handle->url + strlen (
727 identity = strtok (identity_id_str,
"/");
728 id = strtok (NULL,
"/");
729 if ((NULL ==
identity) || (NULL ==
id))
737 for (ego_entry =
ego_head; NULL != ego_entry;
738 ego_entry = ego_entry->
next)
741 handle->resp_object = json_array ();
742 if (NULL == ego_entry)
781 "Getting tickets for %s.\n",
791 for (ego_entry =
ego_head; NULL != ego_entry;
792 ego_entry = ego_entry->
next)
795 handle->resp_object = json_array ();
797 if (NULL == ego_entry)
828 char term_data[
handle->rest_handle->data_size + 1];
835 "Adding an attribute for %s.\n",
845 for (ego_entry =
ego_head; NULL != ego_entry;
846 ego_entry = ego_entry->
next)
850 if (NULL == ego_entry)
857 if (0 >=
handle->rest_handle->data_size)
863 term_data[
handle->rest_handle->data_size] =
'\0';
865 handle->rest_handle->data,
866 handle->rest_handle->data_size);
867 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
870 json_decref (data_json);
871 if (NULL == attribute)
874 "Unable to parse attribute from %s\n",
911 const char *val_str = NULL;
918 json_error_t *json_err = NULL;
923 char *jwt_body = strtok (jwt_string, delim);
924 jwt_body = strtok (NULL, delim);
926 (
void **) &decoded_jwt);
927 json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
930 json_object_foreach (json_val,
key,
value) {
933 val_str = json_dumps (
value, JSON_ENCODE_ANY);
943 "Attribute value from JWT Parser invalid!\n");
945 "Error: Referenced Claim Name not Found",
982 attr_obj = json_object ();
983 json_object_set_new (attr_obj,
"value", json_string (tmp_value));
984 json_object_set_new (attr_obj,
"name", json_string (attr->
name));
987 json_object_set_new (attr_obj,
"flag", json_string (
"0"));
989 json_object_set_new (attr_obj,
"flag", json_string (
"1"));
991 json_object_set_new (attr_obj,
"type", json_string (
type));
994 json_object_set_new (attr_obj,
"id", json_string (id_str));
998 json_object_set_new (attr_obj,
"credential", json_string (id_str));
1000 json_array_append (
handle->resp_object, attr_obj);
1001 json_decref (attr_obj);
1025 "Getting attributes for %s.\n",
1035 for (ego_entry =
ego_head; NULL != ego_entry;
1036 ego_entry = ego_entry->
next)
1039 handle->resp_object = json_array ();
1042 if (NULL == ego_entry)
1077 char *identity_id_str;
1090 identity = strtok (identity_id_str,
"/");
1091 id = strtok (NULL,
"/");
1092 if ((NULL ==
identity) || (NULL ==
id))
1100 for (ego_entry =
ego_head; NULL != ego_entry;
1101 ego_entry = ego_entry->
next)
1104 handle->resp_object = json_array ();
1105 if (NULL == ego_entry)
1136 char term_data[
handle->rest_handle->data_size + 1];
1142 if (0 >=
handle->rest_handle->data_size)
1148 term_data[
handle->rest_handle->data_size] =
'\0';
1150 handle->rest_handle->data,
1151 handle->rest_handle->data_size);
1152 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1153 if ((NULL == data_json) ||
1159 if (NULL != data_json)
1160 json_decref (data_json);
1163 json_decref (data_json);
1167 "Unable to parse ticket from %s\n",
1173 for (ego_entry =
ego_head; NULL != ego_entry;
1174 ego_entry = ego_entry->
next)
1182 if (NULL == ego_entry)
1219 if (NULL == val_str)
1222 "Failed to parse value for: %s\n",
1226 value = json_string (val_str);
1228 json_decref (
value);
1243 char term_data[
handle->rest_handle->data_size + 1];
1249 if (0 >=
handle->rest_handle->data_size)
1255 term_data[
handle->rest_handle->data_size] =
'\0';
1257 handle->rest_handle->data,
1258 handle->rest_handle->data_size);
1259 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1260 if (NULL == data_json)
1263 "Unable to parse JSON Object from %s\n",
1273 json_decref (data_json);
1276 for (ego_entry =
ego_head; NULL != ego_entry;
1277 ego_entry = ego_entry->
next)
1285 if (NULL == ego_entry)
1292 handle->resp_object = json_object ();
1314 struct MHD_Response *resp;
1362 const char *identifier)
1377 ego_entry->
ego = ego;
1384 if (identifier != NULL)
1386 for (ego_entry =
ego_head; NULL != ego_entry;
1387 ego_entry = ego_entry->
next)
1389 if (ego_entry->
ego == ego)
1397 if (NULL == ego_entry)
1403 ego_entry->
ego = ego;
1413 for (ego_entry =
ego_head; NULL != ego_entry;
1414 ego_entry = ego_entry->
next)
1416 if (ego_entry->
ego == ego)
1419 if (NULL == ego_entry)
1442 { { MHD_HTTP_METHOD_GET,
1444 { MHD_HTTP_METHOD_POST,
1446 { MHD_HTTP_METHOD_DELETE,
1448 { MHD_HTTP_METHOD_GET,
1450 { MHD_HTTP_METHOD_POST,
1452 { MHD_HTTP_METHOD_DELETE,
1454 { MHD_HTTP_METHOD_GET,
1456 { MHD_HTTP_METHOD_POST,
1458 { MHD_HTTP_METHOD_POST,
1463 handle->response_code = 0;
1465 handle->proc_cls = proc_cls;
1467 handle->rest_handle = rest_handle;
1510 "%s, %s, %s, %s, %s",
1511 MHD_HTTP_METHOD_GET,
1512 MHD_HTTP_METHOD_POST,
1513 MHD_HTTP_METHOD_PUT,
1514 MHD_HTTP_METHOD_DELETE,
1515 MHD_HTTP_METHOD_OPTIONS);
1520 _ (
"Identity Provider REST API initialized\n"));
1547 for (ego_entry =
ego_head; NULL != ego_entry;)
1549 ego_tmp = ego_entry;
1550 ego_entry = ego_entry->
next;
1559 "Identity Provider REST plugin is finished\n");
static size_t data_size
Number of bytes in data.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
struct TestcasePlugin * plugin
The process handle to the testbed service.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
uint32_t data
The data value.
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
static char * value
Value of the record to add/remove.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static char * type_str
Attribute type.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
API that can be used to manipulate GNS record data.
Identity service; implements identity management for GNUnet.
void GNUNET_JSON_parse_free(struct GNUNET_JSON_Specification *spec)
Frees all elements allocated during a GNUNET_JSON_parse() operation.
enum GNUNET_GenericReturnValue GNUNET_JSON_parse(const json_t *root, struct GNUNET_JSON_Specification *spec, const char **error_json_name, unsigned int *error_line)
Navigate and parse data in a JSON tree.
struct GNUNET_JSON_Specification GNUNET_JSON_spec_end(void)
End of a parser specification.
Identity attribute definitions.
reclaim service; implements identity and personal data sharing for GNUnet
API for helper library to parse/create REST.
GNUnet service REST plugin header.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_IDENTITY_PublicKey *pk)
Get the identifier (public key) of an ego.
char * GNUNET_IDENTITY_public_key_to_string(const struct GNUNET_IDENTITY_PublicKey *key)
Creates a (Base32) string representation of the public key.
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
char * GNUNET_RECLAIM_credential_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'claim' of an credential to a string.
int GNUNET_RECLAIM_attribute_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'claim' of an attribute to the binary representation.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
char * GNUNET_RECLAIM_credential_get_issuer(const struct GNUNET_RECLAIM_Credential *cred)
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential type string.
#define GNUNET_RECLAIM_id_is_zero(a)
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'claim' of an attribute to a string.
#define GNUNET_RECLAIM_id_generate(id)
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
int GNUNET_RECLAIM_credential_get_expiration(const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp)
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_credential_get_attributes(const struct GNUNET_RECLAIM_Credential *cred)
Convert an credential type name to the corresponding number.
uint32_t GNUNET_RECLAIM_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
void GNUNET_RECLAIM_disconnect(struct GNUNET_RECLAIM_Handle *h)
Disconnect from identity provider service.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store a credential.
void GNUNET_RECLAIM_ticket_iteration_next(struct GNUNET_RECLAIM_TicketIterator *it)
Calls the ticket processor specified in GNUNET_RECLAIM_ticket_iteration_start for the next record.
struct GNUNET_RECLAIM_AttributeIterator * GNUNET_RECLAIM_get_attributes_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
List all attributes for a local identity.
void GNUNET_RECLAIM_get_attributes_stop(struct GNUNET_RECLAIM_AttributeIterator *it)
Stops iteration and releases the handle for further calls.
void GNUNET_RECLAIM_get_credentials_next(struct GNUNET_RECLAIM_CredentialIterator *ait)
Calls the record processor specified in GNUNET_RECLAIM_get_credentials_start for the next record.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store an attribute.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *cred, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete a credential.
struct GNUNET_RECLAIM_CredentialIterator * GNUNET_RECLAIM_get_credentials_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_CredentialResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
List all credentials for a local identity.
void GNUNET_RECLAIM_get_attributes_next(struct GNUNET_RECLAIM_AttributeIterator *it)
Calls the record processor specified in GNUNET_RECLAIM_get_attributes_start for the next record.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete an attribute.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
Revoked an issued ticket.
struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
Lists all tickets that have been issued to remote identites (relying parties)
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
void GNUNET_RECLAIM_get_credentials_stop(struct GNUNET_RECLAIM_CredentialIterator *ait)
Stops iteration and releases the handle for further calls.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
void GNUNET_RECLAIM_ticket_iteration_stop(struct GNUNET_RECLAIM_TicketIterator *it)
Stops iteration and releases the handle for further calls.
struct MHD_Response * GNUNET_REST_create_response(const char *data)
Create REST MHD response.
int GNUNET_REST_handle_request(struct GNUNET_REST_RequestHandle *conn, const struct GNUNET_REST_RequestHandler *handlers, struct GNUNET_REST_RequestHandlerError *err, void *cls)
void(* GNUNET_REST_ResultProcessor)(void *cls, struct MHD_Response *resp, int status)
Iterator called on obtained result for a REST result.
#define GNUNET_REST_HANDLER_END
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
size_t GNUNET_STRINGS_base64_decode(const char *data, size_t len, void **output)
Decode from Base64.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
#define GNUNET_TIME_UNIT_HOURS
One hour.
@ MHD_HTTP_BAD_REQUEST
Bad Request [RFC7231, Section 6.5.1].
@ MHD_HTTP_OK
OK [RFC7231, Section 6.3.1].
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_credential(struct GNUNET_RECLAIM_Credential **cred)
JSON Specification for credential claims.
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_attribute(struct GNUNET_RECLAIM_Attribute **attr)
JSON Specification for Reclaim claims.
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_ticket(struct GNUNET_RECLAIM_Ticket **ticket)
JSON Specification for Reclaim tickets.
static struct EgoEntry * ego_tail
Ego list.
#define GNUNET_REST_API_NS_IDENTITY_REVOKE
Revoke namespace.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
static void finished_cont(void *cls, int32_t success, const char *emsg)
static void attr_collect(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
Collect all attributes for an ego.
void * libgnunet_plugin_rest_reclaim_done(void *cls)
Exit point from the plugin.
#define GNUNET_REST_API_NS_RECLAIM_CREDENTIAL
Credential namespace.
static void delete_finished_cb(void *cls, int32_t success, const char *emsg)
static void do_timeout(void *cls)
Task run on timeout, sends error message.
#define GNUNET_REST_API_NS_IDENTITY_TICKETS
Ticket namespace.
#define GNUNET_REST_API_NS_IDENTITY_CONSUME
Revoke namespace.
static void return_response(void *cls)
Return attributes for identity.
#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES
Attribute namespace.
static void delete_credential_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Deletes credential from an identity.
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration handle.
static void revoke_ticket_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
#define GNUNET_REST_API_NS_RECLAIM
REST root namespace.
static void delete_attribute_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
List attributes for identity request.
void * libgnunet_plugin_rest_reclaim_init(void *cls)
Entry point for the plugin.
static void collect_error_cb(void *cls)
static void list_tickets_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
List tickets for identity request.
#define ID_REST_STATE_INIT
State while collecting all egos.
static struct RequestHandle * requests_head
DLL.
static void options_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Respond to OPTIONS request.
static int state
The processing state.
static struct EgoEntry * ego_head
Ego list.
static void list_ego(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier)
If listing is enabled, prints information about the egos.
static void list_credential_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Lists credential for identity request.
static void add_credential_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
static char * allow_methods
HTTP methods allows for this plugin.
struct GNUNET_RECLAIM_Attribute * parse_jwt(const struct GNUNET_RECLAIM_Credential *cred, const char *claim)
Parse a JWT and return the respective claim value as Attribute.
static void collect_finished_cb(void *cls)
static void cred_collect(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *cred)
Collect all credentials for an ego.
static struct RequestHandle * requests_tail
DLL.
static struct GNUNET_IDENTITY_Handle * identity_handle
Handle to Identity service.
static void consume_cont(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
static void add_attribute_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
static void list_attribute_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
List attributes for identity request.
static void consume_ticket_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
#define ID_REST_STATE_POST_INIT
Done collecting egos.
static enum GNUNET_GenericReturnValue rest_identity_process_request(struct GNUNET_REST_RequestHandle *rest_handle, GNUNET_REST_ResultProcessor proc, void *proc_cls)
static void do_error(void *cls)
Task run on error, sends error message.
static void ticket_collect(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
Collect all attributes for an ego.
static void cleanup_handle(void *cls)
Cleanup lookup handle.
char * identifier
Ego Identifier.
struct EgoEntry * prev
DLL.
char * keystring
Public key string.
struct EgoEntry * next
DLL.
struct GNUNET_IDENTITY_Ego * ego
The Ego.
void * cls
Closure for all of the callbacks.
Handle for an operation with the identity service.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Entry in parser specification for GNUNET_JSON_parse().
void * cls
Closure for parser and cleaner.
Handle for a attribute iterator operation.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
A list of GNUNET_RECLAIM_Attribute structures.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_Identifier id
ID.
uint32_t type
Type of Claim.
const void * data
Binary value stored as attribute value.
size_t data_size
Number of bytes in data.
Handle for a credential iterator operation.
uint32_t type
Type/Format of Claim.
const char * name
The name of the credential.
const void * data
Binary value stored as credential value.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_Identifier id
ID.
Handle for an operation with the service.
A credential presentation.
Handle for a ticket iterator operation.
The authorization ticket.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_IDENTITY_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_IDENTITY_PublicKey identity
The ticket issuer (= the user)
struct returned by the initialization function of the plugin
void * cls
The closure of the plugin.
enum GNUNET_GenericReturnValue(* process_request)(struct GNUNET_REST_RequestHandle *handle, GNUNET_REST_ResultProcessor proc, void *proc_cls)
Function to process a REST call.
const char * url
The url as string.
void(* proc)(struct GNUNET_REST_RequestHandle *handle, const char *url, void *cls)
Namespace to handle.
Entry in list of pending tasks.
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
struct GNUNET_RECLAIM_TicketIterator * ticket_it
Ticket iterator.
struct GNUNET_RECLAIM_Ticket ticket
A ticket.
char * emsg
Error response message.
struct GNUNET_IDENTITY_Operation * op
IDENTITY Operation.
struct RequestHandle * prev
DLL.
struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute claim list.
struct GNUNET_RECLAIM_Operation * idp_op
Idp Operation.
int response_code
Response code.
struct EgoEntry * ego_entry
IDENTITY Operation.
struct GNUNET_SCHEDULER_Task * timeout_task
ID of a task associated with the resolution process.
void * proc_cls
The closure of the result processor.
struct GNUNET_RECLAIM_AttributeIterator * attr_it
Attribute iterator.
GNUNET_REST_ResultProcessor proc
The plugin result processor.
struct RequestHandle * next
DLL.
struct GNUNET_IDENTITY_PrivateKey priv_key
Pointer to ego private key.
struct GNUNET_RECLAIM_CredentialIterator * cred_it
Credential iterator.
json_t * resp_object
Response object.
struct GNUNET_REST_RequestHandle * rest_handle
Rest connection.
struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model