Goby3  3.1.4
2024.02.22
jwt::jwk< json_traits > Class Template Reference

JSON Web Key. More...

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

Public Member Functions

JWT_CLAIM_EXPLICIT jwk (const typename json_traits::string_type &str)
 
JWT_CLAIM_EXPLICIT jwk (const typename json_traits::value_type &json)
 
json_traits::string_type get_key_type () const
 
json_traits::string_type get_use () const
 
basic_claim_t::set_t get_key_operations () const
 
json_traits::string_type get_algorithm () const
 
json_traits::string_type get_key_id () const
 
json_traits::string_type get_curve () const
 Get curve claim. More...
 
json_traits::array_type get_x5c () const
 
json_traits::string_type get_x5u () const
 
json_traits::string_type get_x5t () const
 
json_traits::string_type get_x5t_sha256 () const
 
json_traits::string_type get_x5c_key_value () const
 
bool has_key_type () const noexcept
 
bool has_use () const noexcept
 
bool has_key_operations () const noexcept
 
bool has_algorithm () const noexcept
 
bool has_curve () const noexcept
 
bool has_key_id () const noexcept
 
bool has_x5u () const noexcept
 
bool has_x5c () const noexcept
 
bool has_x5t () const noexcept
 
bool has_x5t_sha256 () const noexcept
 
bool has_jwk_claim (const typename json_traits::string_type &name) const noexcept
 
basic_claim_t get_jwk_claim (const typename json_traits::string_type &name) const
 
bool empty () const noexcept
 

Detailed Description

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

JSON Web Key.

https://tools.ietf.org/html/rfc7517

A JSON object that represents a cryptographic key. The members of the object represent properties of the key, including its value.

Definition at line 3844 of file jwt.h.

Constructor & Destructor Documentation

◆ jwk() [1/2]

template<typename json_traits >
JWT_CLAIM_EXPLICIT jwt::jwk< json_traits >::jwk ( const typename json_traits::string_type &  str)
inline

Definition at line 3850 of file jwt.h.

◆ jwk() [2/2]

template<typename json_traits >
JWT_CLAIM_EXPLICIT jwt::jwk< json_traits >::jwk ( const typename json_traits::value_type &  json)
inline

Definition at line 3855 of file jwt.h.

Member Function Documentation

◆ empty()

template<typename json_traits >
bool jwt::jwk< json_traits >::empty ( ) const
inlinenoexcept

Definition at line 4055 of file jwt.h.

◆ get_algorithm()

template<typename json_traits >
json_traits::string_type jwt::jwk< 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 3898 of file jwt.h.

◆ get_curve()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_curve ( ) const
inline

Get curve claim.

https://www.rfc-editor.org/rfc/rfc7518.html#section-6.2.1.1 https://www.iana.org/assignments/jose/jose.xhtml#table-web-key-elliptic-curve

Returns
curve 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 3924 of file jwt.h.

◆ get_jwk_claim()

template<typename json_traits >
basic_claim_t jwt::jwk< json_traits >::get_jwk_claim ( const typename json_traits::string_type &  name) const
inline

Get jwks claim

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

Definition at line 4050 of file jwt.h.

◆ get_key_id()

template<typename json_traits >
json_traits::string_type jwt::jwk< 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 3909 of file jwt.h.

◆ get_key_operations()

template<typename json_traits >
basic_claim_t::set_t jwt::jwk< json_traits >::get_key_operations ( ) const
inline

Get key operation types claim

Returns
key operation types as a set of strings
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 3887 of file jwt.h.

◆ get_key_type()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_key_type ( ) const
inline

Get key type claim

This returns the general type (e.g. RSA or EC), not a specific algorithm value.

Returns
key 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 3868 of file jwt.h.

◆ get_use()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_use ( ) const
inline

Get public key usage claim

Returns
usage parameter 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 3879 of file jwt.h.

◆ get_x5c()

template<typename json_traits >
json_traits::array_type jwt::jwk< json_traits >::get_x5c ( ) const
inline

Get x5c claim

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

Definition at line 3932 of file jwt.h.

◆ get_x5c_key_value()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_x5c_key_value ( ) const
inline

Get x5c claim as a string

Returns
x5c as an 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 3967 of file jwt.h.

◆ get_x5t()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_x5t ( ) const
inline

Get X509 thumbprint claim

Returns
x5t 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 3948 of file jwt.h.

◆ get_x5t_sha256()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_x5t_sha256 ( ) const
inline

Get X509 SHA256 thumbprint claim

Returns
x5t::S256 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 3956 of file jwt.h.

◆ get_x5u()

template<typename json_traits >
json_traits::string_type jwt::jwk< json_traits >::get_x5u ( ) const
inline

Get X509 URL claim

Returns
x5u 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 3940 of file jwt.h.

◆ has_algorithm()

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

Check if algortihm is present ("alg")

Returns
true if present, false otherwise

Definition at line 3998 of file jwt.h.

◆ has_curve()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_curve ( ) const
inlinenoexcept

Check if curve is present ("crv")

Returns
true if present, false otherwise

Definition at line 4004 of file jwt.h.

◆ has_jwk_claim()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_jwk_claim ( const typename json_traits::string_type &  name) const
inlinenoexcept

Check if a jwks claim is present

Returns
true if claim was present, false otherwise

Definition at line 4040 of file jwt.h.

◆ has_key_id()

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

Check if key id is present ("kid")

Returns
true if present, false otherwise

Definition at line 4010 of file jwt.h.

◆ has_key_operations()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_key_operations ( ) const
inlinenoexcept

Check if a key operations parameter is present ("key_ops")

Returns
true if present, false otherwise

Definition at line 3992 of file jwt.h.

◆ has_key_type()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_key_type ( ) const
inlinenoexcept

Check if a key type is present ("kty")

Returns
true if present, false otherwise

Definition at line 3980 of file jwt.h.

◆ has_use()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_use ( ) const
inlinenoexcept

Check if a public key usage indication is present ("use")

Returns
true if present, false otherwise

Definition at line 3986 of file jwt.h.

◆ has_x5c()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_x5c ( ) const
inlinenoexcept

Check if X509 Chain is present ("x5c")

Returns
true if present, false otherwise

Definition at line 4022 of file jwt.h.

◆ has_x5t()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_x5t ( ) const
inlinenoexcept

Check if a X509 thumbprint is present ("x5t")

Returns
true if present, false otherwise

Definition at line 4028 of file jwt.h.

◆ has_x5t_sha256()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_x5t_sha256 ( ) const
inlinenoexcept

Check if a X509 SHA256 thumbprint is present ("x5t#S256")

Returns
true if present, false otherwise

Definition at line 4034 of file jwt.h.

◆ has_x5u()

template<typename json_traits >
bool jwt::jwk< json_traits >::has_x5u ( ) const
inlinenoexcept

Check if X509 URL is present ("x5u")

Returns
true if present, false otherwise

Definition at line 4016 of file jwt.h.


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