Mantis App v0.1.13
Loading...
Searching...
No Matches
mantis::JWT Class Reference

#include <jwt.h>

Static Public Member Functions

static json createJWTToken (const json &claims_params, const std::string &secretKey)
 Generate a JWT token having some custom claims.
 
static json verifyJWTToken (const std::string &token, const std::string &secretKey)
 Verify if given token is valid and was created by us.
 

Detailed Description

This class manages creation and verification of JWTs.

Member Function Documentation

◆ createJWTToken()

json mantis::JWT::createJWTToken ( const json claims_params,
const std::string &  secretKey 
)
static

Generate a JWT token having some custom claims.

If JWT token creation fails, the error key of the JSON response will detail the error value.

Parameters
claims_paramsAdditional claims, for now only id and table is supported.
secretKeySecret key for signing the JWT tokens.
Returns
JSON Object having a token and error value. The error or token may be empty.

◆ verifyJWTToken()

json mantis::JWT::verifyJWTToken ( const std::string &  token,
const std::string &  secretKey 
)
static

Verify if given token is valid and was created by us.

If verification failed, the error JSON key of the response will have the error value. If everything went well, all the other JSON fields will be filled with extracted values.

Parameters
tokenJWT Token
secretKeySecret key for signing the JWT tokens.
Returns
JSON Object having a id, table, verified and error values.

The documentation for this class was generated from the following files: