#include <goby/util/thirdparty/jwt-cpp/jwt.h>
|
| builder ()=default |
|
builder & | set_header_claim (const typename json_traits::string_type &id, typename json_traits::value_type c) |
|
builder & | set_header_claim (const typename json_traits::string_type &id, basic_claim< json_traits > c) |
|
builder & | set_payload_claim (const typename json_traits::string_type &id, typename json_traits::value_type c) |
|
builder & | set_payload_claim (const typename json_traits::string_type &id, basic_claim< json_traits > c) |
|
builder & | set_algorithm (typename json_traits::string_type str) |
| Set algorithm claim You normally don't need to do this, as the algorithm is automatically set if you don't change it. More...
|
|
builder & | set_type (typename json_traits::string_type str) |
|
builder & | set_content_type (typename json_traits::string_type str) |
|
builder & | set_key_id (typename json_traits::string_type str) |
| Set key id claim. More...
|
|
builder & | set_issuer (typename json_traits::string_type str) |
|
builder & | set_subject (typename json_traits::string_type str) |
|
builder & | set_audience (typename json_traits::array_type a) |
|
builder & | set_audience (typename json_traits::string_type aud) |
|
builder & | set_expires_at (const date &d) |
|
builder & | set_not_before (const date &d) |
|
builder & | set_issued_at (const date &d) |
|
builder & | set_id (const typename json_traits::string_type &str) |
|
template<typename Algo , typename Encode > |
json_traits::string_type | sign (const Algo &algo, Encode encode) const |
|
template<typename Algo > |
json_traits::string_type | sign (const Algo &algo) const |
|
template<typename Algo , typename Encode > |
json_traits::string_type | sign (const Algo &algo, Encode encode, std::error_code &ec) const |
|
template<typename Algo > |
json_traits::string_type | sign (const Algo &algo, std::error_code &ec) const |
|
template<typename json_traits>
class jwt::builder< json_traits >
Builder class to build and sign a new token Use jwt::create() to get an instance of this class.
Definition at line 3087 of file jwt.h.
◆ builder()
template<typename json_traits >
◆ set_algorithm()
template<typename json_traits >
Set algorithm claim You normally don't need to do this, as the algorithm is automatically set if you don't change it.
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3150 of file jwt.h.
◆ set_audience() [1/2]
template<typename json_traits >
Set audience claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3205 of file jwt.h.
◆ set_audience() [2/2]
template<typename json_traits >
Set audience claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3214 of file jwt.h.
◆ set_content_type()
template<typename json_traits >
builder& jwt::builder< json_traits >::set_content_type |
( |
typename json_traits::string_type |
str | ) |
|
|
inline |
Set content type claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3168 of file jwt.h.
◆ set_expires_at()
template<typename json_traits >
Set expires at claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3223 of file jwt.h.
◆ set_header_claim() [1/2]
template<typename json_traits >
Set a header claim.
- Parameters
-
id | Name of the claim |
c | Claim to add |
- Returns
- *this to allow for method chaining
Definition at line 3113 of file jwt.h.
◆ set_header_claim() [2/2]
template<typename json_traits >
builder& jwt::builder< json_traits >::set_header_claim |
( |
const typename json_traits::string_type & |
id, |
|
|
typename json_traits::value_type |
c |
|
) |
| |
|
inline |
Set a header claim.
- Parameters
-
id | Name of the claim |
c | Claim to add |
- Returns
- *this to allow for method chaining
Definition at line 3100 of file jwt.h.
◆ set_id()
template<typename json_traits >
Set id claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3250 of file jwt.h.
◆ set_issued_at()
template<typename json_traits >
Set issued at claim
- Parameters
-
d | Issued at time, should be current time |
- Returns
- *this to allow for method chaining
Definition at line 3241 of file jwt.h.
◆ set_issuer()
template<typename json_traits >
Set issuer claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3187 of file jwt.h.
◆ set_key_id()
template<typename json_traits >
Set key id claim.
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3178 of file jwt.h.
◆ set_not_before()
template<typename json_traits >
Set not before claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3232 of file jwt.h.
◆ set_payload_claim() [1/2]
template<typename json_traits >
Set a payload claim.
- Parameters
-
id | Name of the claim |
c | Claim to add |
- Returns
- *this to allow for method chaining
Definition at line 3137 of file jwt.h.
◆ set_payload_claim() [2/2]
template<typename json_traits >
builder& jwt::builder< json_traits >::set_payload_claim |
( |
const typename json_traits::string_type & |
id, |
|
|
typename json_traits::value_type |
c |
|
) |
| |
|
inline |
Set a payload claim.
- Parameters
-
id | Name of the claim |
c | Claim to add |
- Returns
- *this to allow for method chaining
Definition at line 3125 of file jwt.h.
◆ set_subject()
template<typename json_traits >
Set subject claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3196 of file jwt.h.
◆ set_type()
template<typename json_traits >
Set type claim
- Parameters
-
- Returns
- *this to allow for method chaining
Definition at line 3159 of file jwt.h.
◆ sign() [1/4]
template<typename json_traits >
template<typename Algo >
json_traits::string_type jwt::builder< json_traits >::sign |
( |
const Algo & |
algo | ) |
const |
|
inline |
Sign token and return result
using the jwt::base
functions provided
- Parameters
-
algo | Instance of an algorithm to sign the token with |
- Returns
- Final token as a string
Definition at line 3283 of file jwt.h.
◆ sign() [2/4]
template<typename json_traits >
template<typename Algo , typename Encode >
json_traits::string_type jwt::builder< json_traits >::sign |
( |
const Algo & |
algo, |
|
|
Encode |
encode |
|
) |
| const |
|
inline |
Sign token and return result
- Template Parameters
-
Algo | Callable method which takes a string_type and return the signed input as a string_type |
Encode | Callable method which takes a string_type and base64url safe encodes it, MUST return the result with no padding; trim the result. |
- Parameters
-
algo | Instance of an algorithm to sign the token with |
encode | Callable to transform the serialized json to base64 with no padding |
- Returns
- Final token as a string
- Note
- If the 'alg' header in not set in the token it will be set to
algo.name()
Definition at line 3267 of file jwt.h.
◆ sign() [3/4]
template<typename json_traits >
template<typename Algo , typename Encode >
json_traits::string_type jwt::builder< json_traits >::sign |
( |
const Algo & |
algo, |
|
|
Encode |
encode, |
|
|
std::error_code & |
ec |
|
) |
| const |
|
inline |
Sign token and return result
- Template Parameters
-
Algo | Callable method which takes a string_type and return the signed input as a string_type |
Encode | Callable method which takes a string_type and base64url safe encodes it, MUST return the result with no padding; trim the result. |
- Parameters
-
algo | Instance of an algorithm to sign the token with |
encode | Callable to transform the serialized json to base64 with no padding |
ec | error_code filled with details on error |
- Returns
- Final token as a string
- Note
- If the 'alg' header in not set in the token it will be set to
algo.name()
Definition at line 3305 of file jwt.h.
◆ sign() [4/4]
template<typename json_traits >
template<typename Algo >
json_traits::string_type jwt::builder< json_traits >::sign |
( |
const Algo & |
algo, |
|
|
std::error_code & |
ec |
|
) |
| const |
|
inline |
Sign token and return result
using the jwt::base
functions provided
- Parameters
-
algo | Instance of an algorithm to sign the token with |
ec | error_code filled with details on error |
- Returns
- Final token as a string
Definition at line 3336 of file jwt.h.
The documentation for this class was generated from the following file:
- goby/util/thirdparty/jwt-cpp/jwt.h