misc_pterodactyl-panel/app/Http/Kernel.php

111 lines
4 KiB
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Http;
2017-10-29 20:57:43 +00:00
use Fideloper\Proxy\TrustProxies;
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Auth\Middleware\Authenticate;
use Pterodactyl\Http\Middleware\TrimStrings;
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;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
2017-11-19 20:05:13 +00:00
use Pterodactyl\Http\Middleware\API\AuthenticateKey;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Pterodactyl\Http\Middleware\AccessingValidServer;
2017-11-19 20:05:13 +00:00
use Pterodactyl\Http\Middleware\API\SetSessionDriver;
2017-10-29 20:57:43 +00:00
use Illuminate\View\Middleware\ShareErrorsFromSession;
use Pterodactyl\Http\Middleware\RedirectIfAuthenticated;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
2017-11-19 20:05:13 +00:00
use Pterodactyl\Http\Middleware\API\AuthenticateIPAccess;
2017-11-04 22:16:44 +00:00
use Pterodactyl\Http\Middleware\Daemon\DaemonAuthenticate;
2017-10-29 20:57:43 +00:00
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Pterodactyl\Http\Middleware\API\HasPermissionToResource;
2017-10-29 17:37:25 +00:00
use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser;
use Pterodactyl\Http\Middleware\Server\SubuserBelongsToServer;
2017-10-29 20:57:43 +00:00
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
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-11-04 22:16:44 +00:00
use Pterodactyl\Http\Middleware\DaemonAuthenticate as OldDaemonAuthenticate;
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,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
TrimStrings::class,
TrustProxies::class,
];
/**
* 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,
],
'api' => [
'throttle:60,1',
2017-11-19 20:05:13 +00:00
SubstituteBindings::class,
SetSessionDriver::class,
AuthenticateKey::class,
AuthenticateIPAccess::class,
],
'daemon' => [
SubstituteBindings::class,
2017-11-04 22:16:44 +00:00
DaemonAuthenticate::class,
],
];
/**
* 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,
'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,
// API specific middleware.
'api..user_level' => HasPermissionToResource::class,
// Server specific middleware (used for authenticating access to resources)
//
// These are only used for individual server authentication, and not gloabl
// actions from other resources. They are defined in the route files.
'server..database' => DatabaseBelongsToServer::class,
'server..subuser' => SubuserBelongsToServer::class,
'server..schedule' => ScheduleBelongsToServer::class,
];
}