php - Zend 2 Authentication Service Session for multiple sub domains -


i have 2 sub-domains , trying authenticate user via either sub-domains.

scenario: sub domains: abc.example.com, xyz.example.com

user can login (login form) either of 2 domains. authentication done abc.example.com (ie. request sent abc.example.com only).

when user submits form xyz, request sent abc , authentication done. upon successful login, page redirected xyz.

now xyz creates session on xyz , ok abc can't seems find created session during authentication.

any appreciated.

you can using 2 authentication storage, 1 each subdomain

create 2 authentication storage , 1 authentication service in module.config way

public function getserviceconfig() {     $subdomainabc = "abc.example.com";     $subdomainxyz = "xyz.example.com";     $address = ''; // correct address here      $authenticationservice = function($sm){         // declare , return authentication service here     };      if($address === $subdomainabc) {         return array(             'factories' => array(                 'authenticationstorage' => function(){                     return new authenticationstorageabc("abcauthnamespace");                 },                 'authenticationservice' => $authenticationservice                )         );     } else {           return array(             'factories' => array(                 'authenticationstorage' => function(){                     return new authenticationstoragexyz("xyzauthnamespace");                 },                 'authenticationservice' => $authenticationservice                )         );     } } 

the authentication storage return correct session service accordingly sub domain.

hope helps someone


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -