Merge pull request #626 from beyondcode/fix/check-app-key
[fix] Check for key app on authorization
This commit is contained in:
commit
e9b9cc4002
|
|
@ -8,6 +8,10 @@ class Authorize
|
||||||
{
|
{
|
||||||
public function handle($request, $next)
|
public function handle($request, $next)
|
||||||
{
|
{
|
||||||
return is_null(App::findBySecret($request->secret)) ? abort(403) : $next($request);
|
$app = App::findByKey($request->key);
|
||||||
|
|
||||||
|
return is_null($app) || $app->secret !== $request->secret
|
||||||
|
? abort(403)
|
||||||
|
: $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class WebSocketsStatisticsControllerTest extends TestCase
|
||||||
$this->post(
|
$this->post(
|
||||||
action([WebSocketStatisticsEntriesController::class, 'store']),
|
action([WebSocketStatisticsEntriesController::class, 'store']),
|
||||||
array_merge($this->payload(), [
|
array_merge($this->payload(), [
|
||||||
|
'key' => config('websockets.apps.0.key'),
|
||||||
'secret' => config('websockets.apps.0.secret'),
|
'secret' => config('websockets.apps.0.secret'),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue