firefly-iii/app/Http/Kernel.php

196 lines
6.4 KiB
PHP
Raw Normal View History

<?php
/**
* Kernel.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
2016-02-05 05:08:25 -06:00
declare(strict_types = 1);
namespace FireflyIII\Http;
2015-02-05 21:39:52 -06:00
use FireflyIII\Http\Middleware\Authenticate;
use FireflyIII\Http\Middleware\AuthenticateTwoFactor;
2016-01-09 08:39:02 -06:00
use FireflyIII\Http\Middleware\Binder;
use FireflyIII\Http\Middleware\EncryptCookies;
2016-04-03 00:07:17 -05:00
use FireflyIII\Http\Middleware\IsAdmin;
use FireflyIII\Http\Middleware\Range;
use FireflyIII\Http\Middleware\RedirectIfAuthenticated;
use FireflyIII\Http\Middleware\RedirectIfTwoFactorAuthenticated;
use FireflyIII\Http\Middleware\Sandstorm;
use FireflyIII\Http\Middleware\VerifyCsrfToken;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
2016-09-15 23:40:45 -05:00
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
2015-02-05 21:39:52 -06:00
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
2016-09-15 23:40:45 -05:00
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
2015-02-05 21:39:52 -06:00
/**
* Class Kernel
*
* @package FireflyIII\Http
*/
2015-02-06 12:33:31 -06:00
class Kernel extends HttpKernel
{
2016-09-15 23:40:45 -05:00
2016-04-08 07:44:53 -05:00
/**
* The bootstrap classes for the application.
*
2016-09-15 23:40:45 -05:00
* Next upgrade verify these are the same.
2016-04-08 07:44:53 -05:00
*
* @var array
*/
2016-04-25 11:43:09 -05:00
protected $bootstrappers
= [
2017-01-30 09:21:01 -06:00
'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables',
2016-04-25 11:43:09 -05:00
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
2017-01-30 09:27:33 -06:00
//'FireflyIII\Bootstrap\ConfigureLogging',
2016-04-25 11:43:09 -05:00
'Illuminate\Foundation\Bootstrap\HandleExceptions',
'Illuminate\Foundation\Bootstrap\RegisterFacades',
'Illuminate\Foundation\Bootstrap\RegisterProviders',
'Illuminate\Foundation\Bootstrap\BootProviders',
];
2016-04-08 07:44:53 -05:00
2015-02-06 12:33:31 -06:00
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
2015-02-06 12:33:31 -06:00
* @var array
*/
protected $middleware
= [
CheckForMaintenanceMode::class,
2015-02-06 12:33:31 -06:00
];
2015-02-05 21:39:52 -06:00
2015-02-06 12:33:31 -06:00
/**
* The application's route middleware groups.
2015-02-06 12:33:31 -06:00
*
* @var array
*/
protected $middlewareGroups
2015-02-06 12:33:31 -06:00
= [
2016-03-29 05:14:01 -05:00
// does not check login
// does not check 2fa
// does not check activation
2016-03-29 09:16:14 -05:00
'web' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
2016-09-15 23:40:45 -05:00
SubstituteBindings::class,
],
2016-03-29 05:23:10 -05:00
// MUST NOT be logged in. Does not care about 2FA or confirmation.
2016-03-29 09:16:14 -05:00
'user-not-logged-in' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
2016-09-15 23:40:45 -05:00
SubstituteBindings::class,
2016-03-29 05:23:10 -05:00
RedirectIfAuthenticated::class,
2016-01-09 00:46:11 -06:00
],
2016-03-29 05:23:10 -05:00
// MUST be logged in.
// MUST NOT have 2FA
// don't care about confirmation:
2016-03-29 09:16:14 -05:00
'user-logged-in-no-2fa' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
2016-09-15 23:40:45 -05:00
SubstituteBindings::class,
Authenticate::class,
RedirectIfTwoFactorAuthenticated::class,
],
2016-03-29 06:45:18 -05:00
// MUST be logged in
// don't care about 2fa
// don't care about confirmation.
2016-03-29 09:16:14 -05:00
'user-simple-auth' => [
Sandstorm::class,
2016-03-29 06:45:18 -05:00
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
2016-09-15 23:40:45 -05:00
SubstituteBindings::class,
2016-03-29 06:45:18 -05:00
Authenticate::class,
],
2016-03-29 05:23:10 -05:00
// MUST be logged in
// MUST have 2fa
// MUST be confirmed.
// (this group includes the other Firefly middleware)
2016-03-29 09:16:14 -05:00
'user-full-auth' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
2016-09-15 23:40:45 -05:00
SubstituteBindings::class,
Authenticate::class,
AuthenticateTwoFactor::class,
Range::class,
2016-01-09 08:39:02 -06:00
Binder::class,
2016-01-09 00:46:11 -06:00
],
2016-04-03 00:07:17 -05:00
// MUST be logged in
// MUST have 2fa
// MUST be confirmed.
// MUST have owner role
// (this group includes the other Firefly middleware)
2016-04-25 11:43:09 -05:00
'admin' => [
Sandstorm::class,
2016-04-03 00:07:17 -05:00
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
2016-09-15 23:40:45 -05:00
SubstituteBindings::class,
2016-04-03 00:07:17 -05:00
Authenticate::class,
AuthenticateTwoFactor::class,
IsAdmin::class,
Range::class,
Binder::class,
],
2015-03-28 00:19:09 -05:00
2016-09-15 23:40:45 -05:00
'api' => [
'throttle:60,1',
2016-09-15 23:40:45 -05:00
'bindings',
],
2015-02-06 12:33:31 -06:00
];
2015-02-05 21:39:52 -06:00
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware
= [
'auth' => Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class,
2016-09-15 23:40:45 -05:00
'bindings' => SubstituteBindings::class,
'can' => Authorize::class,
'guest' => RedirectIfAuthenticated::class,
'throttle' => ThrottleRequests::class,
'range' => Range::class,
];
2015-02-05 21:39:52 -06:00
}