feat: Implementierung von CSPMiddleware zur Hinzufügung von CSP-Headern mit Nonce für verbesserte Sicherheit.

This commit is contained in:
Developer 02
2024-05-14 11:19:22 +02:00
parent f7a5d4fc28
commit b71c778a4d
3 changed files with 74 additions and 1 deletions

View File

@@ -1,5 +1,4 @@
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Text;
namespace DigitalData.Core.DTO
@@ -63,6 +62,10 @@ namespace DigitalData.Core.DTO
return result;
}
public static bool HasFlag(this IEnumerable<Notice> notices, Enum flag) => notices.Any(n => n.Flag?.ToString() == flag.ToString());
public static bool HasAnyFlag(this IEnumerable<Notice> notices, params Enum[] flags) => flags.Any(f => notices.HasFlag(f));
public static I Then<I>(this Result result, Func<I> Success, Func<List<string>, List<Notice>, I> Fail)
{
return result.IsSuccess ? Success() : Fail(result.Messages, result.Notices);