From e55a943432dc0a6b9520d13c5651874ac88dd4ff Mon Sep 17 00:00:00 2001 From: Mponos George Date: Fri, 15 Sep 2017 13:11:22 +0300 Subject: [PATCH 1/2] Update TimeoutToken.php (#6) --- src/Token/TimeoutToken.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Token/TimeoutToken.php b/src/Token/TimeoutToken.php index 7e58995..0a90343 100644 --- a/src/Token/TimeoutToken.php +++ b/src/Token/TimeoutToken.php @@ -34,16 +34,15 @@ public function __construct($token, EncoderInterface $encoder = null, $offset = public function isValid() { $payload = $this->getPayload(); - if (isset($payload['exp'])) { $now = new \DateTime('now'); if (is_int($payload['exp'])) { - return ($now->getTimestamp() - $payload['exp'] - $this->offset) > 0; + return ($payload['exp'] - $this->offset - $now->getTimestamp()) > 0; } if (is_numeric($payload['exp'])) { - return ($now->format('U') - $payload['exp'] - $this->offset) > 0; + return ($payload['exp'] - $this->offset - $now->format('U')) > 0; } } From 11706acf05454a48a0a2892894443e0e0e6048fc Mon Sep 17 00:00:00 2001 From: Mponos George Date: Fri, 15 Sep 2017 13:12:21 +0300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba47b19..61f5459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All Notable changes to `webthink/guzzle-jwt` will be documented in this file. Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## v0.3.0 - 2017-09-14 + +### Bug +- Function that was calculating the timeout token if it was valid was wrong. + ## v0.2.0 - 2017-09-14 ### Changed