ObjectStorageAuthenticate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
c 0
b 0
f 0
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Http\Request;
7
8
/**
9
 * Authenticate requests from Object Storage services (like S3).
10
 * Such requests must have an apKey data, which matches with our app key.
11
 */
12
class ObjectStorageAuthenticate
13
{
14
    public function handle(Request $request, Closure $next)
15
    {
16
        if ($request->appKey !== config('app.key')) {
17
            return response('Unauthorized.', 401);
18
        }
19
20
        return $next($request);
21
    }
22
}
23