Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Enforce r_jwt_validate_claims with time claims
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Mar 1, 2024
1 parent 68cb754 commit 7089c78
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,7 @@ int r_jwt_validate_claims(jwt_t * jwt, ...) {
i_value = va_arg(vl, int);
if (i_value == R_JWT_CLAIM_PRESENT && !json_is_integer(json_object_get(jwt->j_claims, "exp"))) {
ret = RHN_ERROR_PARAM;
} else if (json_is_integer(json_object_get(jwt->j_claims, "exp")) && json_integer_value(json_object_get(jwt->j_claims, "exp")) > 0) {
} else if (json_is_integer(json_object_get(jwt->j_claims, "exp")) && (time_t)json_integer_value(json_object_get(jwt->j_claims, "exp")) > 0) {
t_value = (time_t)r_jwt_get_claim_int_value(jwt, "exp");
if (i_value == R_JWT_CLAIM_NOW) {
if (t_value < now) {
Expand All @@ -1815,7 +1815,7 @@ int r_jwt_validate_claims(jwt_t * jwt, ...) {
i_value = va_arg(vl, int);
if (i_value == R_JWT_CLAIM_PRESENT && !json_is_integer(json_object_get(jwt->j_claims, "nbf"))) {
ret = RHN_ERROR_PARAM;
} else if (json_is_integer(json_object_get(jwt->j_claims, "nbf")) && json_integer_value(json_object_get(jwt->j_claims, "nbf")) > 0) {
} else if (json_is_integer(json_object_get(jwt->j_claims, "nbf")) && (time_t)json_integer_value(json_object_get(jwt->j_claims, "nbf")) > 0) {
t_value = (time_t)r_jwt_get_claim_int_value(jwt, "nbf");
if (i_value == R_JWT_CLAIM_NOW) {
if (t_value > now) {
Expand All @@ -1834,7 +1834,7 @@ int r_jwt_validate_claims(jwt_t * jwt, ...) {
i_value = va_arg(vl, int);
if (i_value == R_JWT_CLAIM_PRESENT && !json_is_integer(json_object_get(jwt->j_claims, "iat"))) {
ret = RHN_ERROR_PARAM;
} else if (json_is_integer(json_object_get(jwt->j_claims, "iat")) && json_integer_value(json_object_get(jwt->j_claims, "iat")) > 0) {
} else if (json_is_integer(json_object_get(jwt->j_claims, "iat")) && (time_t)json_integer_value(json_object_get(jwt->j_claims, "iat")) > 0) {
t_value = (time_t)r_jwt_get_claim_int_value(jwt, "iat");
if (i_value == R_JWT_CLAIM_NOW) {
if (t_value > now) {
Expand Down

0 comments on commit 7089c78

Please sign in to comment.