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