aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_reclaim_credential_jwt.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2021-04-20 19:56:26 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2021-04-20 19:56:26 +0200
commite78aaa7eb9f1f69c6c6f1efd53f4196820471ec9 (patch)
treeebe1c5be265ab001b8923eb7f37f07eefb1d9525 /src/reclaim/plugin_reclaim_credential_jwt.c
parent96ead001860cba3251402f31cf21641e60dd49b1 (diff)
downloadgnunet-e78aaa7eb9f1f69c6c6f1efd53f4196820471ec9.tar.gz
gnunet-e78aaa7eb9f1f69c6c6f1efd53f4196820471ec9.zip
- fix
Diffstat (limited to 'src/reclaim/plugin_reclaim_credential_jwt.c')
-rw-r--r--src/reclaim/plugin_reclaim_credential_jwt.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_jwt.c b/src/reclaim/plugin_reclaim_credential_jwt.c
index 425ac3450..e5dc90363 100644
--- a/src/reclaim/plugin_reclaim_credential_jwt.c
+++ b/src/reclaim/plugin_reclaim_credential_jwt.c
@@ -158,7 +158,6 @@ jwt_parse_attributes (void *cls,
158 struct GNUNET_RECLAIM_AttributeList *attrs; 158 struct GNUNET_RECLAIM_AttributeList *attrs;
159 char delim[] = "."; 159 char delim[] = ".";
160 char *val_str = NULL; 160 char *val_str = NULL;
161 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
162 char *decoded_jwt; 161 char *decoded_jwt;
163 char *tmp; 162 char *tmp;
164 json_t *json_val; 163 json_t *json_val;
@@ -252,6 +251,8 @@ struct GNUNET_RECLAIM_AttributeList *
252jwt_parse_attributes_c (void *cls, 251jwt_parse_attributes_c (void *cls,
253 const struct GNUNET_RECLAIM_Credential *cred) 252 const struct GNUNET_RECLAIM_Credential *cred)
254{ 253{
254 if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT)
255 return NULL;
255 return jwt_parse_attributes (cls, cred->data, cred->data_size); 256 return jwt_parse_attributes (cls, cred->data, cred->data_size);
256} 257}
257 258
@@ -267,6 +268,8 @@ struct GNUNET_RECLAIM_AttributeList *
267jwt_parse_attributes_p (void *cls, 268jwt_parse_attributes_p (void *cls,
268 const struct GNUNET_RECLAIM_Presentation *cred) 269 const struct GNUNET_RECLAIM_Presentation *cred)
269{ 270{
271 if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT)
272 return NULL;
270 return jwt_parse_attributes (cls, cred->data, cred->data_size); 273 return jwt_parse_attributes (cls, cred->data, cred->data_size);
271} 274}
272 275
@@ -355,7 +358,7 @@ jwt_get_issuer_p (void *cls,
355 * @param cred the jwt credential 358 * @param cred the jwt credential
356 * @return a string, containing the isser 359 * @return a string, containing the isser
357 */ 360 */
358int 361enum GNUNET_GenericReturnValue
359jwt_get_expiration (void *cls, 362jwt_get_expiration (void *cls,
360 const char *data, 363 const char *data,
361 size_t data_size, 364 size_t data_size,
@@ -396,13 +399,15 @@ jwt_get_expiration (void *cls,
396 * 399 *
397 * @param cls the plugin 400 * @param cls the plugin
398 * @param cred the jwt credential 401 * @param cred the jwt credential
399 * @return a string, containing the isser 402 * @return the expirati
400 */ 403 */
401int 404enum GNUNET_GenericReturnValue
402jwt_get_expiration_c (void *cls, 405jwt_get_expiration_c (void *cls,
403 const struct GNUNET_RECLAIM_Credential *cred, 406 const struct GNUNET_RECLAIM_Credential *cred,
404 struct GNUNET_TIME_Absolute *exp) 407 struct GNUNET_TIME_Absolute *exp)
405{ 408{
409 if (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT != cred->type)
410 return GNUNET_NO;
406 return jwt_get_expiration (cls, cred->data, cred->data_size, exp); 411 return jwt_get_expiration (cls, cred->data, cred->data_size, exp);
407} 412}
408 413
@@ -414,22 +419,23 @@ jwt_get_expiration_c (void *cls,
414 * @param cred the jwt credential 419 * @param cred the jwt credential
415 * @return a string, containing the isser 420 * @return a string, containing the isser
416 */ 421 */
417int 422enum GNUNET_GenericReturnValue
418jwt_get_expiration_p (void *cls, 423jwt_get_expiration_p (void *cls,
419 const struct GNUNET_RECLAIM_Presentation *cred, 424 const struct GNUNET_RECLAIM_Presentation *cred,
420 struct GNUNET_TIME_Absolute *exp) 425 struct GNUNET_TIME_Absolute *exp)
421{ 426{
427 if (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT != cred->type)
428 return GNUNET_NO;
422 return jwt_get_expiration (cls, cred->data, cred->data_size, exp); 429 return jwt_get_expiration (cls, cred->data, cred->data_size, exp);
423} 430}
424 431
425 432
426int 433enum GNUNET_GenericReturnValue
427jwt_create_presentation (void *cls, 434jwt_create_presentation (void *cls,
428 const struct GNUNET_RECLAIM_Credential *cred, 435 const struct GNUNET_RECLAIM_Credential *cred,
429 const struct GNUNET_RECLAIM_AttributeList *attrs, 436 const struct GNUNET_RECLAIM_AttributeList *attrs,
430 struct GNUNET_RECLAIM_Presentation **pres) 437 struct GNUNET_RECLAIM_Presentation **pres)
431{ 438{
432 // FIXME sanity checks??
433 if (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT != cred->type) 439 if (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT != cred->type)
434 return GNUNET_NO; 440 return GNUNET_NO;
435 *pres = GNUNET_RECLAIM_presentation_new (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, 441 *pres = GNUNET_RECLAIM_presentation_new (GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT,