| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function handle(ServerRequestInterface $request) |
||
| 36 | { |
||
| 37 | if (services()->has('jsonWebTokenAuthentication')) { |
||
| 38 | /** |
||
| 39 | * This is an example to implement HTTP Authentication with Json Web Token (JWT). |
||
| 40 | * Try put this code into your request and see the result. |
||
| 41 | * |
||
| 42 | * eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjcsInVzZXJuYW1lIjoic3RlZXZlbnoifQ.D29MZcJa2svH5kNt4bFcUtIXvJ4ohYJ-0vNxsgMWAvc |
||
| 43 | */ |
||
| 44 | if(false !== ($token = input()->bearerToken())) { |
||
| 45 | $payload = services('jsonWebTokenAuthentication')->decode($token); |
||
| 46 | globals()->store('payload', $payload); |
||
| 47 | } else { |
||
| 48 | output()->sendError(403, [ |
||
| 49 | 'message' => language()->getLine('403_INVALID_JSONWEBTOKEN') |
||
| 50 | ]); |
||
| 54 | } |