diff --git a/example/rsa-create.cpp b/example/rsa-create.cpp index 2243f2689..4ee3f6017 100644 --- a/example/rsa-create.cpp +++ b/example/rsa-create.cpp @@ -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, "", "")); diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h index 2c2320238..5dcd2d236 100644 --- a/include/jwt-cpp/jwt.h +++ b/include/jwt-cpp/jwt.h @@ -3246,8 +3246,8 @@ namespace jwt { * \param d token expiration timeout * \return *this to allow for method chaining */ - template - builder& set_expires_in(const std::chrono::duration& d) { + template + builder& set_expires_in(const std::chrono::duration& d) { return set_payload_claim("exp", basic_claim(clock.now() + d)); } /** diff --git a/tests/traits/BoostJsonTest.cpp b/tests/traits/BoostJsonTest.cpp index 82c3810b3..8cdf7e145 100644 --- a/tests/traits/BoostJsonTest.cpp +++ b/tests/traits/BoostJsonTest.cpp @@ -87,7 +87,7 @@ TEST(BoostJsonTest, VerifyTokenExpirationInValid) { const auto token = jwt::create() .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(token); diff --git a/tests/traits/JsonconsTest.cpp b/tests/traits/JsonconsTest.cpp index 7d0f1ade4..facd90e3b 100644 --- a/tests/traits/JsonconsTest.cpp +++ b/tests/traits/JsonconsTest.cpp @@ -90,7 +90,7 @@ TEST(JsonconsTest, VerifyTokenExpirationInValid) { const auto token = jwt::create() .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(token); diff --git a/tests/traits/NlohmannTest.cpp b/tests/traits/NlohmannTest.cpp index 616b622d7..513a6c7f4 100644 --- a/tests/traits/NlohmannTest.cpp +++ b/tests/traits/NlohmannTest.cpp @@ -86,7 +86,7 @@ TEST(NlohmannTest, VerifyTokenExpirationInValid) { const auto token = jwt::create() .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(token); diff --git a/tests/traits/OspJsoncppTest.cpp b/tests/traits/OspJsoncppTest.cpp index 39a6df2ff..b85311848 100644 --- a/tests/traits/OspJsoncppTest.cpp +++ b/tests/traits/OspJsoncppTest.cpp @@ -90,7 +90,7 @@ TEST(OspJsoncppTest, VerifyTokenExpirationInValid) { const auto token = jwt::create() .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(token); diff --git a/tests/traits/TraitsTest.cpp.mustache b/tests/traits/TraitsTest.cpp.mustache index 84ae8fceb..bc94fc916 100644 --- a/tests/traits/TraitsTest.cpp.mustache +++ b/tests/traits/TraitsTest.cpp.mustache @@ -90,7 +90,7 @@ TEST({{test_suite_name}}, VerifyTokenExpirationInValid) { const auto token = jwt::create() .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(token);