2016-01-08 09:01:21 -06:00
|
|
|
<?php
|
2016-02-05 05:08:25 -06:00
|
|
|
declare(strict_types = 1);
|
2016-01-08 09:01:21 -06:00
|
|
|
|
|
|
|
namespace FireflyIII\Http;
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2016-01-09 01:20:55 -06:00
|
|
|
use FireflyIII\Http\Middleware\Authenticate;
|
2016-03-19 10:22:20 -05:00
|
|
|
use FireflyIII\Http\Middleware\AuthenticateTwoFactor;
|
2016-01-09 08:39:02 -06:00
|
|
|
use FireflyIII\Http\Middleware\Binder;
|
2016-01-09 01:20:55 -06:00
|
|
|
use FireflyIII\Http\Middleware\EncryptCookies;
|
2016-04-03 00:07:17 -05:00
|
|
|
use FireflyIII\Http\Middleware\IsAdmin;
|
2016-03-29 04:55:49 -05:00
|
|
|
use FireflyIII\Http\Middleware\IsConfirmed;
|
|
|
|
use FireflyIII\Http\Middleware\IsNotConfirmed;
|
2016-01-09 01:20:55 -06:00
|
|
|
use FireflyIII\Http\Middleware\Range;
|
|
|
|
use FireflyIII\Http\Middleware\RedirectIfAuthenticated;
|
2016-03-19 10:29:01 -05:00
|
|
|
use FireflyIII\Http\Middleware\RedirectIfTwoFactorAuthenticated;
|
2016-01-09 01:20:55 -06:00
|
|
|
use FireflyIII\Http\Middleware\VerifyCsrfToken;
|
|
|
|
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
|
|
|
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
2015-02-05 21:39:52 -06:00
|
|
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
2016-01-09 01:20:55 -06:00
|
|
|
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
|
|
|
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
|
|
|
use Illuminate\Session\Middleware\StartSession;
|
|
|
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2016-01-09 01:20:55 -06:00
|
|
|
/**
|
|
|
|
* Class Kernel
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Http
|
|
|
|
*/
|
2015-02-06 12:33:31 -06:00
|
|
|
class Kernel extends HttpKernel
|
|
|
|
{
|
2016-04-08 07:44:53 -05:00
|
|
|
/**
|
|
|
|
* The bootstrap classes for the application.
|
|
|
|
*
|
|
|
|
* Next upgrade should verify these are all here.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $bootstrappers = [
|
|
|
|
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
|
|
|
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
|
|
|
'FireflyIII\Bootstrap\ConfigureLogging',
|
|
|
|
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
|
|
|
'Illuminate\Foundation\Bootstrap\RegisterFacades',
|
|
|
|
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
|
|
|
'Illuminate\Foundation\Bootstrap\BootProviders',
|
|
|
|
];
|
|
|
|
|
2015-02-06 12:33:31 -06:00
|
|
|
/**
|
|
|
|
* The application's global HTTP middleware stack.
|
|
|
|
*
|
2016-01-08 09:01:21 -06:00
|
|
|
* These middleware are run during every request to your application.
|
|
|
|
*
|
2015-02-06 12:33:31 -06:00
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $middleware
|
|
|
|
= [
|
2016-01-09 01:20:55 -06:00
|
|
|
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
|
|
|
/**
|
2016-01-08 09:01:21 -06:00
|
|
|
* The application's route middleware groups.
|
2015-02-06 12:33:31 -06:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2016-01-08 09:01:21 -06:00
|
|
|
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' => [
|
2016-01-09 01:20:55 -06:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
2016-01-08 09:01:21 -06:00
|
|
|
],
|
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' => [
|
2016-01-09 01:20:55 -06:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::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' => [
|
2016-01-09 01:20:55 -06:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
Authenticate::class,
|
2016-03-19 10:29:01 -05:00
|
|
|
RedirectIfTwoFactorAuthenticated::class,
|
2016-03-19 10:22:20 -05:00
|
|
|
],
|
2016-03-29 05:23:10 -05:00
|
|
|
// MUST be logged in
|
|
|
|
// MUST have 2FA
|
|
|
|
// MUST NOT have confirmation.
|
2016-03-29 09:16:14 -05:00
|
|
|
'user-logged-in-2fa-no-activation' => [
|
2016-03-29 05:14:01 -05:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
Authenticate::class,
|
2016-03-29 05:23:10 -05:00
|
|
|
AuthenticateTwoFactor::class,
|
|
|
|
IsNotConfirmed::class,
|
2016-03-29 05:14:01 -05:00
|
|
|
],
|
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' => [
|
2016-03-29 06:45:18 -05:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
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' => [
|
2016-03-19 10:22:20 -05:00
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
Authenticate::class,
|
|
|
|
AuthenticateTwoFactor::class,
|
2016-03-29 04:55:49 -05:00
|
|
|
IsConfirmed::class,
|
2016-01-09 01:20:55 -06:00
|
|
|
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)
|
|
|
|
'admin' => [
|
|
|
|
EncryptCookies::class,
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
StartSession::class,
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
Authenticate::class,
|
|
|
|
AuthenticateTwoFactor::class,
|
|
|
|
IsConfirmed::class,
|
|
|
|
IsAdmin::class,
|
|
|
|
Range::class,
|
|
|
|
Binder::class,
|
|
|
|
|
|
|
|
],
|
2015-03-28 00:19:09 -05:00
|
|
|
|
2016-01-08 09:01:21 -06:00
|
|
|
'api' => [
|
|
|
|
'throttle:60,1',
|
|
|
|
],
|
2015-02-06 12:33:31 -06:00
|
|
|
];
|
2015-02-05 21:39:52 -06:00
|
|
|
|
2016-01-08 09:01:21 -06:00
|
|
|
/**
|
|
|
|
* The application's route middleware.
|
|
|
|
*
|
|
|
|
* These middleware may be assigned to groups or used individually.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $routeMiddleware
|
|
|
|
= [
|
2016-01-09 01:20:55 -06:00
|
|
|
'auth' => Authenticate::class,
|
|
|
|
'auth.basic' => AuthenticateWithBasicAuth::class,
|
|
|
|
'guest' => RedirectIfAuthenticated::class,
|
|
|
|
'throttle' => ThrottleRequests::class,
|
|
|
|
'range' => Range::class,
|
2016-01-08 09:01:21 -06:00
|
|
|
];
|
2015-02-05 21:39:52 -06:00
|
|
|
}
|