jwt.h File Reference

JWT module header file. More...

#include "security_handler.h"
#include "json_util.h"
Include dependency graph for jwt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  jwt_t
 

Functions

MCL_LOCAL mcl_error_t jwt_initialize (security_handler_t *security_handler, E_MCL_SECURITY_PROFILE security_profile, char *tenant, jwt_t **jwt)
 
MCL_LOCAL char * jwt_get_token (jwt_t *jwt)
 
MCL_LOCAL void jwt_destroy (jwt_t **jwt)
 

Detailed Description

JWT module header file.

This module is used to generate JWT.

Definition in file jwt.h.

Function Documentation

MCL_LOCAL void jwt_destroy ( jwt_t **  jwt)

This function destroys jwt_t data structure.

Parameters
[in]jwtJWT handle which is going to be destroyed.

Definition at line 124 of file jwt.c.

References json_util_destroy(), MCL_DEBUG, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, and MCL_NULL.

Referenced by _compose_access_token_request_payload(), and jwt_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL char* jwt_get_token ( jwt_t jwt)

This function is used to generate the JWT as json string.

Parameters
[in]jwtJWT handle.
Returns
Pointer to the JWT of type char or NULL in case of an error.

Definition at line 90 of file jwt.c.

References _generate_token(), jwt_t::header, mcl_core_return_code_strings, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_ERROR, MCL_FREE, mcl_json_util_to_string(), MCL_NULL, MCL_OK, and jwt_t::payload.

Referenced by _compose_access_token_request_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_error_t jwt_initialize ( security_handler_t security_handler,
E_MCL_SECURITY_PROFILE  security_profile,
char *  tenant,
jwt_t **  jwt 
)

This function creates and initializes a data struct of jwt_t.

Parameters
[in]security_handlerAlready initialized security handler. All JWT operations will be done using this object.
[in]security_profileOnboarding security profile.
[in]tenantTenant which will be set in JWT payload.
[out]jwtThe newly initialized jwt handle.
Returns
  • MCL_OK in case of success.
  • MCL_OUT_OF_MEMORY in case there is not enough memory in the system to proceed.
  • MCL_FAIL in case JSON object can not be created.

Definition at line 62 of file jwt.c.

References _create_self_issued_jwt_header(), _create_self_issued_jwt_payload(), jwt_destroy(), MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_STATEMENT_CODE_MESSAGE, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.

Referenced by _compose_access_token_request_payload().

Here is the call graph for this function:

Here is the caller graph for this function: