Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function validateConsumer($consumer)
 {
     // Must use consumer within expiration period.
     $consumerTS = strtotime($consumer->getCreatedAt());
     $expiry = $this->_dataHelper->getConsumerExpirationPeriod();
     if ($this->_date->timestamp() - $consumerTS > $expiry) {
         throw new \Magento\Framework\Oauth\Exception('Consumer key has expired');
     }
     return true;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function isValidForTokenExchange()
 {
     $expiry = $this->dataHelper->getConsumerExpirationPeriod();
     $currentTimestamp = $this->getDateHelper()->gmtTimestamp();
     $updatedTimestamp = $this->getDateHelper()->gmtTimestamp($this->getUpdatedAt());
     return $expiry > $currentTimestamp - $updatedTimestamp;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function isValidForTokenExchange()
 {
     $expiry = $this->dataHelper->getConsumerExpirationPeriod();
     return $expiry > $this->getResource()->getTimeInSecondsSinceCreation($this->getId());
 }