mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-22 07:42:28 +00:00
Fixed: Set SameSite=Strict for SonarrAuth cookie
(cherry picked from commit 675c72f02e7565a937b40c23ec27df6d86f95dc3)
This commit is contained in:
parent
e85ed1e2b8
commit
c5b9963a07
2 changed files with 34 additions and 2 deletions
|
@ -6,7 +6,6 @@
|
|||
using Nancy.Authentication.Basic;
|
||||
using Nancy.Authentication.Forms;
|
||||
using Nancy.Bootstrapper;
|
||||
using Nancy.Cookies;
|
||||
using Nancy.Cryptography;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
@ -118,7 +117,7 @@ private void SlidingAuthenticationForFormsAuth(NancyContext context)
|
|||
|
||||
if (FormsAuthentication.DecryptAndValidateAuthenticationCookie(formsAuthCookieValue, _formsAuthConfig).IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var formsAuthCookie = new NancyCookie(formsAuthCookieName, formsAuthCookieValue, true, false, DateTime.UtcNow.AddDays(7))
|
||||
var formsAuthCookie = new SonarrNancyCookie(formsAuthCookieName, formsAuthCookieValue, true, false, DateTime.UtcNow.AddDays(7))
|
||||
{
|
||||
Path = GetCookiePath()
|
||||
};
|
||||
|
|
33
src/Sonarr.Http/Authentication/SonarrNancyCookie.cs
Normal file
33
src/Sonarr.Http/Authentication/SonarrNancyCookie.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using Nancy.Cookies;
|
||||
|
||||
namespace Sonarr.Http.Authentication
|
||||
{
|
||||
public class SonarrNancyCookie : NancyCookie
|
||||
{
|
||||
public SonarrNancyCookie(string name, string value) : base(name, value)
|
||||
{
|
||||
}
|
||||
|
||||
public SonarrNancyCookie(string name, string value, DateTime expires) : base(name, value, expires)
|
||||
{
|
||||
}
|
||||
|
||||
public SonarrNancyCookie(string name, string value, bool httpOnly) : base(name, value, httpOnly)
|
||||
{
|
||||
}
|
||||
|
||||
public SonarrNancyCookie(string name, string value, bool httpOnly, bool secure) : base(name, value, httpOnly, secure)
|
||||
{
|
||||
}
|
||||
|
||||
public SonarrNancyCookie(string name, string value, bool httpOnly, bool secure, DateTime? expires) : base(name, value, httpOnly, secure, expires)
|
||||
{
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return base.ToString() + "; SameSite=Strict";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue