Browse Source

jwt: use JWT_VALIDATION_SUCCESS for validate check

Daniel-Constantin Mierla 10 months ago
parent
commit
76b250c8b4
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/modules/jwt/jwt_mod.c

+ 4 - 2
src/modules/jwt/jwt_mod.c

@@ -437,6 +437,7 @@ static int ki_jwt_verify_key(
 	jwt_valid_t *jwt_valid = NULL;
 	str sparams = STR_NULL;
 	long lval = 0;
+	unsigned int jwtret = 0;
 
 	if(key == NULL || key->s == NULL || alg == NULL || alg->s == NULL
 			|| claims == NULL || claims->s == NULL || claims->len <= 0
@@ -501,9 +502,10 @@ static int ki_jwt_verify_key(
 		LM_ERR("failed to decode jwt value (ret: %d jwt: %p)\n", ret, jwt);
 		goto error;
 	}
-	if(jwt_validate(jwt, jwt_valid) != 0) {
+	if((jwtret = jwt_validate(jwt, jwt_valid)) != JWT_VALIDATION_SUCCESS) {
 		_jwt_verify_status = jwt_valid_get_status(jwt_valid);
-		LM_ERR("failed to validate jwt: %08x\n", _jwt_verify_status);
+		LM_ERR("failed to validate jwt: %08x (ret: %08x)\n", _jwt_verify_status,
+				jwtret);
 		goto error;
 	}