diff --git a/Program.cs b/Program.cs index 9cced66..abd9647 100644 --- a/Program.cs +++ b/Program.cs @@ -10,10 +10,22 @@ using Microsoft.AspNetCore.Components.Server; using System.Security.Claims; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Mvc; +// SECDEVOPS: Namespaces für Data Protection hinzufügen +using System.IO; +using Microsoft.AspNetCore.DataProtection; // Initialisieren des Web Builders, der den Server und die Umgebung vorbereitet var builder = WebApplication.CreateBuilder(args); +// ========================================== +// SECDEVOPS: Data Protection für K8s PVC & Key-Rotation +// ========================================== +var keysFolder = new DirectoryInfo(@"/app/data/dp-keys"); + +builder.Services.AddDataProtection() + .PersistKeysToFileSystem(keysFolder) + .SetApplicationName("SecDevOpsLabApp"); // Bindet die Keys fix an diese App (Wichtig für Replicas) + // NEU: Blazor-Authentifizierungsdienste registrieren builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options =>