Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92c60e6616 | |||
| 9099610185 | |||
| 21788c66a3 | |||
| dfaa62ea75 |
@@ -2,6 +2,8 @@
|
|||||||
using LiteCharms.Features.Api;
|
using LiteCharms.Features.Api;
|
||||||
using LiteCharms.Features.Api.Configuration;
|
using LiteCharms.Features.Api.Configuration;
|
||||||
using LiteCharms.Features.Api.Sdk;
|
using LiteCharms.Features.Api.Sdk;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Extensions;
|
namespace LiteCharms.Features.Extensions;
|
||||||
|
|
||||||
@@ -51,8 +53,21 @@ public static class Api
|
|||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddLiteCharmsWebSecurity(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddLiteCharmsWebSecurity(this IServiceCollection services, IConfiguration configuration, IWebHostEnvironment environment)
|
||||||
{
|
{
|
||||||
|
string keysFolderPath;
|
||||||
|
|
||||||
|
if (OperatingSystem.IsLinux())
|
||||||
|
keysFolderPath = "/app/shared-keys";
|
||||||
|
else
|
||||||
|
keysFolderPath = Path.Combine(environment.ContentRootPath, "obj", "DeveloperDataProtectionKeys");
|
||||||
|
|
||||||
|
if (!Directory.Exists(keysFolderPath)) Directory.CreateDirectory(keysFolderPath);
|
||||||
|
|
||||||
|
services.AddDataProtection()
|
||||||
|
.PersistKeysToFileSystem(new DirectoryInfo(keysFolderPath))
|
||||||
|
.SetApplicationName("MidrandBookshop");
|
||||||
|
|
||||||
var configSection = configuration.GetSection(nameof(LiteCharmsSettings));
|
var configSection = configuration.GetSection(nameof(LiteCharmsSettings));
|
||||||
|
|
||||||
var authOptions = new LiteCharmsSettings();
|
var authOptions = new LiteCharmsSettings();
|
||||||
|
|||||||
@@ -194,6 +194,7 @@
|
|||||||
|
|
||||||
<!-- Shared Usings -->
|
<!-- Shared Usings -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Using Include="Microsoft.AspNetCore.DataProtection" />
|
||||||
<Using Include="Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage" />
|
<Using Include="Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage" />
|
||||||
<Using Include="System.Text.Json.Serialization" />
|
<Using Include="System.Text.Json.Serialization" />
|
||||||
<Using Include="System.Reflection" />
|
<Using Include="System.Reflection" />
|
||||||
|
|||||||
Reference in New Issue
Block a user