mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 05:23:31 -07:00
Fixed: Forms login persists across restarts in docker
This commit is contained in:
parent
a93f55205a
commit
30670442b6
3 changed files with 15 additions and 0 deletions
|
@ -286,6 +286,11 @@ namespace NzbDrone.Common.Extensions
|
||||||
return appFolderInfo.AppDataFolder;
|
return appFolderInfo.AppDataFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetDataProtectionPath(this IAppFolderInfo appFolderInfo)
|
||||||
|
{
|
||||||
|
return Path.Combine(GetAppDataPath(appFolderInfo), "asp");
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetLogFolder(this IAppFolderInfo appFolderInfo)
|
public static string GetLogFolder(this IAppFolderInfo appFolderInfo)
|
||||||
{
|
{
|
||||||
return Path.Combine(GetAppDataPath(appFolderInfo), "logs");
|
return Path.Combine(GetAppDataPath(appFolderInfo), "logs");
|
||||||
|
|
|
@ -7,8 +7,10 @@ using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DryIoc;
|
using DryIoc;
|
||||||
using DryIoc.Microsoft.DependencyInjection;
|
using DryIoc.Microsoft.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Hosting.WindowsServices;
|
using Microsoft.Extensions.Hosting.WindowsServices;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -132,6 +134,7 @@ namespace NzbDrone.Host
|
||||||
})
|
})
|
||||||
.ConfigureWebHost(builder =>
|
.ConfigureWebHost(builder =>
|
||||||
{
|
{
|
||||||
|
builder.UseConfiguration(config);
|
||||||
builder.UseUrls(urls.ToArray());
|
builder.UseUrls(urls.ToArray());
|
||||||
builder.UseKestrel(options =>
|
builder.UseKestrel(options =>
|
||||||
{
|
{
|
||||||
|
@ -198,6 +201,7 @@ namespace NzbDrone.Host
|
||||||
var appFolder = new AppFolderInfo(context);
|
var appFolder = new AppFolderInfo(context);
|
||||||
return new ConfigurationBuilder()
|
return new ConfigurationBuilder()
|
||||||
.AddXmlFile(appFolder.GetConfigPath(), optional: true, reloadOnChange: false)
|
.AddXmlFile(appFolder.GetConfigPath(), optional: true, reloadOnChange: false)
|
||||||
|
.AddInMemoryCollection(new List<KeyValuePair<string, string>> { new ("dataProtectionFolder", appFolder.GetDataProtectionPath()) })
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using Lidarr.Api.V1.System;
|
using Lidarr.Api.V1.System;
|
||||||
using Lidarr.Http;
|
using Lidarr.Http;
|
||||||
using Lidarr.Http.Authentication;
|
using Lidarr.Http.Authentication;
|
||||||
|
@ -8,6 +9,7 @@ using Lidarr.Http.Frontend;
|
||||||
using Lidarr.Http.Middleware;
|
using Lidarr.Http.Middleware;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
@ -46,6 +48,7 @@ namespace NzbDrone.Host
|
||||||
b.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
b.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
||||||
b.AddFilter("Microsoft.AspNetCore", Microsoft.Extensions.Logging.LogLevel.Warning);
|
b.AddFilter("Microsoft.AspNetCore", Microsoft.Extensions.Logging.LogLevel.Warning);
|
||||||
b.AddFilter("Lidarr.Http.Authentication", LogLevel.Information);
|
b.AddFilter("Lidarr.Http.Authentication", LogLevel.Information);
|
||||||
|
b.AddFilter("Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager", LogLevel.Error);
|
||||||
b.AddNLog();
|
b.AddNLog();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -95,6 +98,9 @@ namespace NzbDrone.Host
|
||||||
options.PayloadSerializerOptions = STJson.GetSerializerSettings();
|
options.PayloadSerializerOptions = STJson.GetSerializerSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddDataProtection()
|
||||||
|
.PersistKeysToFileSystem(new DirectoryInfo(Configuration["dataProtectionFolder"]));
|
||||||
|
|
||||||
services.AddSingleton<IAuthorizationPolicyProvider, UiAuthorizationPolicyProvider>();
|
services.AddSingleton<IAuthorizationPolicyProvider, UiAuthorizationPolicyProvider>();
|
||||||
services.AddAuthorization(options =>
|
services.AddAuthorization(options =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue