😎补全当前用户信息获取
This commit is contained in:
parent
312038c041
commit
653c2703c2
@ -175,6 +175,7 @@ public class AppAuthService : IDynamicApiController, ITransient
|
||||
{ AppClaimConst.OrgId, user.OrgId },
|
||||
{ AppClaimConst.OrgName, user.SysOrg?.Name },
|
||||
{ AppClaimConst.OrgType, user.SysOrg?.Type },
|
||||
{ AppClaimConst.OrgLevel, user.SysOrg?.Level },
|
||||
{ ClaimConst.LoginMode, loginMode },
|
||||
}, tokenExpire);
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<PackageReference Include="AngleSharp" Version="1.1.2" />
|
||||
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.16.2" />
|
||||
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.16.3" />
|
||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.26" />
|
||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.26" />
|
||||
<PackageReference Include="Furion.Pure" Version="4.9.5.26" />
|
||||
@ -47,7 +47,7 @@
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.9" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1129" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1132" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -16,6 +16,11 @@ public class ClaimConst
|
||||
/// </summary>
|
||||
public const string AppId = "AppId";
|
||||
|
||||
/// <summary>
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public const string TenantId = "TenantId";
|
||||
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
@ -41,11 +46,6 @@ public class ClaimConst
|
||||
/// </summary>
|
||||
public const string AccountType = "AccountType";
|
||||
|
||||
/// <summary>
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public const string TenantId = "TenantId";
|
||||
|
||||
/// <summary>
|
||||
/// 组织机构Id
|
||||
/// </summary>
|
||||
@ -62,9 +62,9 @@ public class ClaimConst
|
||||
public const string OrgType = "OrgType";
|
||||
|
||||
/// <summary>
|
||||
/// 微信OpenId
|
||||
/// 组织机构级别
|
||||
/// </summary>
|
||||
public const string OpenId = "OpenId";
|
||||
public const string OrgLevel = "OrgLevel";
|
||||
|
||||
/// <summary>
|
||||
/// 登录模式PC、APP
|
||||
@ -75,4 +75,9 @@ public class ClaimConst
|
||||
/// Token版本号
|
||||
/// </summary>
|
||||
public const string TokenVersion = "TokenVersion";
|
||||
|
||||
/// <summary>
|
||||
/// 微信OpenId
|
||||
/// </summary>
|
||||
public const string OpenId = "OpenId";
|
||||
}
|
||||
@ -259,6 +259,7 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
{ ClaimConst.OrgId, user.OrgId },
|
||||
{ ClaimConst.OrgName, user.SysOrg?.Name },
|
||||
{ ClaimConst.OrgType, user.SysOrg?.Type },
|
||||
{ ClaimConst.OrgLevel, user.SysOrg?.Level },
|
||||
{ ClaimConst.TokenVersion, user.TokenVersion },
|
||||
}, tokenExpire);
|
||||
|
||||
|
||||
@ -14,20 +14,20 @@ public class UserManager : IScoped
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// 应用ID
|
||||
/// 应用Id
|
||||
/// </summary>
|
||||
public long AppId => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.AppId)?.Value).ToLong();
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public long UserId => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.UserId)?.Value).ToLong();
|
||||
|
||||
/// <summary>
|
||||
/// 租户ID
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public long TenantId => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.TenantId)?.Value).ToLong();
|
||||
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
public long UserId => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.UserId)?.Value).ToLong();
|
||||
|
||||
/// <summary>
|
||||
/// 用户账号
|
||||
/// </summary>
|
||||
@ -38,6 +38,11 @@ public class UserManager : IScoped
|
||||
/// </summary>
|
||||
public string RealName => _httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.RealName)?.Value;
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string NickName => _httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.NickName)?.Value;
|
||||
|
||||
/// <summary>
|
||||
/// 是否超级管理员
|
||||
/// </summary>
|
||||
@ -53,6 +58,31 @@ public class UserManager : IScoped
|
||||
/// </summary>
|
||||
public long OrgId => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.OrgId)?.Value).ToLong();
|
||||
|
||||
/// <summary>
|
||||
/// 组织机构名称
|
||||
/// </summary>
|
||||
public string OrgName => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.OrgName)?.Value);
|
||||
|
||||
/// <summary>
|
||||
/// 组织机构Id
|
||||
/// </summary>
|
||||
public string OrgType => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.OrgType)?.Value);
|
||||
|
||||
/// <summary>
|
||||
/// 组织机构级别
|
||||
/// </summary>
|
||||
public int OrgLevel => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.OrgLevel)?.Value).ToInt();
|
||||
|
||||
/// <summary>
|
||||
/// 登录模式
|
||||
/// </summary>
|
||||
public int LoginMode => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.LoginMode)?.Value).ToInt();
|
||||
|
||||
/// <summary>
|
||||
/// Token版本号
|
||||
/// </summary>
|
||||
public int TokenVersion => (_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.TokenVersion)?.Value).ToInt();
|
||||
|
||||
/// <summary>
|
||||
/// 微信OpenId
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user