table of contents
| jwt_claims_checker_grp(3) | Library Functions Manual | jwt_claims_checker_grp(3) |
NAME¶
jwt_claims_checker_grp - Checker Functions
SYNOPSIS¶
Functions¶
const char * jwt_checker_claim_get (jwt_checker_t
*checker, jwt_claims_t type)
Get the value of a validation claim. int jwt_checker_claim_set
(jwt_checker_t *checker, jwt_claims_t type, const char *value)
Set the value of a validation claim. int jwt_checker_claim_del
(jwt_checker_t *checker, jwt_claims_t type)
Delete the value of a validation claim. int jwt_checker_time_leeway
(jwt_checker_t *checker, jwt_claims_t claim, time_t secs)
Setup the exp or nbf claim leeway values.
Detailed Description¶
For a checker object, claims will be used to verify the token. This verification is very simplistic and only supports standards-defined claims like nbf, iss, etc. Even for some of these, LibJWT can only perform simple time or string comparison. For example, if you wanted to accept tokens from multiple issuers, you would need to handle that yourself, most likely in a callback.
This is a list of the claims that LibJWT can check on its own, and the method that is used to decide success:
Claim Type Comparison for Validation exp Timestamp exp > (now + leeway) nbf Timestamp nbf <= (now - leeway) iss String !strcmp(iss, userval) aud String !strcmp(aud, userval) sub String !strcmp(sub, userval)
Note
Function Documentation¶
int jwt_checker_claim_del (jwt_checker_t * checker, jwt_claims_t type)¶
Delete the value of a validation claim.
Parameters
type One of JWT_CLAIM_ISS, JWT_CLAIM_AUD, or JWT_CLAIM_SUB
Returns
const char * jwt_checker_claim_get (jwt_checker_t * checker, jwt_claims_t type)¶
Get the value of a validation claim.
Parameters
type One of JWT_CLAIM_ISS, JWT_CLAIM_AUD, or JWT_CLAIM_SUB
Returns
int jwt_checker_claim_set (jwt_checker_t * checker, jwt_claims_t type, const char * value)¶
Set the value of a validation claim.
Parameters
type One of JWT_CLAIM_ISS, JWT_CLAIM_AUD, or JWT_CLAIM_SUB
value A string to set as the new value of the validation
Returns
int jwt_checker_time_leeway (jwt_checker_t * checker, jwt_claims_t claim, time_t secs)¶
Setup the exp or nbf claim leeway values. This allows you to set a leeway for exp and nbf claims to account for any skew. The value is in seconds.
To disable either one, set the secs to -1.
Parameters
claim One of JWT_CLAIM_NBF or JWT_CLAIM_EXP
secs The number of seconds of leeway to account for being valid
Returns
Author¶
Generated automatically by Doxygen for LibJWT from the source code.
| Version 3.2.2 | LibJWT |