| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.0261 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 69 | public function call(Micro $api) |
|
| 28 | { |
||
| 29 | /** @var Request $request */ |
||
| 30 | 69 | $request = $api->getService('request'); |
|
| 31 | |||
| 32 | 69 | if ($this->isValidCheck($request, $api)) { |
|
| 33 | /** |
||
| 34 | * This is where we will validate the token that was sent to us |
||
| 35 | * using Bearer Authentication. |
||
| 36 | * |
||
| 37 | * Find the user attached to this token |
||
| 38 | */ |
||
| 39 | 61 | $token = $this->getToken($request->getBearerTokenFromHeader()); |
|
| 40 | |||
| 41 | 61 | if (!$token->validate(Users::getValidationData($token->getHeader('jti')))) { |
|
| 42 | throw new PermissionException('Invalid Token'); |
||
| 43 | //return false; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 69 | return true; |
|
| 48 | } |
||
| 50 |