aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_reclaim_credential_jwt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/plugin_reclaim_credential_jwt.c')
-rw-r--r--src/reclaim/plugin_reclaim_credential_jwt.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_jwt.c b/src/reclaim/plugin_reclaim_credential_jwt.c
index fb01903aa..5d5e221f9 100644
--- a/src/reclaim/plugin_reclaim_credential_jwt.c
+++ b/src/reclaim/plugin_reclaim_credential_jwt.c
@@ -194,7 +194,8 @@ jwt_parse_attributes (void *cls,
194 continue; 194 continue;
195 if (0 == strcmp ("address", key)) 195 if (0 == strcmp ("address", key))
196 { 196 {
197 if (!json_is_object(value)) { 197 if (! json_is_object (value))
198 {
198 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 199 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
199 "address claim in wrong format!"); 200 "address claim in wrong format!");
200 continue; 201 continue;
@@ -202,12 +203,12 @@ jwt_parse_attributes (void *cls,
202 json_object_foreach (value, addr_key, addr_value) { 203 json_object_foreach (value, addr_key, addr_value) {
203 val_str = json_dumps (addr_value, JSON_ENCODE_ANY); 204 val_str = json_dumps (addr_value, JSON_ENCODE_ANY);
204 tmp = val_str; 205 tmp = val_str;
205 //Remove leading " from jasson conversion 206 // Remove leading " from jasson conversion
206 if (tmp[0] == '"') 207 if (tmp[0] == '"')
207 tmp++; 208 tmp++;
208 //Remove trailing " from jansson conversion 209 // Remove trailing " from jansson conversion
209 if (tmp[strlen(tmp)-1] == '"') 210 if (tmp[strlen (tmp) - 1] == '"')
210 tmp[strlen(tmp)-1] = '\0'; 211 tmp[strlen (tmp) - 1] = '\0';
211 GNUNET_RECLAIM_attribute_list_add (attrs, 212 GNUNET_RECLAIM_attribute_list_add (attrs,
212 addr_key, 213 addr_key,
213 NULL, 214 NULL,
@@ -220,12 +221,12 @@ jwt_parse_attributes (void *cls,
220 } 221 }
221 val_str = json_dumps (value, JSON_ENCODE_ANY); 222 val_str = json_dumps (value, JSON_ENCODE_ANY);
222 tmp = val_str; 223 tmp = val_str;
223 //Remove leading " from jasson conversion 224 // Remove leading " from jasson conversion
224 if (tmp[0] == '"') 225 if (tmp[0] == '"')
225 tmp++; 226 tmp++;
226 //Remove trailing " from jansson conversion 227 // Remove trailing " from jansson conversion
227 if (tmp[strlen(tmp)-1] == '"') 228 if (tmp[strlen (tmp) - 1] == '"')
228 tmp[strlen(tmp)-1] = '\0'; 229 tmp[strlen (tmp) - 1] = '\0';
229 GNUNET_RECLAIM_attribute_list_add (attrs, 230 GNUNET_RECLAIM_attribute_list_add (attrs,
230 key, 231 key,
231 NULL, 232 NULL,
@@ -307,7 +308,8 @@ jwt_get_issuer (void *cls,
307 if (NULL == json_val) 308 if (NULL == json_val)
308 return NULL; 309 return NULL;
309 issuer_json = json_object_get (json_val, "iss"); 310 issuer_json = json_object_get (json_val, "iss");
310 if ((NULL == issuer_json) || (! json_is_string (issuer_json))) { 311 if ((NULL == issuer_json) || (! json_is_string (issuer_json)))
312 {
311 json_decref (json_val); 313 json_decref (json_val);
312 return NULL; 314 return NULL;
313 } 315 }
@@ -384,7 +386,8 @@ jwt_get_expiration (void *cls,
384 if (NULL == json_val) 386 if (NULL == json_val)
385 return GNUNET_SYSERR; 387 return GNUNET_SYSERR;
386 exp_json = json_object_get (json_val, "exp"); 388 exp_json = json_object_get (json_val, "exp");
387 if ((NULL == exp_json) || (! json_is_integer (exp_json))) { 389 if ((NULL == exp_json) || (! json_is_integer (exp_json)))
390 {
388 json_decref (json_val); 391 json_decref (json_val);
389 return GNUNET_SYSERR; 392 return GNUNET_SYSERR;
390 } 393 }
@@ -434,13 +437,14 @@ enum GNUNET_GenericReturnValue
434jwt_create_presentation (void *cls, 437jwt_create_presentation (void *cls,
435 const struct GNUNET_RECLAIM_Credential *cred, 438 const struct GNUNET_RECLAIM_Credential *cred,
436 const struct GNUNET_RECLAIM_AttributeList *attrs, 439 const struct GNUNET_RECLAIM_AttributeList *attrs,
437 struct GNUNET_RECLAIM_Presentation **pres) 440 struct GNUNET_RECLAIM_Presentation **presentation)
438{ 441{
439 if (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT != cred->type) 442 if (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT != cred->type)
440 return GNUNET_NO; 443 return GNUNET_NO;
441 *pres = GNUNET_RECLAIM_presentation_new (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, 444 *presentation = GNUNET_RECLAIM_presentation_new (
442 cred->data, 445 GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT,
443 cred->data_size); 446 cred->data,
447 cred->data_size);
444 return GNUNET_OK; 448 return GNUNET_OK;
445} 449}
446 450