10
10
namespace Magento \PageCache \Plugin ;
11
11
12
12
use Magento \Framework \App \PageCache \FormKey as CacheFormKey ;
13
- use Magento \Framework \Escaper ;
14
13
use Magento \Framework \Data \Form \FormKey ;
15
- use Magento \Framework \Stdlib \ Cookie \ CookieMetadataFactory ;
14
+ use Magento \Framework \Escaper ;
16
15
use Magento \Framework \Session \Config \ConfigInterface ;
16
+ use Magento \Framework \Stdlib \Cookie \CookieMetadataFactory ;
17
17
18
18
/**
19
19
* Allow for registration of a form key through cookies.
@@ -46,7 +46,7 @@ class RegisterFormKeyFromCookie
46
46
private $ sessionConfig ;
47
47
48
48
/**
49
- * @param CacheFormKey $formKey
49
+ * @param CacheFormKey $cacheFormKey
50
50
* @param Escaper $escaper
51
51
* @param FormKey $formKey
52
52
* @param CookieMetadataFactory $cookieMetadataFactory
@@ -70,7 +70,6 @@ public function __construct(
70
70
* Set form key from the cookie.
71
71
*
72
72
* @return void
73
- *
74
73
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
75
74
*/
76
75
public function beforeDispatch (): void
@@ -85,6 +84,8 @@ public function beforeDispatch(): void
85
84
}
86
85
87
86
/**
87
+ * Set form key cookie
88
+ *
88
89
* @param string $formKey
89
90
* @return void
90
91
*/
@@ -94,6 +95,7 @@ private function updateCookieFormKey(string $formKey): void
94
95
->createPublicCookieMetadata ();
95
96
$ cookieMetadata ->setDomain ($ this ->sessionConfig ->getCookieDomain ());
96
97
$ cookieMetadata ->setPath ($ this ->sessionConfig ->getCookiePath ());
98
+ $ cookieMetadata ->setSecure ($ this ->sessionConfig ->getCookieSecure ());
97
99
$ lifetime = $ this ->sessionConfig ->getCookieLifetime ();
98
100
if ($ lifetime !== 0 ) {
99
101
$ cookieMetadata ->setDuration ($ lifetime );
0 commit comments