You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$app->add('authorization');
$app->add('authentication');
... another middleware to remove content extension from URI(.json, .xml...) ...
$app->add(Middleware::formatNegotiator());
$app->add(Middleware::trailingSlash());
My last Middleware "authorization" is ACL service based on routes Names, so it requires 'determineRouteBeforeAppMiddleware' => true, in config.
But if I determine routes before a call to my middlewares, it can't work. e.g :
URI : GET /api/resource/list.json/
Route : $app->get('/resource/list')
URI doesn't match my route pattern.
The workaround I currently use is to execute code inside Slim\App::dispatchRouterAndPrepareRoute() protected method as a last middleware before Authentification, but maybe there could be a cleaner way to do this without duplication of code or Slim\App class extend.
Any thoughts about this ?
The text was updated successfully, but these errors were encountered:
Extending App is the way to do this at the moment. I expect that in 4.0 we'll convert the route determination logic to middleware so that you can put middleware before and after it.
Remove determineRouteBeforeDispatch and make routing a middleware that can be placed where you want it to be. If you don't add it yourself, we would add it immediately before dispatch.
Here is the process I would follow :
My last Middleware "authorization" is ACL service based on routes Names, so it requires
'determineRouteBeforeAppMiddleware' => true,
in config.But if I determine routes before a call to my middlewares, it can't work. e.g :
URI :
GET /api/resource/list.json/
Route :
$app->get('/resource/list')
URI doesn't match my route pattern.
The workaround I currently use is to execute code inside
Slim\App::dispatchRouterAndPrepareRoute()
protected method as a last middleware before Authentification, but maybe there could be a cleaner way to do this without duplication of code or Slim\App class extend.Any thoughts about this ?
The text was updated successfully, but these errors were encountered: