Beispiel #1
0
 /**
  * Get the timestamp when the blacklist comes into effect
  * This defaults to immediate (0 seconds)
  *
  * @return integer
  */
 protected function getGraceTimestamp()
 {
     return (int) Utils::now()->addSeconds($this->gracePeriod)->format('U');
 }
Beispiel #2
0
 /**
  * Get the Not Before (nbf) claim.
  *
  * @return int
  */
 public function nbf()
 {
     return Utils::now()->getTimestamp();
 }
 /**
  * Check the token in the refresh flow context
  *
  * @param  $payload
  *
  * @throws \Tymon\JWTAuth\Exceptions\TokenExpiredException
  *
  * @return bool
  */
 protected function validateRefresh(array $payload)
 {
     if (isset($payload['iat']) && Utils::timestamp($payload['iat'])->diffInMinutes(Utils::now()) >= $this->refreshTTL) {
         throw new TokenExpiredException('Token has expired and can no longer be refreshed');
     }
     return true;
 }
 /**
  * Check the token in the refresh flow context.
  *
  * @param  array  $payload
  *
  * @throws \Tymon\JWTAuth\Exceptions\TokenExpiredException
  *
  * @return bool
  */
 protected function validateRefresh(array $payload)
 {
     if (isset($payload['iat']) && Utils::isPast($payload['iat'] + $this->refreshTTL * 60)) {
         throw new TokenExpiredException('Token has expired and can no longer be refreshed');
     }
     return true;
 }
Beispiel #5
0
 /**
  * Get the Not Before (nbf) claim
  *
  * @return int
  */
 public function nbf()
 {
     return (int) Utils::now()->format('U');
 }
Beispiel #6
0
 /**
  * Get the timestamp when the blacklist comes into effect
  * This defaults to immediate (0 seconds).
  *
  * @return int
  */
 protected function getGraceTimestamp()
 {
     return Utils::now()->addSeconds($this->gracePeriod)->getTimestamp();
 }