feat: Implementieren der Verschlüsselungs- und Entschlüsselungsdienste mit AES und Integration in die API
- Hinzufügen der `Encryptor`-Klasse für AES-Verschlüsselung und -Entschlüsselung. - Implementierung des `EncryptionController` zur Bereitstellung von Endpunkten für Verschlüsselung, Entschlüsselung und Generierung von Verschlüsselungsparametern. - Erweiterung der DI-Konfiguration mit `AddEncryptor`-Erweiterungsmethode und Integration in `Program.cs`. - Bedingte Registrierung des `EncryptionController` basierend auf der Konfiguration `UseEncryptor`, um sicherzustellen, dass der Controller nur bei Bedarf verfügbar ist. - Implementierung von Lazy Loading für die Verbindungszeichenfolge in `UserManagerDbContext` zur sicheren Handhabung von verschlüsselten Verbindungszeichenfolgen.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.MappingProfiles;
|
||||
using DigitalData.UserManager.Application.Services;
|
||||
using DigitalData.UserManager.Application.Services.Options;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DigitalData.UserManager.Application
|
||||
@@ -40,5 +42,12 @@ namespace DigitalData.UserManager.Application
|
||||
.AddScoped<IModuleService, ModuleService>()
|
||||
.AddScoped<IModuleOfUserService, ModuleOfUserService>()
|
||||
.AddScoped<IUserRepService, UserRepService>();
|
||||
|
||||
public static IServiceCollection AddEncryptor(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddSingleton<Encryptor>();
|
||||
services.Configure<EncryptionParameters>(configuration);
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user