2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http;
|
|
|
|
|
2018-02-25 21:30:56 +00:00
|
|
|
use Pterodactyl\Models\ApiKey;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Illuminate\Auth\Middleware\Authorize;
|
|
|
|
use Illuminate\Auth\Middleware\Authenticate;
|
|
|
|
use Pterodactyl\Http\Middleware\TrimStrings;
|
2017-12-16 18:20:09 +00:00
|
|
|
use Pterodactyl\Http\Middleware\TrustProxies;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Illuminate\Session\Middleware\StartSession;
|
|
|
|
use Pterodactyl\Http\Middleware\EncryptCookies;
|
|
|
|
use Pterodactyl\Http\Middleware\VerifyCsrfToken;
|
|
|
|
use Pterodactyl\Http\Middleware\VerifyReCaptcha;
|
|
|
|
use Pterodactyl\Http\Middleware\AdminAuthenticate;
|
|
|
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
|
|
|
use Pterodactyl\Http\Middleware\LanguageMiddleware;
|
2015-12-06 18:58:49 +00:00
|
|
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
2018-02-25 21:30:56 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\AuthenticateKey;
|
2017-09-24 01:45:25 +00:00
|
|
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
2017-10-28 02:42:53 +00:00
|
|
|
use Pterodactyl\Http\Middleware\AccessingValidServer;
|
2018-02-25 21:30:56 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\SetSessionDriver;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
2018-06-02 21:32:26 +00:00
|
|
|
use Pterodactyl\Http\Middleware\MaintenanceMiddleware;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Pterodactyl\Http\Middleware\RedirectIfAuthenticated;
|
|
|
|
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
2018-02-25 21:30:56 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess;
|
2018-01-20 21:33:04 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\ApiSubstituteBindings;
|
2017-12-16 18:20:09 +00:00
|
|
|
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
2017-10-29 17:37:25 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser;
|
2018-01-13 22:06:19 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate;
|
2017-10-19 03:32:19 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Server\SubuserBelongsToServer;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
|
2017-10-19 03:32:19 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Server\DatabaseBelongsToServer;
|
|
|
|
use Pterodactyl\Http\Middleware\Server\ScheduleBelongsToServer;
|
2017-10-29 20:57:43 +00:00
|
|
|
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
|
2017-12-16 18:20:09 +00:00
|
|
|
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
|
2018-02-28 03:28:43 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Client\SubstituteClientApiBindings;
|
2018-02-25 21:30:56 +00:00
|
|
|
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser;
|
2017-11-04 22:16:44 +00:00
|
|
|
use Pterodactyl\Http\Middleware\DaemonAuthenticate as OldDaemonAuthenticate;
|
2015-12-06 18:58:49 +00:00
|
|
|
|
|
|
|
class Kernel extends HttpKernel
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The application's global HTTP middleware stack.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $middleware = [
|
2017-10-29 20:57:43 +00:00
|
|
|
CheckForMaintenanceMode::class,
|
2017-12-16 18:20:09 +00:00
|
|
|
ValidatePostSize::class,
|
2017-10-29 20:57:43 +00:00
|
|
|
TrimStrings::class,
|
2017-12-16 18:20:09 +00:00
|
|
|
ConvertEmptyStringsToNull::class,
|
2017-10-29 20:57:43 +00:00
|
|
|
TrustProxies::class,
|
2015-12-06 18:58:49 +00:00
|
|
|
];
|
|
|
|
|
2016-09-03 21:09:00 +00:00
|
|
|
/**
|
|
|
|
* The application's route middleware groups.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $middlewareGroups = [
|
|
|
|
'web' => [
|
2017-10-29 20:57:43 +00:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
SubstituteBindings::class,
|
|
|
|
LanguageMiddleware::class,
|
|
|
|
RequireTwoFactorAuthentication::class,
|
2016-09-03 21:09:00 +00:00
|
|
|
],
|
|
|
|
'api' => [
|
2018-01-19 03:36:15 +00:00
|
|
|
'throttle:120,1',
|
2018-01-20 21:33:04 +00:00
|
|
|
ApiSubstituteBindings::class,
|
2017-12-03 20:29:14 +00:00
|
|
|
SetSessionDriver::class,
|
2018-02-25 21:30:56 +00:00
|
|
|
'api..key:' . ApiKey::TYPE_APPLICATION,
|
|
|
|
AuthenticateApplicationUser::class,
|
|
|
|
AuthenticateIPAccess::class,
|
|
|
|
],
|
|
|
|
'client-api' => [
|
|
|
|
'throttle:60,1',
|
2018-02-28 03:28:43 +00:00
|
|
|
SubstituteClientApiBindings::class,
|
2018-02-25 21:30:56 +00:00
|
|
|
SetSessionDriver::class,
|
|
|
|
'api..key:' . ApiKey::TYPE_ACCOUNT,
|
2017-12-03 20:29:14 +00:00
|
|
|
AuthenticateIPAccess::class,
|
2016-09-03 21:09:00 +00:00
|
|
|
],
|
2017-09-24 01:45:25 +00:00
|
|
|
'daemon' => [
|
|
|
|
SubstituteBindings::class,
|
2017-11-04 22:16:44 +00:00
|
|
|
DaemonAuthenticate::class,
|
2017-09-24 01:45:25 +00:00
|
|
|
],
|
2016-09-03 21:09:00 +00:00
|
|
|
];
|
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
/**
|
|
|
|
* The application's route middleware.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $routeMiddleware = [
|
2017-10-29 20:57:43 +00:00
|
|
|
'auth' => Authenticate::class,
|
|
|
|
'auth.basic' => AuthenticateWithBasicAuth::class,
|
|
|
|
'guest' => RedirectIfAuthenticated::class,
|
2017-10-28 02:42:53 +00:00
|
|
|
'server' => AccessingValidServer::class,
|
2017-10-29 17:37:25 +00:00
|
|
|
'subuser.auth' => AuthenticateAsSubuser::class,
|
2017-10-29 20:57:43 +00:00
|
|
|
'admin' => AdminAuthenticate::class,
|
2017-11-04 22:16:44 +00:00
|
|
|
'daemon-old' => OldDaemonAuthenticate::class,
|
2017-10-29 20:57:43 +00:00
|
|
|
'csrf' => VerifyCsrfToken::class,
|
|
|
|
'throttle' => ThrottleRequests::class,
|
|
|
|
'can' => Authorize::class,
|
|
|
|
'bindings' => SubstituteBindings::class,
|
|
|
|
'recaptcha' => VerifyReCaptcha::class,
|
2018-05-31 14:40:18 +00:00
|
|
|
'node.maintenance' => MaintenanceMiddleware::class,
|
2017-10-19 03:32:19 +00:00
|
|
|
|
|
|
|
// Server specific middleware (used for authenticating access to resources)
|
|
|
|
//
|
2018-05-13 14:50:56 +00:00
|
|
|
// These are only used for individual server authentication, and not global
|
2017-10-19 03:32:19 +00:00
|
|
|
// actions from other resources. They are defined in the route files.
|
|
|
|
'server..database' => DatabaseBelongsToServer::class,
|
|
|
|
'server..subuser' => SubuserBelongsToServer::class,
|
|
|
|
'server..schedule' => ScheduleBelongsToServer::class,
|
2018-02-25 21:30:56 +00:00
|
|
|
|
|
|
|
// API Specific Middleware
|
|
|
|
'api..key' => AuthenticateKey::class,
|
2015-12-06 18:58:49 +00:00
|
|
|
];
|
|
|
|
}
|