mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
Added new parameters for decode API
This commit is contained in:
parent
de38b3a82a
commit
09bc72c9f7
6 changed files with 107 additions and 6 deletions
|
@ -291,13 +291,25 @@ void jwt_object::set_parameters()
|
|||
return;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T,
|
||||
typename=typename std::enable_if_t<
|
||||
!std::is_same<system_time_t, std::decay_t<T>>::value>
|
||||
>
|
||||
jwt_object& jwt_object::add_claim(const string_view name, T&& value)
|
||||
{
|
||||
payload_.add_claim(name, std::forward<T>(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
jwt_object& jwt_object::add_claim(const string_view name, system_time_t tp)
|
||||
{
|
||||
return add_claim(
|
||||
name,
|
||||
std::chrono::duration_cast<
|
||||
std::chrono::seconds>(tp.time_since_epoch()).count()
|
||||
);
|
||||
}
|
||||
|
||||
jwt_object& jwt_object::remove_claim(const string_view name)
|
||||
{
|
||||
payload_.remove_claim(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue