forked from gongxuegit/tiku-backend.net
feat: add api security foundation
This commit is contained in:
16
Tiku.Application/Security/CurrentTenant.cs
Normal file
16
Tiku.Application/Security/CurrentTenant.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user