| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 4 | public function handle($request, Closure $next) |
|
| 16 | { |
||
| 17 | 4 | $config = config('auth.simple', []); |
|
| 18 | |||
| 19 | 4 | if (! empty($config['enabled'])) { |
|
| 20 | 3 | if ($request->getUser() !== $config['user'] || $request->getPassword() !== $config['password']) { |
|
| 21 | 2 | $header = ['WWW-Authenticate' => 'Basic']; |
|
| 22 | |||
| 23 | 2 | return response('You have to supply your credentials to access this resource.', Response::HTTP_UNAUTHORIZED, $header); |
|
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | 2 | return $next($request); |
|
| 28 | } |
||
| 29 | } |
||
| 30 |