Closes #2059 (cherry picked from commit 6619350f87a8f6ddedfea0cc8ca5b1e9ab006091)pull/2154/head
parent
5cc2db26e7
commit
66c1ac9971
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using Nancy.Bootstrapper;
|
||||
|
||||
namespace Lidarr.Http.Extensions.Pipelines
|
||||
{
|
||||
public class SetCookieHeaderPipeline : IRegisterNancyPipeline
|
||||
{
|
||||
public int Order => 99;
|
||||
|
||||
public void Register(IPipelines pipelines)
|
||||
{
|
||||
pipelines.AfterRequest.AddItemToEndOfPipeline((Action<NancyContext>)Handle);
|
||||
}
|
||||
|
||||
private void Handle(NancyContext context)
|
||||
{
|
||||
if (context.Request.IsContentRequest() || context.Request.IsBundledJsRequest())
|
||||
{
|
||||
var authCookie = context.Response.Cookies.FirstOrDefault(c => c.Name == "SonarrAuth");
|
||||
|
||||
if (authCookie != null)
|
||||
{
|
||||
context.Response.Cookies.Remove(authCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue