I have set up two user account modules - administrator and customer. My current set-up means if you log into administrator my app thinks you're logged in as a customer also. The solution I've decided upon is to create a session where the cookie path is based on the administrator url, i.e. set the cookie_path
as /administrator
.
In my administrator Module.php
onBootstrap
function I have included:
$sessionConfig = new SessionConfig();
$sessionConfig->setOptions(['cookie_path' => '/administrator']);
$sessionManager = new SessionManager($sessionConfig, null, null);
Container::setDefaultManager($sessionManager);
which sets the cookie path, but this affects the entire application; i.e. the rest of the site is cookie free because the urls do not begin with /administrator
.
How do I set up my application so that the cookie_path
for my administrator module is different to the rest of the application?
[edit]
What I am after is two cookies - one for admin path, and one for the rest of the application.
[edit]
I am using Zend\Authentication\AuthenticationService
for ACL. What I am trying to achieve is for a user to log into the customer section of the website and do stuff, and then log into the admin panel to do stuff.
As an example, Magento will set one cookie when dealing with customer account log in, then another cookie when dealing with admin account log in.
How do I set up Zend\Authentication\AuthenticationService
to use a second session or cookie based on url / module?