LibJWT Dev
The C JSON Web Token Library +JWK +JWKS
Configuration Type
Collaboration diagram for Configuration Type:

Data Structures

struct  jwt_config_t
 Structure used to manage configuration state. More...
 

Macros

#define JWT_CONFIG_DECLARE(__name)
 Decleration of a jwt_config_t.
 

Typedefs

typedef int(* jwt_callback_t) (const jwt_t *, jwt_config_t *)
 Callback for operations involving verification of tokens.
 

Functions

void jwt_config_init (jwt_config_t *config)
 Intialize jwt_config_t to a clean state.
 

Detailed Description

The JWT configuration tools are setup to allow an agnostic way to handle state between different functions. The specific uses of the tools varies according to whether you are providing or consuming tokens. These aspects are documented in the other sections.

This section is a light intro of config types and common usage.

Remarks
LibJWT does not internally modify or set information in the jwt_config_t object. Certain values will determine how LibJWT handles various functions.

Macro Definition Documentation

◆ JWT_CONFIG_DECLARE

#define JWT_CONFIG_DECLARE ( __name)

Decleration of a jwt_config_t.

This is useful for scoped usage to avoid declaring it and running the jwt_config_init function.

void some_function(const char *token)
{
JWT_CONFIG_DECLARE(my_config);
jwt_auto_t *my_jwt;
int ret;
// Setup my_config with key, alg type, etc
ret = jwt_verify(&my_jwt, token, &my_config);
if (ret)
return ret;
// Success
}
#define JWT_CONFIG_DECLARE(__name)
Decleration of a jwt_config_t.
Definition jwt.h:401
int jwt_verify(jwt_t **jwt, const char *token, jwt_config_t *config)
Decode and verify a JWT.

Definition at line 401 of file jwt.h.

Typedef Documentation

◆ jwt_callback_t

typedef int(* jwt_callback_t) (const jwt_t *, jwt_config_t *)

Callback for operations involving verification of tokens.

Further details can be found in Token Verification, specifically for jwt_verify_wcb

Definition at line 410 of file jwt.h.

Function Documentation

◆ jwt_config_init()

void jwt_config_init ( jwt_config_t * config)

Intialize jwt_config_t to a clean state.

To ensure a jwt_config_t is at a known state, this will clear values in the config. It will not free memory that might be associated with internal pointers.

Parameters
configPointer to config to be cleared