/** * {@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; }
/** * {@inheritdoc} */ public function isValidForTokenExchange() { $expiry = $this->dataHelper->getConsumerExpirationPeriod(); $currentTimestamp = $this->getDateHelper()->gmtTimestamp(); $updatedTimestamp = $this->getDateHelper()->gmtTimestamp($this->getUpdatedAt()); return $expiry > $currentTimestamp - $updatedTimestamp; }
/** * {@inheritdoc} */ public function isValidForTokenExchange() { $expiry = $this->dataHelper->getConsumerExpirationPeriod(); return $expiry > $this->getResource()->getTimeInSecondsSinceCreation($this->getId()); }