Browse Source

Include CSRF middleware in base install for easy override / whitelist.

This makes it easy to skip CSRF verification for things like web hooks
and such from GitHub / Stripe.
Taylor Otwell 9 years ago
parent
commit
c3e3d9dc4b
2 changed files with 21 additions and 1 deletions
  1. 1 1
      app/Http/Kernel.php
  2. 20 0
      app/Http/Middleware/VerifyCsrfToken.php

+ 1 - 1
app/Http/Kernel.php

@@ -15,7 +15,7 @@ class Kernel extends HttpKernel {
 		'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
 		'Illuminate\Session\Middleware\StartSession',
 		'Illuminate\View\Middleware\ShareErrorsFromSession',
-		'Illuminate\Foundation\Http\Middleware\VerifyCsrfToken',
+		'App\Http\Middleware\VerifyCsrfToken',
 	];
 
 	/**

+ 20 - 0
app/Http/Middleware/VerifyCsrfToken.php

@@ -0,0 +1,20 @@
+<?php namespace App\Http\Middleware;
+
+use Closure;
+use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
+
+class VerifyCsrfToken extends BaseVerifier {
+
+	/**
+	 * Handle an incoming request.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @param  \Closure  $next
+	 * @return mixed
+	 */
+	public function handle($request, Closure $next)
+	{
+		return parent::handle($request, $next);
+	}
+
+}