aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2017-10-09 11:07:28 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2017-10-09 11:07:28 +0200
commit037bf3d5a227287e4b2e9c4dbb2583f39bd8fa20 (patch)
treeb1fca5110e360a33d41295c5c613ef691c79b3de /src
parent0e7c1fb8feff37774d66ca46b3eb09492ecf93af (diff)
downloadgnunet-037bf3d5a227287e4b2e9c4dbb2583f39bd8fa20.tar.gz
gnunet-037bf3d5a227287e4b2e9c4dbb2583f39bd8fa20.zip
-fixes
Diffstat (limited to 'src')
-rw-r--r--src/identity-provider/plugin_rest_identity_provider.c30
-rwxr-xr-xsrc/identity-provider/test_idp_attribute.sh3
2 files changed, 16 insertions, 17 deletions
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c
index 0ba0666d0..f136901a0 100644
--- a/src/identity-provider/plugin_rest_identity_provider.c
+++ b/src/identity-provider/plugin_rest_identity_provider.c
@@ -239,11 +239,6 @@ struct RequestHandle
239 */ 239 */
240 struct GNUNET_JSONAPI_Document *resp_object; 240 struct GNUNET_JSONAPI_Document *resp_object;
241 241
242 /**
243 * Resource object
244 */
245 struct GNUNET_JSONAPI_Resource *json_resource;
246
247}; 242};
248 243
249 244
@@ -397,6 +392,7 @@ static void
397ticket_collect (void *cls, 392ticket_collect (void *cls,
398 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) 393 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket)
399{ 394{
395 struct GNUNET_JSONAPI_Resource *json_resource;
400 struct RequestHandle *handle = cls; 396 struct RequestHandle *handle = cls;
401 json_t *value; 397 json_t *value;
402 char* tmp; 398 char* tmp;
@@ -404,15 +400,15 @@ ticket_collect (void *cls,
404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n"); 400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
405 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 401 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
406 sizeof (uint64_t)); 402 sizeof (uint64_t));
407 handle->json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_TICKET, 403 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_TICKET,
408 tmp); 404 tmp);
409 GNUNET_free (tmp); 405 GNUNET_free (tmp);
410 GNUNET_JSONAPI_document_resource_add (handle->resp_object, handle->json_resource); 406 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
411 407
412 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->identity, 408 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->identity,
413 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 409 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
414 value = json_string (tmp); 410 value = json_string (tmp);
415 GNUNET_JSONAPI_resource_add_attr (handle->json_resource, 411 GNUNET_JSONAPI_resource_add_attr (json_resource,
416 "issuer", 412 "issuer",
417 value); 413 value);
418 GNUNET_free (tmp); 414 GNUNET_free (tmp);
@@ -420,7 +416,7 @@ ticket_collect (void *cls,
420 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->audience, 416 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
421 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 417 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
422 value = json_string (tmp); 418 value = json_string (tmp);
423 GNUNET_JSONAPI_resource_add_attr (handle->json_resource, 419 GNUNET_JSONAPI_resource_add_attr (json_resource,
424 "audience", 420 "audience",
425 value); 421 value);
426 GNUNET_free (tmp); 422 GNUNET_free (tmp);
@@ -428,7 +424,7 @@ ticket_collect (void *cls,
428 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 424 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
429 sizeof (uint64_t)); 425 sizeof (uint64_t));
430 value = json_string (tmp); 426 value = json_string (tmp);
431 GNUNET_JSONAPI_resource_add_attr (handle->json_resource, 427 GNUNET_JSONAPI_resource_add_attr (json_resource,
432 "rnd", 428 "rnd",
433 value); 429 value);
434 GNUNET_free (tmp); 430 GNUNET_free (tmp);
@@ -535,7 +531,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
535 ego_entry = ego_entry->next) 531 ego_entry = ego_entry->next)
536 if (0 == strcmp (identity, ego_entry->identifier)) 532 if (0 == strcmp (identity, ego_entry->identifier))
537 break; 533 break;
538 534
539 if (NULL == ego_entry) 535 if (NULL == ego_entry)
540 { 536 {
541 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 537 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -620,14 +616,19 @@ attr_collect (void *cls,
620 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 616 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
621 const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr) 617 const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr)
622{ 618{
619 struct GNUNET_JSONAPI_Resource *json_resource;
623 struct RequestHandle *handle = cls; 620 struct RequestHandle *handle = cls;
624 json_t *value; 621 json_t *value;
625 622
626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", 623 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n",
627 attr->name); 624 attr->name);
625 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE,
626 attr->name);
627 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
628
628 value = json_string (attr->data); 629 value = json_string (attr->data);
629 GNUNET_JSONAPI_resource_add_attr (handle->json_resource, 630 GNUNET_JSONAPI_resource_add_attr (json_resource,
630 attr->name, 631 "value",
631 value); 632 value);
632 json_decref (value); 633 json_decref (value);
633 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it); 634 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it);
@@ -670,9 +671,6 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
670 break; 671 break;
671 handle->resp_object = GNUNET_JSONAPI_document_new (); 672 handle->resp_object = GNUNET_JSONAPI_document_new ();
672 673
673 handle->json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE,
674 identity);
675 GNUNET_JSONAPI_document_resource_add (handle->resp_object, handle->json_resource);
676 674
677 if (NULL == ego_entry) 675 if (NULL == ego_entry)
678 { 676 {
diff --git a/src/identity-provider/test_idp_attribute.sh b/src/identity-provider/test_idp_attribute.sh
index 6c357128f..0b0436ede 100755
--- a/src/identity-provider/test_idp_attribute.sh
+++ b/src/identity-provider/test_idp_attribute.sh
@@ -24,10 +24,11 @@ which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24 24
25TEST_ATTR="test" 25TEST_ATTR="test"
26gnunet-arm -s -c test_idp.conf 26gnunet-arm -s -c test_idp.conf
27gnunet-arm -i rest -c test_idp.conf
27gnunet-identity -C testego -c test_idp.conf 28gnunet-identity -C testego -c test_idp.conf
28gnunet-identity -C rpego -c test_idp.conf 29gnunet-identity -C rpego -c test_idp.conf
29TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}') 30TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}')
30gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf 31gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf
31gnunet-idp -e testego -a name -V John -c test_idp.conf 32gnunet-idp -e testego -a name -V John -c test_idp.conf
32gnunet-namestore -D -z testego -D -c test_idp.conf 33curl localhost:7776/idp/attributes/testego
33gnunet-arm -e -c test_idp.conf 34gnunet-arm -e -c test_idp.conf