@@ -123,16 +123,20 @@ public function authPreDispatch($event)
123123 /** @var \Magento\Framework\App\State $adminAppState */
124124 $ adminAppState = $ objectManager ->get ('Magento\Framework\App\State ' );
125125 $ adminAppState ->setAreaCode (\Magento \Framework \App \Area::AREA_ADMIN );
126+ /** @var \Magento\Backend\Model\Session\AdminConfig $sessionConfig */
127+ $ sessionConfig = $ objectManager ->get (\Magento \Backend \Model \Session \AdminConfig::class);
128+ $ cookiePath = $ this ->getSetupCookiePath ($ objectManager );
129+ $ sessionConfig ->setCookiePath ($ cookiePath );
126130 /** @var \Magento\Backend\Model\Auth\Session $adminSession */
127131 $ adminSession = $ objectManager ->create (
128132 \Magento \Backend \Model \Auth \Session::class,
129133 [
130- 'sessionConfig ' => $ objectManager -> get (\ Magento \ Backend \ Model \ Session \AdminConfig::class) ,
134+ 'sessionConfig ' => $ sessionConfig ,
131135 'appState ' => $ adminAppState
132136 ]
133137 );
134138 if (!$ objectManager ->get (\Magento \Backend \Model \Auth::class)->isLoggedIn ()) {
135- $ adminSession ->expireSessionCookie ();
139+ $ adminSession ->destroy ();
136140 $ response = $ event ->getResponse ();
137141 $ response ->getHeaders ()->addHeaderLine ('Location ' , 'index.php/session/unlogin ' );
138142 $ response ->setStatusCode (302 );
@@ -145,6 +149,25 @@ public function authPreDispatch($event)
145149 return false ;
146150 }
147151
152+ /**
153+ * Get cookie path
154+ *
155+ * @param \Magento\Framework\ObjectManagerInterface $objectManager
156+ * @return string
157+ */
158+ private function getSetupCookiePath (\Magento \Framework \ObjectManagerInterface $ objectManager )
159+ {
160+ /** @var \Magento\Backend\App\BackendAppList $backendAppList */
161+ $ backendAppList = $ objectManager ->get (\Magento \Backend \App \BackendAppList::class);
162+ $ backendApp = $ backendAppList ->getBackendApp ('setup ' );
163+ /** @var \Magento\Backend\Model\UrlFactory $backendUrlFactory */
164+ $ backendUrlFactory = $ objectManager ->get (\Magento \Backend \Model \UrlFactory::class);
165+ $ baseUrl = parse_url ($ backendUrlFactory ->create ()->getBaseUrl (), PHP_URL_PATH );
166+ $ baseUrl = \Magento \Framework \App \Request \Http::getUrlNoScript ($ baseUrl );
167+ $ cookiePath = $ baseUrl . $ backendApp ->getCookiePath ();
168+ return $ cookiePath ;
169+ }
170+
148171 /**
149172 * {@inheritdoc}
150173 */
0 commit comments