Implement AspNetCore.DataProtection to replace DPAPI

This commit is contained in:
flightlevel
2018-05-30 21:43:58 +10:00
parent 10c5c99385
commit e73ae99e38
3 changed files with 43 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ using Jackett.Server.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -18,6 +19,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Newtonsoft.Json.Serialization;
using System;
using System.IO;
using System.Text;
namespace Jackett.Server
@@ -62,6 +64,12 @@ namespace Jackett.Server
RuntimeSettings runtimeSettings = new RuntimeSettings();
Configuration.GetSection("RuntimeSettings").Bind(runtimeSettings);
DirectoryInfo dataProtectionFolder = new DirectoryInfo(Path.Combine(runtimeSettings.DataFolder, "DataProtection"));
services.AddDataProtection()
.PersistKeysToFileSystem(dataProtectionFolder)
.SetApplicationName("Jackett");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var builder = new ContainerBuilder();