added pvc saving of Key
This commit is contained in:
12
Program.cs
12
Program.cs
@@ -10,10 +10,22 @@ using Microsoft.AspNetCore.Components.Server;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
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
|
// Initialisieren des Web Builders, der den Server und die Umgebung vorbereitet
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
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
|
// NEU: Blazor-Authentifizierungsdienste registrieren
|
||||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||||
.AddCookie(options =>
|
.AddCookie(options =>
|
||||||
|
|||||||
Reference in New Issue
Block a user