Closed trendschau closed 2 years ago
Not sure if it is the place here, but I am looking for a way to add the csrf-middleware conditionally in slim 4 because my application does not start sessions in all cases.
I start the session in a middleware conditionally:
# add session $app->add(new CreateSession($session_segments, ltrim($routepath, '/') ));
Then I add csrf protection to the container with the next middleware in case a session has been started:
# if session add csrf protection $app->add(new CsrfProtection($container, $responseFactory));
And now instead of ...
// Register Middleware To Be Executed On All Routes $app->add('csrf');
... I want to add it only if session has started. Maybe complete misconception on my side ?
sorry for that question, it does not make sense that way and I will close it.
Not sure if it is the place here, but I am looking for a way to add the csrf-middleware conditionally in slim 4 because my application does not start sessions in all cases.
I start the session in a middleware conditionally:
Then I add csrf protection to the container with the next middleware in case a session has been started:
And now instead of ...
... I want to add it only if session has started. Maybe complete misconception on my side ?