VerifyCsrfToken

class VerifyCsrfToken (View source)

Properties

protected Application $app The application instance.
protected Encrypter $encrypter The encrypter implementation.
protected array $except The URIs that should be excluded from CSRF verification.

Methods

void __construct(Application $app, Encrypter $encrypter)

Create a new middleware instance.

mixed handle(Request $request, Closure $next)

Handle an incoming request.

bool shouldPassThrough(Request $request)

Determine if the request has a URI that should pass through CSRF verification.

bool runningUnitTests()

Determine if the application is running unit tests.

bool tokensMatch(Request $request)

Determine if the session and input CSRF tokens match.

Response addCookieToResponse(Request $request, Response $response)

Add the CSRF token to the response cookies.

bool isReading(Request $request)

Determine if the HTTP request uses a ‘read’ verb.

Details

void __construct(Application $app, Encrypter $encrypter)

Create a new middleware instance.

Parameters

Application $app
Encrypter $encrypter

Return Value

void

mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

Exceptions

TokenMismatchException

protected bool shouldPassThrough(Request $request)

Determine if the request has a URI that should pass through CSRF verification.

Parameters

Request $request

Return Value

bool

protected bool runningUnitTests()

Determine if the application is running unit tests.

Return Value

bool

protected bool tokensMatch(Request $request)

Determine if the session and input CSRF tokens match.

Parameters

Request $request

Return Value

bool

protected Response addCookieToResponse(Request $request, Response $response)

Add the CSRF token to the response cookies.

Parameters

Request $request
Response $response

Return Value

Response

protected bool isReading(Request $request)

Determine if the HTTP request uses a ‘read’ verb.

Parameters

Request $request

Return Value

bool

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.2/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.html