|
|
@@ -53,7 +53,7 @@ class CsrfProtectionMiddleware implements MiddlewareInterface
|
|
|
* - `expiry` A strotime compatible value of how long the CSRF token should last.
|
|
|
* Defaults to browser session.
|
|
|
* - `secure` Whether or not the cookie will be set with the Secure flag. Defaults to false.
|
|
|
- * - `httpOnly` Whether or not the cookie will be set with the HttpOnly flag. Defaults to false.
|
|
|
+ * - `httponly` Whether or not the cookie will be set with the HttpOnly flag. Defaults to false.
|
|
|
* - 'samesite' "SameSite" attribute for cookies. Defaults to `null`.
|
|
|
* Valid values: `CookieInterface::SAMESITE_LAX`, `CookieInterface::SAMESITE_STRICT`,
|
|
|
* `CookieInterface::SAMESITE_NONE` or `null`.
|
|
|
@@ -66,7 +66,7 @@ class CsrfProtectionMiddleware implements MiddlewareInterface
|
|
|
'cookieName' => 'csrfToken',
|
|
|
'expiry' => 0,
|
|
|
'secure' => false,
|
|
|
- 'httpOnly' => false,
|
|
|
+ 'httponly' => false,
|
|
|
'samesite' => null,
|
|
|
'field' => '_csrfToken',
|
|
|
];
|
|
|
@@ -92,6 +92,11 @@ class CsrfProtectionMiddleware implements MiddlewareInterface
|
|
|
*/
|
|
|
public function __construct(array $config = [])
|
|
|
{
|
|
|
+ if (array_key_exists('httpOnly', $config)) {
|
|
|
+ $config['httponly'] = $config['httpOnly'];
|
|
|
+ deprecationWarning('Option `httpOnly` is deprecated. Use lowercased `httponly` instead.');
|
|
|
+ }
|
|
|
+
|
|
|
$this->_config = $config + $this->_config;
|
|
|
}
|
|
|
|
|
|
@@ -298,7 +303,7 @@ class CsrfProtectionMiddleware implements MiddlewareInterface
|
|
|
'expires' => $this->_config['expiry'] ?: null,
|
|
|
'path' => $request->getAttribute('webroot'),
|
|
|
'secure' => $this->_config['secure'],
|
|
|
- 'httponly' => $this->_config['httpOnly'],
|
|
|
+ 'httponly' => $this->_config['httponly'],
|
|
|
'samesite' => $this->_config['samesite'],
|
|
|
]
|
|
|
);
|