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.
|
|
|
|
*
|
2017-08-22 03:10:48 +00:00
|
|
|
* @param \Illuminate\Http\Request $request
|
2019-09-06 04:32:57 +00:00
|
|
|
* @param \Closure $next
|
2015-12-06 18:58:49 +00:00
|
|
|
* @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
|
|
|
{
|
2017-11-03 23:16:49 +00:00
|
|
|
if (! $request->user()) {
|
2017-11-05 18:38:39 +00:00
|
|
|
throw new AuthenticationException;
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|