JWT-CPP v0.7.0
A header only library for creating and validating JSON Web Tokens (JWT) in C++
|
#include <jwt.h>
Public Types | |
using | basic_claim_t = basic_claim<json_traits> |
Public Types inherited from jwt::header< json_traits > | |
using | basic_claim_t = basic_claim<json_traits> |
Public Types inherited from jwt::payload< json_traits > | |
using | basic_claim_t = basic_claim<json_traits> |
Public Member Functions | |
JWT_CLAIM_EXPLICIT | decoded_jwt (const typename json_traits::string_type &token) |
Parses a given token. | |
template<typename Decode > | |
decoded_jwt (const typename json_traits::string_type &token, Decode decode) | |
Parses a given token. | |
const json_traits::string_type & | get_token () const noexcept |
const json_traits::string_type & | get_header () const noexcept |
const json_traits::string_type & | get_payload () const noexcept |
const json_traits::string_type & | get_signature () const noexcept |
const json_traits::string_type & | get_header_base64 () const noexcept |
const json_traits::string_type & | get_payload_base64 () const noexcept |
const json_traits::string_type & | get_signature_base64 () const noexcept |
json_traits::object_type | get_payload_json () const |
json_traits::object_type | get_header_json () const |
basic_claim_t | get_payload_claim (const typename json_traits::string_type &name) const |
basic_claim_t | get_header_claim (const typename json_traits::string_type &name) const |
Public Member Functions inherited from jwt::header< json_traits > | |
bool | has_algorithm () const noexcept |
bool | has_type () const noexcept |
bool | has_content_type () const noexcept |
bool | has_key_id () const noexcept |
json_traits::string_type | get_algorithm () const |
json_traits::string_type | get_type () const |
json_traits::string_type | get_content_type () const |
json_traits::string_type | get_key_id () const |
bool | has_header_claim (const typename json_traits::string_type &name) const noexcept |
basic_claim_t | get_header_claim (const typename json_traits::string_type &name) const |
Public Member Functions inherited from jwt::payload< json_traits > | |
bool | has_issuer () const noexcept |
bool | has_subject () const noexcept |
bool | has_audience () const noexcept |
bool | has_expires_at () const noexcept |
bool | has_not_before () const noexcept |
bool | has_issued_at () const noexcept |
bool | has_id () const noexcept |
json_traits::string_type | get_issuer () const |
json_traits::string_type | get_subject () const |
basic_claim_t::set_t | get_audience () const |
date | get_expires_at () const |
date | get_not_before () const |
date | get_issued_at () const |
json_traits::string_type | get_id () const |
bool | has_payload_claim (const typename json_traits::string_type &name) const noexcept |
basic_claim_t | get_payload_claim (const typename json_traits::string_type &name) const |
Protected Attributes | |
json_traits::string_type | token |
Unmodified token, as passed to constructor. | |
json_traits::string_type | header |
Header part decoded from base64. | |
json_traits::string_type | header_base64 |
Unmodified header part in base64. | |
json_traits::string_type | payload |
Payload part decoded from base64. | |
json_traits::string_type | payload_base64 |
Unmodified payload part in base64. | |
json_traits::string_type | signature |
Signature part decoded from base64. | |
json_traits::string_type | signature_base64 |
Unmodified signature part in base64. | |
Protected Attributes inherited from jwt::header< json_traits > | |
details::map_of_claims< json_traits > | header_claims |
Protected Attributes inherited from jwt::payload< json_traits > | |
details::map_of_claims< json_traits > | payload_claims |
Class containing all information about a decoded token
|
inline |
Parses a given token.
token | The token to parse |
std::invalid_argument | Token is not in correct format |
std::runtime_error | Base64 decoding failed or invalid json |
|
inline |
Parses a given token.
Decode | is callable, taking a string_type and returns a string_type. It should ensure the padding of the input and then base64url decode and return the results. |
token | The token to parse |
decode | The function to decode the token |
std::invalid_argument | Token is not in correct format |
std::runtime_error | Base64 decoding failed or invalid json |
|
inlinenoexcept |
Get header part as json string
|
inlinenoexcept |
Get header part as base64 string
|
inline |
Get a header claim by name
name | the name of the desired claim |
jwt::error::claim_not_present_exception | if the claim was not present |
|
inline |
Get all header as JSON object
|
inlinenoexcept |
Get payload part as json string
|
inlinenoexcept |
Get payload part as base64 string
|
inline |
Get a payload claim by name
name | the name of the desired claim |
jwt::error::claim_not_present_exception | if the claim was not present |
|
inline |
Get all payload as JSON object
|
inlinenoexcept |
Get signature part as json string
|
inlinenoexcept |
Get signature part as base64 string
|
inlinenoexcept |
Get token string, as passed to constructor