I read the MVC-Middleware document and run simple middleware to check user authentication.
First, I understand, after running the middleware step in the next step handler should run as a single action controller, and
AbstractActionController is not acceptable in the handler, and it child of Psr RequestHandlerInterface
Now I have some questions before using this method in my modules:
1- Is it’s the true way and I understand true?
2- If it’s true, which one is better? Use middleware and Psr handler or use Laminas controller as a child of
AbstractActionController, which one is better and more powerful?
3- If I use Laminas controller, for some middleware use-case (like checking user access token) what should I do? call service at the start of each action?
Before reading MVC-Middleware I thought, I can write some general middleware to check User, ACL, or RBAC, request params, security, and some other dependency. But I do not know what is the best way to do this now
Please share your idea and experience with me