1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Http/Kernel.php

197 lines
6.6 KiB
PHP
Raw Normal View History

2018-10-04 19:10:43 +02:00
<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 05:32:07 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 05:32:07 +02:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2019-05-11 05:32:07 +02:00
*/
2018-10-04 19:10:43 +02:00
namespace App\Http;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\ApiSecretCheck;
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\CheckClientExistence;
use App\Http\Middleware\CheckForMaintenanceMode;
use App\Http\Middleware\ClientPortalEnabled;
use App\Http\Middleware\ContactAccount;
use App\Http\Middleware\ContactKeyLogin;
use App\Http\Middleware\ContactRegister;
use App\Http\Middleware\ContactSetDb;
use App\Http\Middleware\ContactTokenAuth;
2020-10-28 11:10:49 +01:00
use App\Http\Middleware\Cors;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\EncryptCookies;
2023-03-20 10:17:04 +01:00
use App\Http\Middleware\Locale;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\PasswordProtection;
use App\Http\Middleware\PhantomSecret;
use App\Http\Middleware\QueryLogging;
use App\Http\Middleware\RedirectIfAuthenticated;
use App\Http\Middleware\SessionDomains;
use App\Http\Middleware\SetDb;
use App\Http\Middleware\SetDbByCompanyKey;
use App\Http\Middleware\SetDocumentDb;
use App\Http\Middleware\SetDomainNameDb;
2023-03-20 10:17:04 +01:00
use App\Http\Middleware\SetEmailDb;
use App\Http\Middleware\SetInviteDb;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\SetWebDb;
use App\Http\Middleware\TokenAuth;
2020-10-28 11:10:49 +01:00
use App\Http\Middleware\TrimStrings;
use App\Http\Middleware\TrustProxies;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\UrlSetDb;
2021-02-25 22:06:43 +01:00
use App\Http\Middleware\UserVerified;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\ValidateSignature;
use App\Http\Middleware\VendorContactKeyLogin;
2022-06-13 11:59:24 +02:00
use App\Http\Middleware\VendorLocale;
2020-10-28 11:10:49 +01:00
use App\Http\Middleware\VerifyCsrfToken;
2023-10-26 04:57:44 +02:00
use App\Http\Middleware\VerifyHash;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
2020-10-28 11:10:49 +01:00
use Illuminate\Auth\Middleware\Authorize;
2023-03-20 10:17:04 +01:00
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
2023-10-26 04:57:44 +02:00
use Illuminate\Foundation\Http\Kernel as HttpKernel;
2023-03-20 10:17:04 +01:00
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
2023-10-26 04:57:44 +02:00
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Http\Middleware\SetCacheHeaders;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
2018-10-04 19:10:43 +02:00
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
2024-06-16 06:35:56 +02:00
* @var array<int,string>
2018-10-04 19:10:43 +02:00
*/
protected $middleware = [
2020-10-28 11:10:49 +01:00
CheckForMaintenanceMode::class,
ValidatePostSize::class,
TrimStrings::class,
ConvertEmptyStringsToNull::class,
TrustProxies::class,
2022-01-28 00:06:26 +01:00
Cors::class,
2018-10-04 19:10:43 +02:00
];
/**
* The application's route middleware groups.
*
2024-06-16 06:35:56 +02:00
* @var array<string, array<int,string>>
2018-10-04 19:10:43 +02:00
*/
protected $middlewareGroups = [
'web' => [
2022-01-16 01:22:37 +01:00
SessionDomains::class,
2020-10-28 11:10:49 +01:00
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
QueryLogging::class,
2018-10-04 19:10:43 +02:00
],
'api' => [
'bindings',
2019-03-26 05:46:08 +01:00
'query_logging',
2018-10-04 19:10:43 +02:00
],
2019-07-08 02:08:57 +02:00
'contact' => [
'throttle:60,1',
'bindings',
'query_logging',
],
'client' => [
2022-01-15 05:58:33 +01:00
SessionDomains::class,
2020-10-28 11:10:49 +01:00
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
2021-06-02 05:14:40 +02:00
// \Illuminate\Session\Middleware\AuthenticateSession::class,
2020-10-28 11:10:49 +01:00
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
QueryLogging::class,
],
2020-07-28 13:19:51 +02:00
'shop' => [
2020-10-22 12:14:14 +02:00
'throttle:120,1',
2020-07-28 13:19:51 +02:00
'bindings',
'query_logging',
],
2018-10-04 19:10:43 +02:00
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
2024-06-16 06:35:56 +02:00
* @var array<string,string>
2018-10-04 19:10:43 +02:00
*/
2023-08-21 01:51:56 +02:00
protected $middlewareAliases = [
2020-10-28 11:10:49 +01:00
'auth' => Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class,
'bindings' => SubstituteBindings::class,
'cache.headers' => SetCacheHeaders::class,
'can' => Authorize::class,
2021-12-10 22:32:24 +01:00
'cors' => Cors::class,
2020-10-28 11:10:49 +01:00
'guest' => RedirectIfAuthenticated::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
2020-10-28 11:10:49 +01:00
'verified' => EnsureEmailIsVerified::class,
'query_logging' => QueryLogging::class,
'token_auth' => TokenAuth::class,
'api_secret_check' => ApiSecretCheck::class,
'contact_token_auth' => ContactTokenAuth::class,
'contact_db' => ContactSetDb::class,
'contact_account' => ContactAccount::class,
2020-10-28 11:10:49 +01:00
'domain_db' => SetDomainNameDb::class,
'email_db' => SetEmailDb::class,
'invite_db' => SetInviteDb::class,
'password_protected' => PasswordProtection::class,
'portal_enabled' => ClientPortalEnabled::class,
'url_db' => UrlSetDb::class,
'web_db' => SetWebDb::class,
'api_db' => SetDb::class,
'company_key_db' => SetDbByCompanyKey::class,
'locale' => Locale::class,
2022-06-13 11:59:24 +02:00
'vendor_locale' => VendorLocale::class,
2021-06-05 12:59:53 +02:00
'contact_register' => ContactRegister::class,
2022-07-09 04:15:35 +02:00
'verify_hash' => VerifyHash::class,
2020-10-28 11:10:49 +01:00
'phantom_secret' => PhantomSecret::class,
'contact_key_login' => ContactKeyLogin::class,
2022-08-04 08:22:48 +02:00
'vendor_contact_key_login' => VendorContactKeyLogin::class,
'check_client_existence' => CheckClientExistence::class,
2021-02-25 22:06:43 +01:00
'user_verified' => UserVerified::class,
2021-07-01 23:23:25 +02:00
'document_db' => SetDocumentDb::class,
2022-01-16 01:22:37 +01:00
'session_domain' => SessionDomains::class,
2023-03-20 10:17:04 +01:00
//we dyanamically add the throttle middleware in RouteServiceProvider
2018-10-04 19:10:43 +02:00
];
protected $middlewarePriority = [
EncryptCookies::class,
StartSession::class,
2022-01-15 05:58:33 +01:00
SessionDomains::class,
2021-06-02 01:07:53 +02:00
Cors::class,
2021-05-15 08:54:27 +02:00
SetDomainNameDb::class,
SetDb::class,
SetWebDb::class,
UrlSetDb::class,
ContactSetDb::class,
SetEmailDb::class,
SetInviteDb::class,
SetDbByCompanyKey::class,
TokenAuth::class,
ContactTokenAuth::class,
2021-05-14 00:29:52 +02:00
ContactKeyLogin::class,
2021-05-14 00:03:57 +02:00
Authenticate::class,
ContactRegister::class,
PhantomSecret::class,
CheckClientExistence::class,
ClientPortalEnabled::class,
PasswordProtection::class,
Locale::class,
SubstituteBindings::class,
ContactAccount::class,
];
2023-03-20 10:17:04 +01:00
2018-10-04 19:10:43 +02:00
}