Skip to content

Commit

Permalink
Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
lo-simon committed Dec 12, 2024
1 parent 02b8b3c commit c0deff9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Development/nmos/authorization_behaviour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ namespace nmos
{
return false;
}
auto now = std::chrono::system_clock::now();
auto exp = std::chrono::system_clock::from_time_t(expires_at);
const auto now = std::chrono::system_clock::now();
const auto exp = std::chrono::system_clock::from_time_t(expires_at);
return (now > exp);
};

Expand Down
6 changes: 4 additions & 2 deletions Development/nmos/jwt_generator_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace nmos
static utility::string_t create_client_assertion(const utility::string_t& issuer, const utility::string_t& subject, const web::uri& audience, const std::chrono::seconds& token_lifetime, const utility::string_t& public_key, const utility::string_t& private_key, const utility::string_t& keyid)
{
using namespace jwt::traits;

const auto now = std::chrono::system_clock::now();

// use server private key to create client_assertion (JWT)
// where client_assertion MUST including iss, sub, aud, exp, and may including jti
Expand All @@ -26,8 +28,8 @@ namespace nmos
.set_issuer(utility::us2s(issuer))
.set_subject(utility::us2s(subject))
.set_audience(utility::us2s(audience.to_string()))
.set_issued_at(std::chrono::system_clock::now())
.set_expires_at(std::chrono::system_clock::now() + token_lifetime)
.set_issued_at(now)
.set_expires_at(now + token_lifetime)
.set_id(utility::us2s(nmos::make_id()))
.set_key_id(utility::us2s(keyid))
.set_type("JWT")
Expand Down

0 comments on commit c0deff9

Please sign in to comment.