Skip to content

Commit fc5ff12

Browse files
committed
Reverted change for time compression to use \Magento\Framework\Stdlib\DateTime::strToTime instead of php strtotime.
Updated helpers to get token expire time to check if value is positive before response.
1 parent 0bda8d0 commit fc5ff12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/code/Magento/Integration/Helper/Oauth/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function getConsumerPostTimeout()
121121
public function getCustomerTokenLifetime()
122122
{
123123
$hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/customer');
124-
return is_numeric($hours) ? $hours : 0;
124+
return is_numeric($hours) && $hours > 0 ? $hours : 0;
125125
}
126126

127127
/**
@@ -132,6 +132,6 @@ public function getCustomerTokenLifetime()
132132
public function getAdminTokenLifetime()
133133
{
134134
$hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/admin');
135-
return is_numeric($hours) ? $hours : 0;
135+
return is_numeric($hours) && $hours > 0 ? $hours : 0;
136136
}
137137
}

app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private function isTokenExpired(Token $token): bool
137137
return false;
138138
}
139139

140-
if (strtotime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
140+
if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
141141
return true;
142142
}
143143

0 commit comments

Comments
 (0)