Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/rsa-create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rK0/Ikt5ybqUzKCMJZg2VKGTxg==
.set_type("JWT")
.set_id("rsa-create-example")
.set_issued_now()
.set_expires_in(std::chrono::seconds{36000})
.set_expires_in(std::chrono::hours{1})
.set_payload_claim("sample", jwt::claim(std::string{"test"}))
.sign(jwt::algorithm::rs256("", rsa_priv_key, "", ""));

Expand Down
4 changes: 2 additions & 2 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3246,8 +3246,8 @@ namespace jwt {
* \param d token expiration timeout
* \return *this to allow for method chaining
*/
template<class Rep>
builder& set_expires_in(const std::chrono::duration<Rep>& d) {
template<class Rep, class Period>
builder& set_expires_in(const std::chrono::duration<Rep, Period>& d) {
return set_payload_claim("exp", basic_claim<json_traits>(clock.now() + d));
}
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/traits/BoostJsonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ TEST(BoostJsonTest, VerifyTokenExpirationInValid) {
const auto token = jwt::create<jwt::traits::boost_json>()
.set_issuer("auth0")
.set_issued_now()
.set_expires_in(std::chrono::seconds{3600})
.set_expires_in(std::chrono::hours{1})
.sign(jwt::algorithm::hs256{"secret"});

const auto decoded_token = jwt::decode<jwt::traits::boost_json>(token);
Expand Down
2 changes: 1 addition & 1 deletion tests/traits/JsonconsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST(JsonconsTest, VerifyTokenExpirationInValid) {
const auto token = jwt::create<jwt::traits::danielaparker_jsoncons>()
.set_issuer("auth0")
.set_issued_now()
.set_expires_in(std::chrono::seconds{3600})
.set_expires_in(std::chrono::hours{1})
.sign(jwt::algorithm::hs256{"secret"});

const auto decoded_token = jwt::decode<jwt::traits::danielaparker_jsoncons>(token);
Expand Down
2 changes: 1 addition & 1 deletion tests/traits/NlohmannTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TEST(NlohmannTest, VerifyTokenExpirationInValid) {
const auto token = jwt::create<jwt::traits::nlohmann_json>()
.set_issuer("auth0")
.set_issued_now()
.set_expires_in(std::chrono::seconds{3600})
.set_expires_in(std::chrono::hours{1})
.sign(jwt::algorithm::hs256{"secret"});

const auto decoded_token = jwt::decode<jwt::traits::nlohmann_json>(token);
Expand Down
2 changes: 1 addition & 1 deletion tests/traits/OspJsoncppTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST(OspJsoncppTest, VerifyTokenExpirationInValid) {
const auto token = jwt::create<jwt::traits::open_source_parsers_jsoncpp>()
.set_issuer("auth0")
.set_issued_now()
.set_expires_in(std::chrono::seconds{3600})
.set_expires_in(std::chrono::hours{1})
.sign(jwt::algorithm::hs256{"secret"});

const auto decoded_token = jwt::decode<jwt::traits::open_source_parsers_jsoncpp>(token);
Expand Down
2 changes: 1 addition & 1 deletion tests/traits/TraitsTest.cpp.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST({{test_suite_name}}, VerifyTokenExpirationInValid) {
const auto token = jwt::create<jwt::traits::{{traits_name}}>()
.set_issuer("auth0")
.set_issued_now()
.set_expires_in(std::chrono::seconds{3600})
.set_expires_in(std::chrono::hours{1})
.sign(jwt::algorithm::hs256{"secret"});

const auto decoded_token = jwt::decode<jwt::traits::{{traits_name}}>(token);
Expand Down
Loading