How Skip Authorization check ($this->Authorization->skipAuthorization()) when Request Authorization Middleware is used?
I have a system in Cakephp 4x based on the user role and I use the Authorization Middleware, but many actions must be accessible to all users and skipAuthorization not working for these actions;
use Authorization\Policy\RequestPolicyInterface;
use Cake\Http\ServerRequest;
class RequestPolicy implements RequestPolicyInterface
{
public function canAccess($identity, ServerRequest $request)
{
$prefix = $request->getParam(‘prefix’);
if(empty($prefix)) {
return true;
}
}
this worket for me