l8w8jwt
|
#include <decode.h>
Public Attributes | |
char * | jwt |
size_t | jwt_length |
int | alg |
char * | validate_iss |
size_t | validate_iss_length |
char * | validate_sub |
size_t | validate_sub_length |
char * | validate_aud |
size_t | validate_aud_length |
char * | validate_jti |
size_t | validate_jti_length |
int | validate_exp |
int | validate_nbf |
int | validate_iat |
uint8_t | exp_tolerance_seconds |
uint8_t | nbf_tolerance_seconds |
uint8_t | iat_tolerance_seconds |
unsigned char * | verification_key |
size_t | verification_key_length |
char * | validate_typ |
size_t | validate_typ_length |
Struct containing the parameters to use for decoding and validating a JWT.
int l8w8jwt_decoding_params::alg |
The signature algorithm ID.
[0;2] = HS256/384/512 | [3;5] = RS256/384/512 | [6;8] = PS256/384/512 | [9;11] = ES256/384/512
This affects what should be the value of verification_key
uint8_t l8w8jwt_decoding_params::exp_tolerance_seconds |
Small inconsistencies in time can happen, or also latency between clients and servers. That's just life. You can forgive a few seconds of expiration, but don't exaggerate this!
Only taken into consideration if validate_exp
is set to 1
.
uint8_t l8w8jwt_decoding_params::iat_tolerance_seconds |
The amount of seconds to subtract from the current time when comparing the "issued at" claim, to allow for a small tolerance time frame. Only taken into consideration if validate_iat
is set to 1
.
char* l8w8jwt_decoding_params::jwt |
The token to decode and validate.
size_t l8w8jwt_decoding_params::jwt_length |
The jwt string length.
uint8_t l8w8jwt_decoding_params::nbf_tolerance_seconds |
The amount of seconds to subtract from the current time when comparing the "not before" claim, to allow for a small tolerance time frame. Only taken into consideration if validate_nbf
is set to 1
.
char* l8w8jwt_decoding_params::validate_aud |
[OPTIONAL] The audience claim (who is the JWT intended for? Who is the intended JWT's recipient?).
Set to NULL
if you don't want to validate the audience.
The JWT will only pass verification if its aud
matches this string.
size_t l8w8jwt_decoding_params::validate_aud_length |
validate_aud string length.
int l8w8jwt_decoding_params::validate_exp |
Should the expiration claim be verified? If this is set to 1
, the exp
claim will be compared to the current date and time + exp_tolerance_seconds
int l8w8jwt_decoding_params::validate_iat |
Should the "issued at" claim be verified? If this is set to 1
, the iat
claim will be compared to the current date and time + iat_tolerance_seconds
char* l8w8jwt_decoding_params::validate_iss |
[OPTIONAL] The issuer claim (who issued the JWT?).
Set to NULL
if you don't want to validate the issuer.
The JWT will only pass verification if its iss
claim matches this string.
size_t l8w8jwt_decoding_params::validate_iss_length |
validate_iss string length.
char* l8w8jwt_decoding_params::validate_jti |
[OPTIONAL] The JWT ID. Provides a unique identifier for the token.
Set to NULL
if you don't want to validate the jti claim.
The JWT will only pass verification if its jti
matches this string.
size_t l8w8jwt_decoding_params::validate_jti_length |
validate_jti claim length.
int l8w8jwt_decoding_params::validate_nbf |
Should the "not before" claim be verified? If this is set to 1
, the nbf
claim will be compared to the current date and time + nbf_tolerance_seconds
char* l8w8jwt_decoding_params::validate_sub |
[OPTIONAL] The subject claim (who is the JWT about?).
Set to NULL
if you don't want to validate the subject claim.
The JWT will only pass verification if its sub
matches this string.
size_t l8w8jwt_decoding_params::validate_sub_length |
validate_sub string length.
char* l8w8jwt_decoding_params::validate_typ |
[OPTIONAL] The typ claim (what type is the token?).
Set to NULL
if you don't want to validate the "typ" claim.
size_t l8w8jwt_decoding_params::validate_typ_length |
validate_typ string length.
unsigned char* l8w8jwt_decoding_params::verification_key |
The key to use for verifying the token's signature (e.g. if you chose HS256 as algorithm, this will be the HMAC secret; for RS512 this will be the PEM-formatted public RSA key string, etc...).
size_t l8w8jwt_decoding_params::verification_key_length |
Length of the verification_key