Custom Middleware
Created 7 years ago by josefpreeoMy final objective is to create a POST route that doesn't require the csrftoken check.
I created a route with the reference to a custom Middleware:
'checkout/ipn' => [ 'uses' => 'Preeo\CustomPageHandlerExtension\Http\Controller\CheckoutController@ipn', 'verb' => 'post', 'middleware' => 'Preeo\LearningSystemModule\Http\Middleware\VerifyCsrfToken' ]
and the Middleware extends Anomaly\Streams\Platform\Http\Middleware\VerifyCsrfToken
and has the following code:
`
class VerifyCsrfToken extends BaseVerifier
{
/**
- The URIs that should be excluded from CSRF verification.
- @var array / protected $except = [ 'checkout/ipn/' ]; } ` Unfortunately this is still not working though - any help?
ryanthompson
—
7 years ago
You can also add "csrf" => false
to the route
Checkout this: https://github.com/anomalylabs/streams-platform/blob/1.2/resources/config/security.php#L14
And this is another method: https://github.com/anomalylabs/streams-platform/blob/1.2/src/Http/Controller/ResourceController.php#L23
You could also do an unset for the above method.