misc_pterodactyl-panel/app/Http/Middleware/Api/Client/AuthenticateClientAccess.php

28 lines
726 B
PHP
Raw Normal View History

2018-01-19 03:36:15 +00:00
<?php
namespace Pterodactyl\Http\Middleware\Api\Client;
2018-01-19 03:36:15 +00:00
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
class AuthenticateClientAccess
2018-01-19 03:36:15 +00:00
{
/**
* Authenticate that the currently authenticated user has permission
* to access the specified server.
2018-01-19 03:36:15 +00:00
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if (is_null($request->user())) {
throw new AccessDeniedHttpException('This account does not have permission to access this resource.');
2018-01-19 03:36:15 +00:00
}
return $next($request);
}
}