| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function handle($request, Closure $next, $guard) |
||
| 24 | { |
||
| 25 | app()->singleton('tymon.jwt.auth', function () use ($guard) { |
||
| 26 | /** @var GuardContract $auth */ |
||
| 27 | $auth = auth($guard); |
||
| 28 | |||
| 29 | return new JWTAuth(app('tymon.jwt.manager'), new Illuminate($auth), app('tymon.jwt.parser')); |
||
| 30 | }); |
||
| 31 | |||
| 32 | $this->auth = app('tymon.jwt.auth'); |
||
| 33 | |||
| 34 | $this->checkForToken($request); |
||
| 35 | |||
| 36 | try { |
||
| 37 | $token = $this->auth->parseToken()->refresh(); |
||
| 38 | } catch (JWTException $e) { |
||
| 39 | throw new UnauthorizedHttpException('jwt-auth', $e->getMessage(), $e, $e->getCode()); |
||
| 40 | } |
||
| 41 | |||
| 42 | $response = $next($request); |
||
| 43 | |||
| 44 | // Send the refreshed token back to the client. |
||
| 45 | return $this->setAuthenticationHeader($response, $token); |
||
| 46 | } |
||
| 48 |