From 945052508f6c7a00909fd91e5bb9be14d0cbac53 Mon Sep 17 00:00:00 2001 From: Joseph Silber Date: Thu, 26 May 2016 09:30:32 -0400 Subject: [PATCH] Use the Authenticate middleware from core --- app/Http/Kernel.php | 2 +- app/Http/Middleware/Authenticate.php | 52 ---------------------------- 2 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 app/Http/Middleware/Authenticate.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 50516ef26..0a453175f 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -46,7 +46,7 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth' => \Illuminate\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class, diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php deleted file mode 100644 index 23881e7a2..000000000 --- a/app/Http/Middleware/Authenticate.php +++ /dev/null @@ -1,52 +0,0 @@ -authenticate($guards); - - return $next($request); - } - - /** - * Determine if the user is logged in to any of the given guards. - * - * @param array $guards - * @return void - * - * @throws \Illuminate\Auth\AuthenticationException - */ - protected function authenticate(array $guards) - { - if (count($guards) <= 1) { - Auth::guard(array_first($guards))->authenticate(); - - return Auth::shouldUse($guard); - } - - foreach ($guards as $guard) { - if (Auth::guard($guard)->check()) { - return Auth::shouldUse($guard); - } - } - - throw new AuthenticationException; - } -}