[Libreoffice-commits] online.git: wsd/Auth.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat May 18 21:42:33 UTC 2019
wsd/Auth.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit a243fdef88e85ec082ade9622374d20fc5a77ffb
Author: DarkByt31 <avihs.29 at gmail.com>
AuthorDate: Sat May 18 00:14:07 2019 +0530
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat May 18 23:42:14 2019 +0200
tdf#107038 Poco::Timestamp replacement with std::chrono
Change-Id: Ic577d304f2152c53895f4602cf55a98dd1e63ed0
Reviewed-on: https://gerrit.libreoffice.org/72531
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/wsd/Auth.cpp b/wsd/Auth.cpp
index f4e92907d..6a0ec5ef4 100644
--- a/wsd/Auth.cpp
+++ b/wsd/Auth.cpp
@@ -137,7 +137,8 @@ bool JWTAuth::verify(const std::string& accessToken)
Poco::JSON::Object::Ptr object = result.extract<Poco::JSON::Object::Ptr>();
std::time_t decodedExptime = object->get("exp").convert<std::time_t>();
- std::time_t curtime = Poco::Timestamp().epochTime();
+ std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
+ std::time_t curtime = std::chrono::system_clock::to_time_t(now);
if (curtime > decodedExptime)
{
LOG_INF("JWTAuth:verify: JWT expired; curtime:" << curtime << ", exp:" << decodedExptime);
@@ -170,7 +171,8 @@ const std::string JWTAuth::createHeader()
const std::string JWTAuth::createPayload()
{
- const std::time_t curtime = Poco::Timestamp().epochTime();
+ std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
+ std::time_t curtime = std::chrono::system_clock::to_time_t(now);
const std::string exptime = std::to_string(curtime + 1800);
// TODO: Some sane code to represent JSON objects
More information about the Libreoffice-commits
mailing list