I followed the implementation of the Request Authorization Middleware : https://book.cakephp.org/authorization/2/en/request-authorization-middleware.html
My objective is to setup a global security by checking the user role. So i created a RequestPolicy.php with the function canAccess.
It works well however when the session is expired, it still calls the function canAccess which uses $identity which is null because of the expired session so i get an error “Call to a member function getOriginalData() on null” ($identity->getOriginalData()) instead of redirecting me to the login with the redirect param.
I do not understand how it is supposed to handle that case.