ObjectStorageAuthenticate::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 10
cc 2
nc 2
nop 2
crap 6
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