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