[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 22/25: JWT Parser Implemented
From: |
gnunet |
Subject: |
[gnunet] 22/25: JWT Parser Implemented |
Date: |
Mon, 13 Jan 2020 13:47:07 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 1267dec774294ec2dcc6d2b89bced85eb4fadaa7
Author: Markus Voggenreiter <address@hidden>
AuthorDate: Wed Nov 27 16:30:03 2019 +0100
JWT Parser Implemented
---
src/reclaim/plugin_rest_reclaim.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/reclaim/plugin_rest_reclaim.c
b/src/reclaim/plugin_rest_reclaim.c
index 70defae3d..71c59ae90 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -1190,18 +1190,25 @@ parse_jwt (const struct
GNUNET_RECLAIM_ATTESTATION_Claim *attest,
uint32_t type;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
char *decoded_jwt;
+ json_t *json_val;
+ json_error_t *json_err = NULL;
jwt_string = GNUNET_RECLAIM_ATTESTATION_value_to_string (attest->type,
attest->data,
attest->data_size);
char *jwt_body = strtok (jwt_string, delim);
jwt_body = strtok (NULL, delim);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "JWT Body: %s\n",
- jwt_body);
-
- val_str = "String from JWT, which is stored under claim";
+ GNUNET_STRINGS_base64_decode(jwt_body, strlen(jwt_body), (void **)
&decoded_jwt);
+ json_val=json_loads(decoded_jwt, JSON_DECODE_ANY, json_err);
+ const char *key;
+ json_t *value;
+ json_object_foreach(json_val, key, value) {
+ if (0 == strcasecmp (key,claim))
+ {
+ val_str=json_dumps(value, JSON_ENCODE_ANY);
+ }
+ }
type_str = "String";
-
type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
if (GNUNET_SYSERR ==(GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,val_str,
(void **)
&data,
@@ -1252,7 +1259,8 @@ attr_collect (void *cls,
return;
}
struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr2;
- attr2 = parse_jwt (attest, reference->name);
+ attr2 = parse_jwt (attest, reference->reference_value);
+ attr2->name = reference->name;
if (NULL == attr2)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnunet] 09/25: Listing Attestations through service, (continued)
- [gnunet] 09/25: Listing Attestations through service, gnunet, 2020/01/13
- [gnunet] 11/25: Preparation for Reference Type, gnunet, 2020/01/13
- [gnunet] 12/25: Adding Reference Type Implemented, gnunet, 2020/01/13
- [gnunet] 13/25: Deletion of Reference Type, gnunet, 2020/01/13
- [gnunet] 14/25: Fixed Reference Deletion, gnunet, 2020/01/13
- [gnunet] 16/25: Listing of References with Attributes, gnunet, 2020/01/13
- [gnunet] 17/25: Pure Listing of References, gnunet, 2020/01/13
- [gnunet] 15/25: Prepared Listing of References, gnunet, 2020/01/13
- [gnunet] 18/25: Prepared JWT Plugin, gnunet, 2020/01/13
- [gnunet] 20/25: JWT Plugin, Prepared Ticketing, gnunet, 2020/01/13
- [gnunet] 22/25: JWT Parser Implemented,
gnunet <=
- [gnunet] 19/25: Fixed Open Issues with Listing, gnunet, 2020/01/13
- [gnunet] 23/25: Fixed Adding Attestations, gnunet, 2020/01/13
- [gnunet] 24/25: Fixed Ticket Management, gnunet, 2020/01/13
- [gnunet] 21/25: Basic Functionality Implemented, gnunet, 2020/01/13
- [gnunet] 25/25: JWT Parsing API, gnunet, 2020/01/13