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
 JWT Module handler. More...
 

Functions

E_MCL_ERROR_CODE jwt_initialize (security_handler_t *security_handler, E_MCL_SECURITY_PROFILE security_profile, string_t *tenant, jwt_t **jwt)
 JWT Initializer. More...
 
string_tjwt_get_token (jwt_t *jwt)
 Used to generate the JWT Token as json string. More...
 
void jwt_destroy (jwt_t **jwt)
 To destroy the JWT Handler. More...
 

Detailed Description

JWT module header file.


Date
Jun 28, 2016 This module performs JWT operations : generates onboarding and authentication JWT's.

Definition in file jwt.h.

Function Documentation

void jwt_destroy ( jwt_t **  jwt)

To destroy the JWT Handler.

Will release the resources of JWT Handler. After destroy operation, handler shouldn't be used.

Parameters
[in]jwtJWT Handler to destroy

Definition at line 128 of file jwt.c.

References DEBUG_ENTRY, DEBUG_LEAVE, json_util_destroy(), MCL_DEBUG, 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:

string_t* jwt_get_token ( jwt_t jwt)

Used to generate the JWT Token as json string.

Parameters
[in]jwtJWT Handler.
Returns
Pointer to the JWT token of type string_t or NULL in case of an error.

Definition at line 97 of file jwt.c.

References _generate_token(), DEBUG_ENTRY, DEBUG_LEAVE, jwt_t::header, json_util_to_string(), MCL_NULL, MCL_OK, jwt_t::payload, string_destroy(), and string_initialize_dynamic().

Referenced by _compose_access_token_request_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE jwt_initialize ( security_handler_t security_handler,
E_MCL_SECURITY_PROFILE  security_profile,
string_t tenant,
jwt_t **  jwt 
)

JWT Initializer.

Parameters
[in]security_handlerAlready initialized security handler. All JWT operations will be done using this object.
[in]security_profileOnboarding security profile. Important to get correct kind of authentication JWT.
[in]tenantTenant which will be set in JWT payload.
[out]jwtThe newly initialized jwt handler.
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 70 of file jwt.c.

References _create_self_issued_jwt_header(), _create_self_issued_jwt_payload(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, jwt_destroy(), 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: