mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-24 02:44:51 +03:00
Переделал проверку на try/catch
This commit is contained in:
parent
56715588c3
commit
78486a87a8
@ -35,15 +35,23 @@ class RefreshTokenRepository implements RefreshTokenRepositoryInterface
|
|||||||
|
|
||||||
public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntity)
|
public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntity)
|
||||||
{
|
{
|
||||||
$refreshToken = $this->refreshTokenModel->getItemByIdentifier($refreshTokenEntity->getIdentifier());
|
$found = false;
|
||||||
|
try {
|
||||||
|
$refreshToken = $this->refreshTokenModel->getItemByIdentifier($refreshTokenEntity->getIdentifier());
|
||||||
|
|
||||||
if ($refreshToken->id > 0) {
|
if ($refreshToken->id > 0) {
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found) {
|
||||||
throw UniqueTokenIdentifierConstraintViolationException::create();
|
throw UniqueTokenIdentifierConstraintViolationException::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $refreshTokenEntity->getData();
|
$data = $refreshTokenEntity->getData();
|
||||||
|
|
||||||
$accessToken = $this->accessTokenModel->getItemByIdentifier($refreshTokenEntity->getAccessToken());
|
$accessToken = $this->accessTokenModel->getItemByIdentifier($refreshTokenEntity->getAccessToken()->getIdentifier());
|
||||||
|
|
||||||
unset($data['access_token_identifier']);
|
unset($data['access_token_identifier']);
|
||||||
$data['access_token_id'] = $accessToken->id;
|
$data['access_token_id'] = $accessToken->id;
|
||||||
|
Loading…
Reference in New Issue
Block a user