Goby3  3.1.5a
2024.05.23
jwt::header< json_traits > Class Template Reference

#include <goby/util/thirdparty/jwt-cpp/jwt.h>

Inheritance diagram for jwt::header< json_traits >:
jwt::decoded_jwt< json_traits >

Public Types

using basic_claim_t = basic_claim< json_traits >
 

Public Member Functions

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
 

Protected Attributes

details::map_of_claims< json_traits > header_claims
 

Detailed Description

template<typename json_traits>
class jwt::header< json_traits >

Base class that represents a token header. Contains Convenience accessors for common claims.

Definition at line 2840 of file jwt.h.

Member Typedef Documentation

◆ basic_claim_t

template<typename json_traits >
using jwt::header< json_traits >::basic_claim_t = basic_claim<json_traits>

Definition at line 2846 of file jwt.h.

Member Function Documentation

◆ get_algorithm()

template<typename json_traits >
json_traits::string_type jwt::header< json_traits >::get_algorithm ( ) const
inline

Get algorithm claim

Returns
algorithm as string
Exceptions
std::runtime_errorIf claim was not present
std::bad_castClaim was present but not a string (Should not happen in a valid token)

Definition at line 2873 of file jwt.h.

◆ get_content_type()

template<typename json_traits >
json_traits::string_type jwt::header< json_traits >::get_content_type ( ) const
inline

Get content type claim

Returns
content type as string
Exceptions
std::runtime_errorIf claim was not present
std::bad_castClaim was present but not a string (Should not happen in a valid token)

Definition at line 2893 of file jwt.h.

◆ get_header_claim()

template<typename json_traits >
basic_claim_t jwt::header< json_traits >::get_header_claim ( const typename json_traits::string_type &  name) const
inline

Get header claim

Returns
Requested claim
Exceptions
std::runtime_errorIf claim was not present

Definition at line 2920 of file jwt.h.

◆ get_key_id()

template<typename json_traits >
json_traits::string_type jwt::header< json_traits >::get_key_id ( ) const
inline

Get key id claim

Returns
key id as string
Exceptions
std::runtime_errorIf claim was not present
std::bad_castClaim was present but not a string (Should not happen in a valid token)

Definition at line 2903 of file jwt.h.

◆ get_type()

template<typename json_traits >
json_traits::string_type jwt::header< json_traits >::get_type ( ) const
inline

Get type claim

Returns
type as a string
Exceptions
std::runtime_errorIf claim was not present
std::bad_castClaim was present but not a string (Should not happen in a valid token)

Definition at line 2883 of file jwt.h.

◆ has_algorithm()

template<typename json_traits >
bool jwt::header< json_traits >::has_algorithm ( ) const
inlinenoexcept

Check if algortihm is present ("alg")

Returns
true if present, false otherwise

Definition at line 2851 of file jwt.h.

◆ has_content_type()

template<typename json_traits >
bool jwt::header< json_traits >::has_content_type ( ) const
inlinenoexcept

Check if content type is present ("cty")

Returns
true if present, false otherwise

Definition at line 2861 of file jwt.h.

◆ has_header_claim()

template<typename json_traits >
bool jwt::header< json_traits >::has_header_claim ( const typename json_traits::string_type &  name) const
inlinenoexcept

Check if a header claim is present

Returns
true if claim was present, false otherwise

Definition at line 2911 of file jwt.h.

◆ has_key_id()

template<typename json_traits >
bool jwt::header< json_traits >::has_key_id ( ) const
inlinenoexcept

Check if key id is present ("kid")

Returns
true if present, false otherwise

Definition at line 2866 of file jwt.h.

◆ has_type()

template<typename json_traits >
bool jwt::header< json_traits >::has_type ( ) const
inlinenoexcept

Check if type is present ("typ")

Returns
true if present, false otherwise

Definition at line 2856 of file jwt.h.

Member Data Documentation

◆ header_claims

template<typename json_traits >
details::map_of_claims<json_traits> jwt::header< json_traits >::header_claims
protected

Definition at line 2843 of file jwt.h.


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