CakePHP 3 - How do I block pages from non logged in users and redirect them to the login page?


How can I block several pages I've made (E.g. dashboard.ctp crm.ctp) from users that are not logged in using the auth component and redirect them to the Login page if they try to access the above mentioned pages?

This is my AppController.

public function beforeFilter(Event $event)   {   $this->Auth->allow(['display']);   }
public function initialize()  {   parent::initialize();
$this->loadComponent('RequestHandler');   $this->loadComponent('Flash');   $this->loadComponent('Auth' [   'authenticate' => [   'Form' => [   'fields' => [   'username' => 'name'