| @@ 95-99 (lines=5) @@ | ||
| 92 | } |
|
| 93 | ||
| 94 | // code expired! |
|
| 95 | if (time() > strtotime($tokensMapper->expires)) { |
|
| 96 | $this->failure('authentication_error', "The token expired.", 401); |
|
| 97 | $this->setOAuthError('invalid_grant'); |
|
| 98 | return; |
|
| 99 | } |
|
| 100 | ||
| 101 | // now set a token into the the same token object |
|
| 102 | $tokensMapper->setUUID('token'); |
|
| @@ 340-344 (lines=5) @@ | ||
| 337 | return false; |
|
| 338 | } |
|
| 339 | // check token is not out-of-date |
|
| 340 | if (time() > strtotime($tokensMapper->expires)) { |
|
| 341 | $this->failure('authentication_error', "The token expired!", 401); |
|
| 342 | $this->setOAuthError('invalid_grant'); |
|
| 343 | ||
| 344 | return false; |
|
| 345 | } |
|
| 346 | // if token found load the user for the token |
|
| 347 | $usersModel->getUserByUUID($tokensMapper->users_uuid); |
|
| @@ 376-381 (lines=6) @@ | ||
| 373 | // get the scopes, this might have come from the token auth |
|
| 374 | $scope = $f3->get('REQUEST.scope'); |
|
| 375 | $scopes = empty($scope) ? [] : preg_split("/[\s,]+/", $scope); |
|
| 376 | if (null !== $tokensMapper->uuid && time() > strtotime($tokensMapper->expires)) { |
|
| 377 | $this->failure('authentication_error', "The token expired!", 401); |
|
| 378 | $this->setOAuthError('invalid_grant'); |
|
| 379 | ||
| 380 | return false; |
|
| 381 | } |
|
| 382 | ||
| 383 | $userAuthenticated = (is_array($user) || is_array($app)); |
|
| 384 | if (!$userAuthenticated) { |
|