From c51a9cecc97f63fb8d84ea0c6167d7cb3efe88b9 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Sat, 10 Aug 2024 23:03:28 +0300 Subject: [PATCH] fix: storing data protection keys --- Endpoint/Program.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Endpoint/Program.cs b/Endpoint/Program.cs index 9bc37de..9883828 100644 --- a/Endpoint/Program.cs +++ b/Endpoint/Program.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.Configuration; @@ -94,13 +95,15 @@ public class Program builder.Services.AddJwtToken(builder.Configuration); builder.Services.AddSecurity(builder.Configuration); + builder.Services.AddDataProtection() + .PersistKeysToFileSystem(new DirectoryInfo(PathBuilder.Combine("DataProtection"))); + var app = builder.Build(); app.UseForwardedHeaders(); app.UseStaticFiles(UrlHelper.GetSubPath.TrimEnd('/')); app.UseCors("AllowAll"); app.UseCustomSerilog(); - app.UseForwardedHeaders(); using (var scope = app.Services.CreateScope()) {