2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
2017-10-29 17:37:25 +00:00
|
|
|
use Illuminate\Http\Request;
|
2017-11-03 23:16:49 +00:00
|
|
|
use Illuminate\Auth\AuthenticationException;
|
2015-12-06 18:58:49 +00:00
|
|
|
|
|
|
|
class Authenticate
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @return mixed
|
2017-11-03 23:16:49 +00:00
|
|
|
*
|
|
|
|
* @throws \Illuminate\Auth\AuthenticationException
|
2015-12-06 18:58:49 +00:00
|
|
|
*/
|
2017-10-29 17:37:25 +00:00
|
|
|
public function handle(Request $request, Closure $next)
|
2015-12-06 18:58:49 +00:00
|
|
|
{
|
2021-01-23 20:33:34 +00:00
|
|
|
if (!$request->user()) {
|
|
|
|
throw new AuthenticationException();
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|