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",
321 "application/json"));
338 handle->timeout_task = NULL;
354 struct MHD_Response *resp;
365 "application/json"));
367 "Access-Control-Allow-Methods",
378 struct MHD_Response *resp;
387 "Access-Control-Allow-Methods",
404 struct MHD_Response *resp;
406 result_str = json_dumps (
handle->resp_object, 0);
410 MHD_add_response_header (resp,
411 "Access-Control-Allow-Methods",
439 json_t *json_resource;
446 json_resource = json_object ();
448 json_array_append (
handle->resp_object, json_resource);
454 value = json_string (tmp);
455 json_object_set_new (json_resource,
"issuer",
value);
461 value = json_string (tmp);
462 json_object_set_new (json_resource,
"audience",
value);
465 value = json_string (tmp);
466 json_object_set_new (json_resource,
"rnd",
value);
483 char term_data[
handle->rest_handle->data_size + 1];
491 "Adding an credential for %s.\n",
503 for (ego_entry =
ego_head; NULL != ego_entry;
504 ego_entry = ego_entry->
next)
508 if (NULL == ego_entry)
515 if (0 >=
handle->rest_handle->data_size)
521 term_data[
handle->rest_handle->data_size] =
'\0';
523 handle->rest_handle->data,
524 handle->rest_handle->data_size);
525 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
528 json_decref (data_json);
530 "Unable to parse JSON from %s\n",
535 json_decref (data_json);
536 if (NULL == attribute)
539 "Unable to parse credential from %s\n",
588 cred_obj = json_object ();
589 json_object_set_new (cred_obj,
"value", json_string (tmp_value));
590 json_object_set_new (cred_obj,
"name", json_string (cred->
name));
592 json_object_set_new (cred_obj,
"type", json_string (
type));
595 json_object_set_new (cred_obj,
"issuer", json_string (issuer));
601 json_object_set_new (cred_obj,
"expiration", json_integer (
606 json_object_set_new (cred_obj,
"id", json_string (id_str));
611 json_t *attr_arr = json_array ();
618 attr_obj = json_object ();
619 json_object_set_new (attr_obj,
"value", json_string (tmp_value));
620 json_object_set_new (attr_obj,
"name", json_string (
623 json_object_set_new (attr_obj,
"flag", json_string (
"1"));
625 json_object_set_new (attr_obj,
"type", json_string (
type));
626 json_object_set_new (attr_obj,
"id", json_string (
""));
627 json_object_set_new (attr_obj,
"credential", json_string (
""));
628 json_array_append_new (attr_arr, attr_obj);
631 json_object_set_new (cred_obj,
"attributes", attr_arr);
633 json_array_append_new (
handle->resp_object, cred_obj);
658 "Getting credentials for %s.\n",
670 for (ego_entry =
ego_head; NULL != ego_entry;
671 ego_entry = ego_entry->
next)
674 handle->resp_object = json_array ();
677 if (NULL == ego_entry)
713 char *identity_id_str;
726 strdup (
handle->url + strlen (
728 identity = strtok (identity_id_str,
"/");
729 id = strtok (NULL,
"/");
730 if ((NULL ==
identity) || (NULL ==
id))
738 for (ego_entry =
ego_head; NULL != ego_entry;
739 ego_entry = ego_entry->
next)
742 handle->resp_object = json_array ();
743 if (NULL == ego_entry)
782 "Getting tickets for %s.\n",
792 for (ego_entry =
ego_head; NULL != ego_entry;
793 ego_entry = ego_entry->
next)
796 handle->resp_object = json_array ();
798 if (NULL == ego_entry)
829 char term_data[
handle->rest_handle->data_size + 1];
836 "Adding an attribute for %s.\n",
846 for (ego_entry =
ego_head; NULL != ego_entry;
847 ego_entry = ego_entry->
next)
851 if (NULL == ego_entry)
858 if (0 >=
handle->rest_handle->data_size)
864 term_data[
handle->rest_handle->data_size] =
'\0';
866 handle->rest_handle->data,
867 handle->rest_handle->data_size);
868 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
871 json_decref (data_json);
872 if (NULL == attribute)
875 "Unable to parse attribute from %s\n",
912 const char *val_str = NULL;
919 json_error_t *json_err = NULL;
924 char *jwt_body = strtok (jwt_string, delim);
925 jwt_body = strtok (NULL, delim);
927 (
void **) &decoded_jwt);
928 json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
931 json_object_foreach (json_val,
key,
value) {
934 val_str = json_dumps (
value, JSON_ENCODE_ANY);
944 "Attribute value from JWT Parser invalid!\n");
946 "Error: Referenced Claim Name not Found",
983 attr_obj = json_object ();
984 json_object_set_new (attr_obj,
"value", json_string (tmp_value));
985 json_object_set_new (attr_obj,
"name", json_string (attr->
name));
988 json_object_set_new (attr_obj,
"flag", json_string (
"0"));
990 json_object_set_new (attr_obj,
"flag", json_string (
"1"));
992 json_object_set_new (attr_obj,
"type", json_string (
type));
995 json_object_set_new (attr_obj,
"id", json_string (id_str));
999 json_object_set_new (attr_obj,
"credential", json_string (id_str));
1001 json_array_append (
handle->resp_object, attr_obj);
1002 json_decref (attr_obj);
1026 "Getting attributes for %s.\n",
1036 for (ego_entry =
ego_head; NULL != ego_entry;
1037 ego_entry = ego_entry->
next)
1040 handle->resp_object = json_array ();
1043 if (NULL == ego_entry)
1078 char *identity_id_str;
1091 identity = strtok (identity_id_str,
"/");
1092 id = strtok (NULL,
"/");
1093 if ((NULL ==
identity) || (NULL ==
id))
1101 for (ego_entry =
ego_head; NULL != ego_entry;
1102 ego_entry = ego_entry->
next)
1105 handle->resp_object = json_array ();
1106 if (NULL == ego_entry)
1137 char term_data[
handle->rest_handle->data_size + 1];
1143 if (0 >=
handle->rest_handle->data_size)
1149 term_data[
handle->rest_handle->data_size] =
'\0';
1151 handle->rest_handle->data,
1152 handle->rest_handle->data_size);
1153 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1154 if ((NULL == data_json) ||
1160 if (NULL != data_json)
1161 json_decref (data_json);
1164 json_decref (data_json);
1168 "Unable to parse ticket from %s\n",
1174 for (ego_entry =
ego_head; NULL != ego_entry;
1175 ego_entry = ego_entry->
next)
1183 if (NULL == ego_entry)
1220 if (NULL == val_str)
1223 "Failed to parse value for: %s\n",
1227 value = json_string (val_str);
1229 json_decref (
value);
1244 char term_data[
handle->rest_handle->data_size + 1];
1250 if (0 >=
handle->rest_handle->data_size)
1256 term_data[
handle->rest_handle->data_size] =
'\0';
1258 handle->rest_handle->data,
1259 handle->rest_handle->data_size);
1260 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1261 if (NULL == data_json)
1264 "Unable to parse JSON Object from %s\n",
1274 json_decref (data_json);
1277 for (ego_entry =
ego_head; NULL != ego_entry;
1278 ego_entry = ego_entry->
next)
1286 if (NULL == ego_entry)
1293 handle->resp_object = json_object ();
1315 struct MHD_Response *resp;
1321 "Access-Control-Allow-Methods",
1365 const char *identifier)
1380 ego_entry->
ego = ego;
1387 if (identifier != NULL)
1389 for (ego_entry =
ego_head; NULL != ego_entry;
1390 ego_entry = ego_entry->
next)
1392 if (ego_entry->
ego == ego)
1400 if (NULL == ego_entry)
1406 ego_entry->
ego = ego;
1416 for (ego_entry =
ego_head; NULL != ego_entry;
1417 ego_entry = ego_entry->
next)
1419 if (ego_entry->
ego == ego)
1422 if (NULL == ego_entry)
1446 { { MHD_HTTP_METHOD_GET,
1448 { MHD_HTTP_METHOD_POST,
1450 { MHD_HTTP_METHOD_DELETE,
1452 { MHD_HTTP_METHOD_GET,
1454 { MHD_HTTP_METHOD_POST,
1456 { MHD_HTTP_METHOD_DELETE,
1458 { MHD_HTTP_METHOD_GET,
1460 { MHD_HTTP_METHOD_POST,
1462 { MHD_HTTP_METHOD_POST,
1467 handle->response_code = 0;
1469 handle->proc_cls = proc_cls;
1471 handle->rest_handle = rest_handle;
1513 "%s, %s, %s, %s, %s",
1514 MHD_HTTP_METHOD_GET,
1515 MHD_HTTP_METHOD_POST,
1516 MHD_HTTP_METHOD_PUT,
1517 MHD_HTTP_METHOD_DELETE,
1518 MHD_HTTP_METHOD_OPTIONS);
1523 _ (
"Identity Provider REST API initialized\n"));
1549 for (ego_entry =
ego_head; NULL != ego_entry;)
1551 ego_tmp = ego_entry;
1552 ego_entry = ego_entry->
next;
1561 "Identity Provider REST plugin is finished\n");
struct GNUNET_MQ_MessageHandlers handlers[]
struct TestcasePlugin * plugin
The process handle to the testbed service.
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
static char * value
Value of the record to add/remove.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
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_VPN_Handle * handle
Handle to vpn service.
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_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
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.
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_PublicKey *pk)
Get the identifier (public key) of an ego.
#define GNUNET_log(kind,...)
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
#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.
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)
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.
#define GNUNET_RECLAIM_id_is_zero(a)
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential 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.
#define GNUNET_RECLAIM_id_generate(id)
int GNUNET_RECLAIM_credential_get_expiration(const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp)
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.
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.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
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_CRYPTO_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.
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_AttributeIterator * GNUNET_RECLAIM_get_attributes_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
Revoked an issued ticket.
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_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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_attribute_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete an attribute.
struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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)
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_credential_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *cred, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete a credential.
void GNUNET_RECLAIM_ticket_iteration_stop(struct GNUNET_RECLAIM_TicketIterator *it)
Stops iteration and releases the handle for further calls.
struct GNUNET_RECLAIM_CredentialIterator * GNUNET_RECLAIM_get_credentials_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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.
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 MHD_Response * GNUNET_REST_create_response(const char *data)
Create REST MHD response.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
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.
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)
#define GNUNET_REST_API_NS_RECLAIM_CREDENTIAL
Credential namespace.
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.
void * REST_reclaim_done(struct GNUNET_REST_Plugin *api)
Exit point from the plugin.
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.
static void revoke_ticket_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
static void consume_cont(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
#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 * REST_reclaim_init(struct GNUNET_CONFIGURATION_Handle *c)
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 cred_collect(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *cred)
Collect all credentials for an ego.
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.
enum GNUNET_GenericReturnValue REST_reclaim_process_request(void *plugin, struct GNUNET_REST_RequestHandle *rest_handle, GNUNET_REST_ResultProcessor proc, void *proc_cls)
Function processing the REST call.
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.
static void collect_finished_cb(void *cls)
static void attr_collect(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
Collect all attributes for an ego.
static struct RequestHandle * requests_tail
DLL.
static struct GNUNET_IDENTITY_Handle * identity_handle
Handle to Identity service.
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)
const struct GNUNET_CONFIGURATION_Handle * rcfg
The configuration handle.
#define ID_REST_STATE_POST_INIT
Done collecting egos.
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.
The default namestore ego.
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.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Handle for an operation with the identity service.
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_CRYPTO_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_CRYPTO_PublicKey identity
The ticket issuer (= the user)
struct returned by the initialization function of the plugin
void * cls
The closure of the plugin.
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
HTTP response code.
struct EgoEntry * ego_entry
IDENTITY Operation.
struct GNUNET_SCHEDULER_Task * timeout_task
ID of a task associated with the resolution process.
struct GNUNET_CRYPTO_PrivateKey priv_key
Pointer to ego private key.
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_RECLAIM_CredentialIterator * cred_it
Credential iterator.
json_t * resp_object
Response object.
struct GNUNET_REST_RequestHandle * rest_handle
Handle to rest request.
struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).