Zend Framework 2 - Global check for authentication with ZFCUser

后端 未结 5 1384
误落风尘
误落风尘 2020-12-05 08:20

I installed ZFCUser successfully. Now I wonder if there is a way to globally check for authentication.

As outlined in the wiki there ar

5条回答
  •  一生所求
    2020-12-05 09:06

    Another option might be to create your own abstract controller superclass and implement the onDispatch() method like this:

    public function onDispatch(MvcEvent $e) 
    {
        // check authentication here
    
        return parent::onDispatch($e);
    }
    

    You can implement a whitelist there too :).

提交回复
热议问题