/**
- * Collects all attributes for an ego if in scope parameter
+ * Collects all attributes/references for an ego if in scope parameter
*/
static void
oidc_attr_collect (void *cls,
char *scope_variable;
char delimiter[] = " ";
- if ((NULL == attr->name) || (NULL == attr->data))
+ if ((NULL == attr) && (NULL == reference))
{
GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
-
- scope_variables = GNUNET_strdup (handle->oidc->scope);
- scope_variable = strtok (scope_variables, delimiter);
- while (NULL != scope_variable)
+ if (NULL == attr)
{
- if (0 == strcmp (attr->name, scope_variable))
- break;
- scope_variable = strtok (NULL, delimiter);
+ if ((NULL == reference->name) || (NULL == reference->reference_value))
+ {
+ return;
+ }
+ scope_variables = GNUNET_strdup (handle->oidc->scope);
+ scope_variable = strtok (scope_variables, delimiter);
+ while (NULL != scope_variable)
+ {
+ if (0 == strcmp (reference->name, scope_variable))
+ break;
+ scope_variable = strtok (NULL, delimiter);
+ }
+ if (NULL == scope_variable)
+ {
+ GNUNET_free (scope_variables);
+ return;
+ }
+ GNUNET_free (scope_variables);
+ // Store references as attributes as they only use the ID later
+ const char *type_str = NULL;
+ char *data;
+ size_t data_size;
+ uint32_t type;
+ le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
+ type_str = "String";
+ type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
+ if (GNUNET_SYSERR ==(GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,
+ reference->
+ reference_value,
+ (void **) &
+ data,
+ &data_size)))
+ {
+ return;
+ }
+ le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (reference->name,
+ type,
+ data,
+ data_size);
+ le->claim->id = reference->id;
+ le->claim->flag = 1;
+
+ GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
+ handle->attr_list->list_tail,
+ le);
}
- if (NULL == scope_variable)
+ else
{
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ if ((NULL == attr->name) || (NULL == attr->data))
+ {
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ return;
+ }
+ scope_variables = GNUNET_strdup (handle->oidc->scope);
+ scope_variable = strtok (scope_variables, delimiter);
+ while (NULL != scope_variable)
+ {
+ if (0 == strcmp (attr->name, scope_variable))
+ break;
+ scope_variable = strtok (NULL, delimiter);
+ }
+ if (NULL == scope_variable)
+ {
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ GNUNET_free (scope_variables);
+ return;
+ }
GNUNET_free (scope_variables);
- return;
+
+ le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
+ le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
+ attr->type,
+ attr->data,
+ attr->data_size);
+ le->claim->id = attr->id;
+ le->claim->flag = attr->flag;
+
+ GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
+ handle->attr_list->list_tail,
+ le);
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
}
- GNUNET_free (scope_variables);
-
- le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
- le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
- attr->type,
- attr->data,
- attr->data_size);
- le->claim->id = attr->id;
- le->claim->flag = attr->flag;
- GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
- handle->attr_list->list_tail,
- le);
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
}
handle->ego_entry = handle->ego_tail;
}
}
+ handle->oidc->scope = get_url_parameter_copy (handle, OIDC_SCOPE_KEY);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scope: %s\n",GNUNET_strdup (
+ handle->oidc->scope));
if (NULL == handle->tld)
GNUNET_CONFIGURATION_iterate_section_values (cfg, "gns", tld_iter, handle);
if (NULL == handle->tld)
#include "gnunet_rest_plugin.h"
#include "gnunet_signatures.h"
#include "json_reclaim.h"
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-
/**
* REST root namespace
*/
jwt_body = strtok (NULL, delim);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "JWT Body: %s\n",
jwt_body);
- /*const char* jwt_base64 = jwt_body;
- //No padding assumed
- int jwt_len = (strlen(jwt_base64)*3)/4;
- BIO *bio, *b64;
- decoded_jwt = (char *) malloc(jwt_len + 1);
-
- decoded_jwt[jwt_len] = '\0';
-
- bio = BIO_new_mem_buf(jwt_base64, -1);
- b64 = BIO_new(BIO_f_base64());
- bio = BIO_push(b64, bio);
- BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
- /**length = BIO_read(bio, *buffer, strlen(jwt_base64));
- assert(*length == jwt_len); //length should equal jwt_len, else something went horribly wrong
-
- BIO_free_all(bio);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsed JWT Body: %s\n",
- decoded_jwt);
-*/
-
val_str = "String from JWT, which is stored under claim";
type_str = "String";