Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function handle($request, Closure $next) |
||
11 | { |
||
12 | if (stripos($request->header('User-Agent'), 'Checkr-Webhook') === false) { |
||
13 | Log::alert('Invalid user agent for Checkr webhook'); |
||
14 | abort(404); |
||
|
|||
15 | } |
||
16 | |||
17 | if (hash_hmac('SHA256', $request->getContent(), env('checkr_api_key')) !== $request->header('X-Checkr-Signature')) { |
||
18 | Log::alert('Checkr signature does not match request.'); |
||
19 | abort(404); |
||
20 | } |
||
21 | |||
22 | return $next($request); |
||
23 | } |
||
24 | } |