mirror of
https://github.com/koel/koel
synced 2024-12-22 18:43:21 +00:00
29 lines
608 B
PHP
29 lines
608 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
|
||
|
/**
|
||
|
* Authenticate requests from Object Storage services (like S3).
|
||
|
* Such requests must have an apKey data, which matches with our app key.
|
||
|
*/
|
||
|
class ObjectStorageAuthenticate
|
||
|
{
|
||
|
/**
|
||
|
* Handle an incoming request.
|
||
|
*
|
||
|
* @param \Illuminate\Http\Request $request
|
||
|
* @param \Closure $next
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function handle($request, Closure $next)
|
||
|
{
|
||
|
if ($request->appKey !== config('app.key')) {
|
||
|
return response('Unauthorized.', 401);
|
||
|
}
|
||
|
|
||
|
return $next($request);
|
||
|
}
|
||
|
}
|