From eb3d290ac002f805cdc337d9eb991c995e699745 Mon Sep 17 00:00:00 2001 From: Jakub Polomsky Date: Tue, 15 Jun 2021 08:54:06 +0200 Subject: [PATCH] override cookie settings to comply with new browser reqs. --- Model/Plugin/FixSession.php | 67 +++++++++++++++++++++++++++++++++++++ etc/frontend/di.xml | 4 +++ 2 files changed, 71 insertions(+) create mode 100644 Model/Plugin/FixSession.php diff --git a/Model/Plugin/FixSession.php b/Model/Plugin/FixSession.php new file mode 100644 index 0000000..6aee8fe --- /dev/null +++ b/Model/Plugin/FixSession.php @@ -0,0 +1,67 @@ +header = $header; + } + + public function beforeSetPublicCookie( + PhpCookieManager $subject, + $name, + $value, + PublicCookieMetadata $metadata = null + ) { + if ($metadata && method_exists($metadata, 'getSameSite') && ($name == 'PHPSESSID')) { + if ($metadata->getSameSite() != 'None') { + $metadata->setSecure(true); + $metadata->setSameSite('None'); + } + } + return [$name, $value, $metadata]; + } +} diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index 20cc4ae..df28d45 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -50,4 +50,8 @@ + + + +