Skip to content

Commit

Permalink
quick pass to repro bug
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc authored Oct 18, 2020
1 parent 8642cb0 commit 961facd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/NlohmannTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,18 @@ TEST(NlohmannTest, VerifyTokenHS256) {
auto decoded_token = jwt::decode<nlohmann_traits>(token);
verify.verify(decoded_token);
}

TEST(NlohmannTest, Bug103Expiration) {
const auto token = jwt::create<nlohmann_traits>()
.set_issuer("auth0")
.set_issued_at(std::chrono::system_clock::now())
.set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{3600})
.sign(jwt::algorithm::hs256{"secret"});

auto verify = jwt::verify<jwt::default_clock, nlohmann_traits>({})
.allow_algorithm(jwt::algorithm::hs256{ "secret" })
.with_issuer("auth0");

auto decoded_token = jwt::decode<nlohmann_traits>(token);
verify.verify(decoded_token);
}

0 comments on commit 961facd

Please sign in to comment.