I am new in ZendFramework2, need to check identity of user at once. Right now I am checking in every controller action (sample code in action for checking identity)
if (! $this->getServiceLocator()
->get('AuthService')->hasIdentity()){
return $this->redirect()->toRoute('login');
}
this is not the good practice so help me to reduce to call once for all the action() method. Unauthorised user will redirect to login form
Thanks