mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
Add set_expires_in and set_issued_now methods (#322)
* Add set_expires_in and set_issued_now methods * Add a Clock type parameter for builder * set_expires_in method sets exp from the current moment * Update default traits with the new builder interface * Add VerifyTokenExpirationInValid for all traits * Use the new methods in examples * Add create method to specify the clock type * Use JWT_CLAIM_EXPLICIT for explicit constructors * Fix builder factory method in mustache file * fixup whitespace * default template was missing a few args * fix whitespace * linter --------- Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
This commit is contained in:
@@ -35,8 +35,8 @@ rK0/Ikt5ybqUzKCMJZg2VKGTxg==
|
||||
.set_issuer("auth0")
|
||||
.set_type("JWT")
|
||||
.set_id("rsa-create-example")
|
||||
.set_issued_at(std::chrono::system_clock::now())
|
||||
.set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{36000})
|
||||
.set_issued_now()
|
||||
.set_expires_in(std::chrono::seconds{36000})
|
||||
.set_payload_claim("sample", jwt::claim(std::string{"test"}))
|
||||
.sign(jwt::algorithm::rs256("", rsa_priv_key, "", ""));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user