Browse Source

Update HttpKernel to use Authenticate middleware under App namespace

The `Authenticate` middleware is intended to be called in a specific order before applying developer-listed middleware. In 5.7, it was changed to `App\Http\Middleware\Authenticate` but the priority still lists it as living under `Illuminate\Auth\Middleware\Authenticate`.

This proposed fix moves that priority array to `App\Http\Kernel` and changes the reference to the userland class.
Matt Hollis 5 years ago
parent
commit
b354a35272
1 changed files with 16 additions and 0 deletions
  1. 16 0
      app/Http/Kernel.php

+ 16 - 0
app/Http/Kernel.php

@@ -61,4 +61,20 @@ class Kernel extends HttpKernel
         'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
         'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
     ];
+    
+    /**
+     * The priority-sorted list of middleware.
+     *
+     * Forces the listed middleware to always be in the given order.
+     *
+     * @var array
+     */    
+        protected $middlewarePriority = [
+        \Illuminate\Session\Middleware\StartSession::class,
+        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
+        \App\Http\Middleware\Authenticate::class,
+        \Illuminate\Session\Middleware\AuthenticateSession::class,
+        \Illuminate\Routing\Middleware\SubstituteBindings::class,
+        \Illuminate\Auth\Middleware\Authorize::class,
+    ];
 }