diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2020-06-22 13:00:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 13:00:12 +0200 |
commit | 859941db3228286be0bea1692ce39624df3236f6 (patch) | |
tree | 4d144da8d7ba82a2f23e06f1fd7c8d64e1062018 /lib/public | |
parent | a899b4775d3d5843bd5c83af8e74cab2219c71d1 (diff) | |
parent | fbf9772a3eafeab74cc5b3f76e7ad7cc081991bb (diff) | |
download | nextcloud-server-859941db3228286be0bea1692ce39624df3236f6.tar.gz nextcloud-server-859941db3228286be0bea1692ce39624df3236f6.zip |
Merge pull request #21479 from nextcloud/fix/21474/allow_specifying_cookie_type
Allow to specify the cookie type for appframework responses
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/AppFramework/Http/IOutput.php | 3 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/Response.php | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/public/AppFramework/Http/IOutput.php b/lib/public/AppFramework/Http/IOutput.php index 888c9f45b23..39543dc9bf1 100644 --- a/lib/public/AppFramework/Http/IOutput.php +++ b/lib/public/AppFramework/Http/IOutput.php @@ -72,7 +72,8 @@ interface IOutput { * @param string $domain * @param bool $secure * @param bool $httpOnly + * @param string $sameSite (added in 20) * @since 8.1.0 */ - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); + public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax'); } diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 6f418e42553..832e0b96247 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -133,11 +133,12 @@ class Response { * @param \DateTime|null $expireDate Date on that the cookie should expire, if set * to null cookie will be considered as session * cookie. + * @param string $sameSite The samesite value of the cookie. Defaults to Lax. Other possibilities are Strict or None * @return $this * @since 8.0.0 */ - public function addCookie($name, $value, \DateTime $expireDate = null) { - $this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate]; + public function addCookie($name, $value, \DateTime $expireDate = null, $sameSite = 'Lax') { + $this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate, 'sameSite' => $sameSite]; return $this; } |