29#include "microhttpd.h"
46#define GNUNET_REST_API_NS_RECLAIM "/reclaim"
51#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes"
56#define GNUNET_REST_API_NS_RECLAIM_CREDENTIAL "/reclaim/credential"
61#define GNUNET_REST_API_NS_IDENTITY_TICKETS "/reclaim/tickets"
66#define GNUNET_REST_API_NS_IDENTITY_REVOKE "/reclaim/revoke"
71#define GNUNET_REST_API_NS_IDENTITY_CONSUME "/reclaim/consume"
76#define ID_REST_STATE_INIT 0
81#define ID_REST_STATE_POST_INIT 1
282 if (NULL !=
handle->resp_object)
283 json_decref (
handle->resp_object);
284 if (NULL !=
handle->timeout_task)
286 if (NULL !=
handle->attr_it)
288 if (NULL !=
handle->cred_it)
290 if (NULL !=
handle->ticket_it)
296 if (NULL !=
handle->attr_list)
314 struct MHD_Response *resp;
318 if (0 ==
handle->response_code)
320 handle->response_code = MHD_HTTP_BAD_REQUEST;
323 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
"Content-Type",
324 "application/json"));
341 handle->timeout_task = NULL;
357 struct MHD_Response *resp;
368 "application/json"));
370 "Access-Control-Allow-Methods",
381 struct MHD_Response *resp;
390 "Access-Control-Allow-Methods",
407 struct MHD_Response *resp;
409 result_str = json_dumps (
handle->resp_object, 0);
413 MHD_add_response_header (resp,
414 "Access-Control-Allow-Methods",
443 json_t *json_resource;
447 json_resource = json_object ();
448 json_array_append (
handle->resp_object, json_resource);
450 json_object_set_new (json_resource,
"gns_name", json_string (
ticket->
gns_name)
452 json_object_set_new (json_resource,
"rp_uri", json_string (rp_uri));
468 char term_data[
handle->rest_handle->data_size + 1];
476 "Adding an credential for %s.\n",
488 for (ego_entry =
ego_head; NULL != ego_entry;
489 ego_entry = ego_entry->
next)
493 if (NULL == ego_entry)
500 if (0 >=
handle->rest_handle->data_size)
506 term_data[
handle->rest_handle->data_size] =
'\0';
508 handle->rest_handle->data,
509 handle->rest_handle->data_size);
510 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
513 json_decref (data_json);
515 "Unable to parse JSON from %s\n",
520 json_decref (data_json);
521 if (NULL == attribute)
524 "Unable to parse credential from %s\n",
573 cred_obj = json_object ();
574 json_object_set_new (cred_obj,
"value", json_string (tmp_value));
575 json_object_set_new (cred_obj,
"name", json_string (
cred->name));
577 json_object_set_new (cred_obj,
"type", json_string (
type));
580 json_object_set_new (cred_obj,
"issuer", json_string (issuer));
586 json_object_set_new (cred_obj,
"expiration", json_integer (
591 json_object_set_new (cred_obj,
"id", json_string (id_str));
596 json_t *attr_arr = json_array ();
603 attr_obj = json_object ();
604 json_object_set_new (attr_obj,
"value", json_string (tmp_value));
605 json_object_set_new (attr_obj,
"name", json_string (
608 json_object_set_new (attr_obj,
"flag", json_string (
"1"));
610 json_object_set_new (attr_obj,
"type", json_string (
type));
611 json_object_set_new (attr_obj,
"id", json_string (
""));
612 json_object_set_new (attr_obj,
"credential", json_string (
""));
613 json_array_append_new (attr_arr, attr_obj);
616 json_object_set_new (cred_obj,
"attributes", attr_arr);
618 json_array_append_new (
handle->resp_object, cred_obj);
643 "Getting credentials for %s.\n",
655 for (ego_entry =
ego_head; NULL != ego_entry;
656 ego_entry = ego_entry->
next)
659 handle->resp_object = json_array ();
662 if (NULL == ego_entry)
698 char *identity_id_str;
711 strdup (
handle->url + strlen (
713 identity = strtok (identity_id_str,
"/");
714 id = strtok (NULL,
"/");
715 if ((NULL ==
identity) || (NULL ==
id))
723 for (ego_entry =
ego_head; NULL != ego_entry;
724 ego_entry = ego_entry->
next)
727 handle->resp_object = json_array ();
728 if (NULL == ego_entry)
767 "Getting tickets for %s.\n",
777 for (ego_entry =
ego_head; NULL != ego_entry;
778 ego_entry = ego_entry->
next)
781 handle->resp_object = json_array ();
783 if (NULL == ego_entry)
814 char term_data[
handle->rest_handle->data_size + 1];
821 "Adding an attribute for %s.\n",
831 for (ego_entry =
ego_head; NULL != ego_entry;
832 ego_entry = ego_entry->
next)
836 if (NULL == ego_entry)
843 if (0 >=
handle->rest_handle->data_size)
849 term_data[
handle->rest_handle->data_size] =
'\0';
851 handle->rest_handle->data,
852 handle->rest_handle->data_size);
853 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
856 json_decref (data_json);
857 if (NULL == attribute)
860 "Unable to parse attribute from %s\n",
969 attr_obj = json_object ();
970 json_object_set_new (attr_obj,
"value", json_string (tmp_value));
971 json_object_set_new (attr_obj,
"name", json_string (attr->
name));
974 json_object_set_new (attr_obj,
"flag", json_string (
"0"));
976 json_object_set_new (attr_obj,
"flag", json_string (
"1"));
978 json_object_set_new (attr_obj,
"type", json_string (
type));
981 json_object_set_new (attr_obj,
"id", json_string (id_str));
985 json_object_set_new (attr_obj,
"credential", json_string (id_str));
987 json_array_append (
handle->resp_object, attr_obj);
988 json_decref (attr_obj);
1012 "Getting attributes for %s.\n",
1022 for (ego_entry =
ego_head; NULL != ego_entry;
1023 ego_entry = ego_entry->
next)
1026 handle->resp_object = json_array ();
1029 if (NULL == ego_entry)
1064 char *identity_id_str;
1077 identity = strtok (identity_id_str,
"/");
1078 id = strtok (NULL,
"/");
1079 if ((NULL ==
identity) || (NULL ==
id))
1087 for (ego_entry =
ego_head; NULL != ego_entry;
1088 ego_entry = ego_entry->
next)
1091 handle->resp_object = json_array ();
1092 if (NULL == ego_entry)
1124 char term_data[
handle->rest_handle->data_size + 1];
1130 if (0 >=
handle->rest_handle->data_size)
1136 term_data[
handle->rest_handle->data_size] =
'\0';
1138 handle->rest_handle->data,
1139 handle->rest_handle->data_size);
1140 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1141 if ((NULL == data_json) ||
1147 if (NULL != data_json)
1148 json_decref (data_json);
1151 json_decref (data_json);
1155 "Unable to parse ticket from %s\n",
1163 for (ego_entry =
ego_head; NULL != ego_entry;
1164 ego_entry = ego_entry->
next)
1167 if (0 == memcmp (&iss,
1172 if (NULL == ego_entry)
1209 if (NULL == val_str)
1212 "Failed to parse value for: %s\n",
1216 value = json_string (val_str);
1218 json_decref (
value);
1230 char term_data[
handle->rest_handle->data_size + 1];
1239 if (0 >=
handle->rest_handle->data_size)
1245 term_data[
handle->rest_handle->data_size] =
'\0';
1247 handle->rest_handle->data,
1248 handle->rest_handle->data_size);
1249 data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
1250 if (NULL == data_json)
1253 "Unable to parse JSON Object from %s\n",
1263 json_decref (data_json);
1266 handle->resp_object = json_object ();
1288 struct MHD_Response *resp;
1294 "Access-Control-Allow-Methods",
1338 const char *identifier)
1353 ego_entry->
ego = ego;
1360 if (identifier != NULL)
1362 for (ego_entry =
ego_head; NULL != ego_entry;
1363 ego_entry = ego_entry->
next)
1365 if (ego_entry->
ego == ego)
1373 if (NULL == ego_entry)
1379 ego_entry->
ego = ego;
1389 for (ego_entry =
ego_head; NULL != ego_entry;
1390 ego_entry = ego_entry->
next)
1392 if (ego_entry->
ego == ego)
1395 if (NULL == ego_entry)
1419 { { MHD_HTTP_METHOD_GET,
1421 { MHD_HTTP_METHOD_POST,
1423 { MHD_HTTP_METHOD_DELETE,
1425 { MHD_HTTP_METHOD_GET,
1427 { MHD_HTTP_METHOD_POST,
1429 { MHD_HTTP_METHOD_DELETE,
1431 { MHD_HTTP_METHOD_GET,
1433 { MHD_HTTP_METHOD_POST,
1435 { MHD_HTTP_METHOD_POST,
1440 handle->response_code = 0;
1442 handle->proc_cls = proc_cls;
1444 handle->rest_handle = rest_handle;
1486 "%s, %s, %s, %s, %s",
1487 MHD_HTTP_METHOD_GET,
1488 MHD_HTTP_METHOD_POST,
1489 MHD_HTTP_METHOD_PUT,
1490 MHD_HTTP_METHOD_DELETE,
1491 MHD_HTTP_METHOD_OPTIONS);
1496 _ (
"Identity Provider REST API initialized\n"));
1522 for (ego_entry =
ego_head; NULL != ego_entry;)
1524 ego_tmp = ego_entry;
1525 ego_entry = ego_entry->
next;
1534 "Identity Provider REST plugin is finished\n");
struct GNUNET_MQ_MessageHandlers handlers[]
static struct GNUNET_TESTING_PluginFunctions * plugin
Plugin to dynamically load a test case.
static gnutls_certificate_credentials_t cred
The credential.
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 struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
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.
functions to parse JSON objects into GNUnet objects
void GNUNET_JSON_parse_free(struct GNUNET_JSON_Specification *spec)
Frees all elements allocated during a GNUNET_JSON_parse() operation.
struct GNUNET_JSON_Specification GNUNET_JSON_spec_string(const char *name, const char **strptr)
The expected field stores a string.
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.
enum GNUNET_GenericReturnValue GNUNET_GNS_parse_ztld(const char *name, struct GNUNET_CRYPTO_PublicKey *ztld_key)
Try to parse the zTLD into a public key.
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.
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.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
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.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_RECLAIM_Ticket *ticket, const char *rp_uri, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
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_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 identities (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.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
#define GNUNET_TIME_UNIT_HOURS
One hour.
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.
void * REST_reclaim_init(const struct GNUNET_CONFIGURATION_Handle *c)
Entry point for the plugin.
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.
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_done(struct GNUNET_REST_Plugin *api)
Exit point from 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)
Parse a JWT and return the respective claim value as Attribute.
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 ticket_collect(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const char *rp_uri)
Collect all attributes for an ego.
static void do_error(void *cls)
Task run on error, sends error message.
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.
const char * name
The name of the credential.
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.
char gns_name[63 *2+2]
The ticket.
struct returned by the initialization function of the plugin
void * cls
The closure of the plugin.
const char * name
Plugin name.
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).