Kernel.php 2.96 KB
Newer Older
1
2
3
4
<?php

namespace App\Http;

Jacob Priddy's avatar
Jacob Priddy committed
5
use Fruitcake\Cors\HandleCors;
Jacob Priddy's avatar
Jacob Priddy committed
6
7
8
use App\Http\Middleware\TrimStrings;
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\TrustProxies;
9
use App\Http\Middleware\AddAjaxHeader;
Jacob Priddy's avatar
Jacob Priddy committed
10
11
12
13
use App\Http\Middleware\EncryptCookies;
use App\Http\Middleware\VerifyCsrfToken;
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Auth\Middleware\RequirePassword;
Jacob Priddy's avatar
Jacob Priddy committed
14
use Illuminate\Http\Middleware\SetCacheHeaders;
Jacob Priddy's avatar
Jacob Priddy committed
15
16
use Illuminate\Session\Middleware\StartSession;
use App\Http\Middleware\CheckForMaintenanceMode;
17
use App\Http\Middleware\RedirectIfAuthenticated;
Jacob Priddy's avatar
Jacob Priddy committed
18
use Illuminate\Routing\Middleware\ThrottleRequests;
Jacob Priddy's avatar
Jacob Priddy committed
19
use Illuminate\Foundation\Http\Kernel as HttpKernel;
Jacob Priddy's avatar
Jacob Priddy committed
20
21
use Illuminate\Routing\Middleware\ValidateSignature;
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
Jacob Priddy's avatar
Jacob Priddy committed
22
23
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\View\Middleware\ShareErrorsFromSession;
Jacob Priddy's avatar
Jacob Priddy committed
24
use Illuminate\Session\Middleware\AuthenticateSession;
Jacob Priddy's avatar
Jacob Priddy committed
25
26
27
28
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
29
30
31
32
33
34
35
36
37
38
39

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
Jacob Priddy's avatar
Jacob Priddy committed
40
        TrustProxies::class,
Jacob Priddy's avatar
Jacob Priddy committed
41
        HandleCors::class,
Jacob Priddy's avatar
Jacob Priddy committed
42
43
44
45
        CheckForMaintenanceMode::class,
        ValidatePostSize::class,
        TrimStrings::class,
        ConvertEmptyStringsToNull::class,
Jacob Priddy's avatar
Jacob Priddy committed
46
        EncryptCookies::class,
47
48
49
50
51
52
53
54
55
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
Jacob Priddy's avatar
Jacob Priddy committed
56
57
            AddQueuedCookiesToResponse::class,
            StartSession::class,
Jacob Priddy's avatar
Jacob Priddy committed
58
            AuthenticateSession::class,
Jacob Priddy's avatar
Jacob Priddy committed
59
60
61
            ShareErrorsFromSession::class,
            VerifyCsrfToken::class,
            SubstituteBindings::class,
62
63
64
        ],

        'api' => [
65
            AddAjaxHeader::class,
Jacob Priddy's avatar
Jacob Priddy committed
66
            // Throttle after 100 requests within 2 minutes
67
//            'throttle:500,5',
68
            SubstituteBindings::class,
69
        ],
Jacob Priddy's avatar
Jacob Priddy committed
70
71

        'door' => [
72
            AddAjaxHeader::class,
73
            'auth:door',
74
            SubstituteBindings::class,
Jacob Priddy's avatar
Jacob Priddy committed
75
        ],
76
77
78
79
80
81
82
83
84
85
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
Jacob Priddy's avatar
Jacob Priddy committed
86
87
88
89
90
91
92
        'auth' => Authenticate::class,
        'auth.basic' => AuthenticateWithBasicAuth::class,
        'bindings' => SubstituteBindings::class,
        'cache.headers' => SetCacheHeaders::class,
        'can' => Authorize::class,
        'signed' => ValidateSignature::class,
        'throttle' => ThrottleRequests::class,
93
        'ajax' => AddAjaxHeader::class,
94
        'guest' => RedirectIfAuthenticated::class,
95
96
    ];
}