php - Using Zend\Authenticate outside of ZF2 with sub-domains -
i'm trying seemingly simple task of setting session cookie domain in application uses zend\authentication. i'm using zend\authentication\storage\session storage, i'm trying figure out how set cookie_domain session want use same session variables across multiple sub-domains. not zf2 application, i'm using zend\authentication separate component.
here code:
$authservice = new \zend\authentication\authenticationservice(); $config = new \zend\session\config\standardconfig(); $config->setoptions(array( 'cookie_domain' => '.jt.martyndev', )); $manager = new \zend\session\sessionmanager($config); $storage = new \zend\authentication\storage\session('jt_sso', null, $manager); $authservice->setstorage($storage);
firstly, got error:
fatal error: class 'zend\validator\hostname' not found in /var/www/jt_sso/vendor/zendframework/zend-session/src/config/standardconfig.php on line 473
seems strange have install zend\validator tried anyway, , error went away. authentication wasn't working anymore, can imagine i'm misconfigured things. need add set cookie domain. here original code before attempting this:
$authservice = new \zend\authentication\authenticationservice(); $storage = new \zend\authentication\storage\session('jt_sso', null, $manager); $authservice->setstorage($storage);
ideally wanna set configuration in simplest proper way can't find mention of relation authentication (and seems setstorage accept instance of zend\authentication\storage\session). appreciate help, thanks
Comments
Post a Comment