using System.Security.Claims; namespace MAX.Framework.Security; /// /// 当前登录用户访问器:从当前请求的认证票据中读取用户信息。 /// public interface ICurrentUser { /// /// 当前请求是否已认证 /// bool IsAuthenticated { get; } /// /// 当前登录账户名(未登录为 null) /// string? UserName { get; } /// /// 当前用户昵称(未登录为 null) /// string? NickName { get; } /// /// 当前用户的全部声明 /// IEnumerable Claims { get; } /// /// 获取指定类型的声明值 /// string? GetClaimValue(string claimType); /// /// 获取指定类型的声明值并转换为目标类型;不存在或转换失败返回默认值 /// T? GetClaimValue(string claimType); }