using System.Security.Claims; using FozFc.Api.Infrastructure.Security; namespace FozFc.Api.Api.Extensions; public static class ClaimsPrincipalExtensions { public static string? GetUid(this ClaimsPrincipal user) => user.FindFirst(JwtClaims.Uid)?.Value; public static string GetRole(this ClaimsPrincipal user) => user.FindFirst(JwtClaims.Role)?.Value ?? "member"; public static bool IsAdmin(this ClaimsPrincipal user) => user.GetRole() == "admin"; public static bool IsAuthenticated(this ClaimsPrincipal user) => !string.IsNullOrEmpty(user.GetUid()); }