Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Remove DataProtectionKeysPath and simplify key config

KrzysztofPajakfc5b24726467
diff --git a/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs b/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
index 5b60ada45..acaa6982e 100644
--- a/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
+++ b/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
@@ -9,12 +9,6 @@ public static class CommonPath
/// </summary>
public static string Param { get; set; } = "";
- /// <summary>
- /// Maps a settings path to a physical disk path.
- /// </summary>
- /// <returns>The physical path.</returns>
- public static string DataProtectionKeysPath => Path.Combine(BaseDirectory, AppData, Param, "DataProtectionKeys");
-
/// <summary>
/// Maps a settings path to a physical disk path.
/// </summary>
diff --git a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
index 3e83b8756..f0041ceab 100644
--- a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
+++ b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
@@ -122,13 +122,8 @@ public static class ServiceCollectionExtensions
else
{
var securityConfig = new SecurityConfig();
- configuration.GetSection("Security").Bind(securityConfig);
-
- var dataProtectionKeysPath = string.IsNullOrEmpty(securityConfig.KeyPersistenceLocation)
- ? CommonPath.DataProtectionKeysPath
- : securityConfig.KeyPersistenceLocation;
- var dataProtectionKeysFolder = new DirectoryInfo(dataProtectionKeysPath);
-
+ configuration.GetSection("Security").Bind(securityConfig);
+ var dataProtectionKeysFolder = new DirectoryInfo(securityConfig.KeyPersistenceLocation);
//configure the data protection system to persist keys to the specified directory
services.AddDataProtection().PersistKeysToFileSystem(dataProtectionKeysFolder);
}