feat: add api security foundation

This commit is contained in:
xiong
2026-07-26 12:46:42 +08:00
parent f31977ef9a
commit e8b03c57bc
20 changed files with 436 additions and 23 deletions

View File

@@ -0,0 +1,16 @@
using System.Security.Claims;
namespace Tiku.Application.Security;
public sealed class CurrentTenant : ICurrentTenant
{
public Guid? TenantId { get; private set; }
public string? Role { get; private set; }
public bool IsResolved => TenantId.HasValue;
public void Load(ClaimsPrincipal principal)
{
TenantId = principal.FindGuid(TikuClaimTypes.TenantId);
Role = principal.FindValue(TikuClaimTypes.TenantRole);
}
}