| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function handle($request, Closure $next, $type = null) |
||
| 43 | { |
||
| 44 | $route = $this->router->getCurrentRoute(); |
||
| 45 | |||
| 46 | if (! $this->auth->check(false)) { |
||
| 47 | $this->auth->authenticate($route->getAuthProviders()); |
||
| 48 | } |
||
| 49 | |||
| 50 | $this->authorizer->setRequest($request); |
||
| 51 | |||
| 52 | //type: user or client |
||
| 53 | if ($type && $this->authorizer->getResourceOwnerType() !== $type) { |
||
| 54 | throw new AccessDeniedException(); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $next($request); |
||
| 58 | } |
||
| 59 | } |
||
| 60 |