| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function handle($request, Closure $next) |
||
| 31 | { |
||
| 32 | if(ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) { |
||
| 33 | if(empty($request->jwt)) { |
||
| 34 | die('JWT token required.'); |
||
|
|
|||
| 35 | } |
||
| 36 | $token = (new Parser())->parse((string)$request->jwt); |
||
| 37 | if(Jwt::verify($token) === false) { |
||
| 38 | header('HTTP/1.1 403 Forbidden'); |
||
| 39 | die('Access forbidden.'); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | return $next($request); |
||
| 44 | } |
||
| 45 | } |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.