0
votes

Trying to do site with administration on Zend Framework 2, set the authorization at mysite / admin / login. How to deny access if the authorization is not completed all the way after mysite / admin / ...?

In ZF1 for this I used «BaseController», but ZF2 want to check session in class Module.

class Module
{
    public function onBootstrap($e)
    {
        $app = $e->getApplication();
        $sm = $app->getServiceManager();
        $config = $sm->get('Configuration');

        // DB Adapter
        $adapter = $sm->get('Zend\Db\Adapter\Adapter');
        GlobalAdapterFeature::setStaticAdapter($adapter);

        // Session
        $sessionConfig = new SessionConfig();
        $sessionConfig->setOptions($config['session']);
        $sessionManager = new SessionManager($sessionConfig, null, null);
        Container::setDefaultManager($sessionManager);
        $sessionManager->start();
    }
}

Tell me whether I want to do? And in which direction to look?

1
possible duplicate of zend session and zend authchris

1 Answers

0
votes

Try to use Zendframe Work 2 EventManager.