diff --git a/app/code/Magento/Customer/etc/webapi_rest/di.xml b/app/code/Magento/Customer/etc/webapi_rest/di.xml index 426df2bbaa128..a349d07a5e222 100644 --- a/app/code/Magento/Customer/etc/webapi_rest/di.xml +++ b/app/code/Magento/Customer/etc/webapi_rest/di.xml @@ -13,7 +13,7 @@ - Magento\Customer\Model\Authorization\CustomerSessionUserContext + Magento\Customer\Model\Authorization\CustomerSessionUserContext\Proxy 20 diff --git a/app/code/Magento/PageCache/etc/di.xml b/app/code/Magento/PageCache/etc/di.xml index 3f4b36ce0f98c..f70a561342763 100644 --- a/app/code/Magento/PageCache/etc/di.xml +++ b/app/code/Magento/PageCache/etc/di.xml @@ -37,9 +37,6 @@ Magento\Framework\View\Layout\LayoutCacheKeyInterface - - - diff --git a/app/code/Magento/PageCache/etc/frontend/di.xml b/app/code/Magento/PageCache/etc/frontend/di.xml index a396a46ae7346..1aaa331da7025 100644 --- a/app/code/Magento/PageCache/etc/frontend/di.xml +++ b/app/code/Magento/PageCache/etc/frontend/di.xml @@ -9,6 +9,7 @@ + diff --git a/app/code/Magento/PageCache/etc/graphql/di.xml b/app/code/Magento/PageCache/etc/graphql/di.xml new file mode 100644 index 0000000000000..93714465f4d72 --- /dev/null +++ b/app/code/Magento/PageCache/etc/graphql/di.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/app/code/Magento/User/etc/webapi_rest/di.xml b/app/code/Magento/User/etc/webapi_rest/di.xml index 7c6cccb454df7..930e505648d9c 100644 --- a/app/code/Magento/User/etc/webapi_rest/di.xml +++ b/app/code/Magento/User/etc/webapi_rest/di.xml @@ -10,7 +10,7 @@ - Magento\User\Model\Authorization\AdminSessionUserContext + Magento\User\Model\Authorization\AdminSessionUserContext\Proxy 30 diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/RestSessionCookieTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/RestSessionCookieTest.php new file mode 100644 index 0000000000000..36dc7a9afeba0 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/RestSessionCookieTest.php @@ -0,0 +1,71 @@ +objectManager = Bootstrap::getObjectManager(); + $this->moduleManager = $this->objectManager->get(Manager::class); + if ($this->moduleManager->isEnabled('Magento_B2b')) { + $this->markTestSkipped('Skipped, because this logic is rewritten on B2B.'); + } + } + + /** + * Check for non exist cookie PHPSESSID + */ + public function testRestSessionNoCookie() + { + $this->_markTestAsRestOnly(); + /** @var $curlClient CurlClientWithCookies */ + + $curlClient = $this->objectManager + ->get(\Magento\TestFramework\TestCase\HttpClient\CurlClientWithCookies::class); + $phpSessionCookieName = + [ + 'cookie_name' => 'PHPSESSID', + ]; + + $response = $curlClient->get('/rest/V1/directory/countries', []); + + $cookie = $this->findCookie($phpSessionCookieName['cookie_name'], $response['cookies']); + $this->assertNull($cookie); + } + + /** + * Find cookie with given name in the list of cookies + * + * @param string $cookieName + * @param array $cookies + * @return $cookie|null + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + private function findCookie($cookieName, $cookies) + { + foreach ($cookies as $cookieIndex => $cookie) { + if ($cookie['name'] === $cookieName) { + return $cookie; + } + } + return null; + } +}