zfcuser

Zend Framework 2 - Global check for authentication with ZFCUser

与世无争的帅哥 提交于 2019-11-27 19:52:08
I installed ZFCUser successfully. Now I wonder if there is a way to globally check for authentication. As outlined in the wiki there are several ways to check for auth. They all work but do I have to put the check-if-clause really in every single action? All my sites should be only accessable when beeing logged in and if not, you should be rerouted to the login page. Does anybody know if there's a central place where I can put this logic? To be honest, I don't think it is a good idea to block every page for a non-authenticated user. How would you access the login page? That said, you must know

Simple ZF2 Unit Tests for a controller using ZfcUser

寵の児 提交于 2019-11-27 16:30:43
问题 I'm having issues trying to unit test an action which uses ZfcUser for authentication. I need some way to mock the ZfcUser Controller plugin but I'm not so sure how to do this. I've managed to successfully produce some unit tests for tables and models but the controller requires a lot of injected objects and is causing problems. Does anyone know how to set up the ZfcUser mocks to successfully unit test a controller? Here is my test (copied from the ZF2 tutorial): <?php namespace SmsTest

ZF2: Custom user mapper for ZfcUser module

时光总嘲笑我的痴心妄想 提交于 2019-11-27 15:15:06
问题 I`ve added module ZfcUser on my Zend Framework 2 application. But I have to use existing database table, which has slightly different column names than the default table structure for ZfcUser. In ZfcUser wiki page it says that it is possible to use custom mapper if my model doesn`t conform to the provided interface. And since my database table is different than default, my user entity class is also different than standard ZfcUser\Entity\User. But I can tell ZfcUser to work with my own class