_frontNameResolver = $frontNameResolver; $this->backendAppList = $backendAppList; $this->backendUrlFactory = $backendUrlFactory; $adminPath = $this->extractAdminPath(); $this->setCookiePath($adminPath); $this->setName($sessionName); $this->setCookieSecure($this->_httpRequest->isSecure()); } /** * Determine the admin path * * @return string */ private function extractAdminPath() { $backendApp = $this->backendAppList->getCurrentApp(); $cookiePath = null; $baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH); if (!$backendApp) { $cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName(); return $cookiePath; } //In case of application authenticating through the admin login, the script name should be removed //from the path, because application has own script. $baseUrl = \Magento\Framework\App\Request\Http::getUrlNoScript($baseUrl); $cookiePath = $baseUrl . $backendApp->getCookiePath(); return $cookiePath; } /** * Set session cookie lifetime to session duration * * @return $this * @since 100.1.0 */ protected function configureCookieLifetime() { return $this->setCookieLifetime(0); } }