集成CSRedis分布式存储,调整创建者和更新者字段,登录RSA使用配置文件配置私钥
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using CSRedis;
|
||||
using Infrastructure;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
|
||||
namespace ZR.Common.Cache
|
||||
{
|
||||
@@ -12,6 +13,7 @@ namespace ZR.Common.Cache
|
||||
{
|
||||
Cache = new CSRedisClient(AppSettings.GetConfig("RedisServer:Cache"));
|
||||
Session = new CSRedisClient(AppSettings.GetConfig("RedisServer:Session"));
|
||||
RedisHelper.Initialization(Cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,8 @@ namespace Infrastructure
|
||||
{
|
||||
new Claim(ClaimTypes.PrimarySid, user.UserId.ToString()),
|
||||
new Claim(ClaimTypes.Name, user.UserName),
|
||||
new Claim(ClaimTypes.UserData, JsonConvert.SerializeObject(user))
|
||||
new Claim(ClaimTypes.UserData, JsonConvert.SerializeObject(user)),
|
||||
new Claim("NickName", user.NickName)
|
||||
};
|
||||
|
||||
return claims;
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Infrastructure.Model
|
||||
public long UserId { get; set; }
|
||||
public long DeptId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string NickName { get; set; }
|
||||
/// <summary>
|
||||
/// 角色集合
|
||||
/// </summary>
|
||||
|
||||
@@ -91,6 +91,14 @@ namespace Infrastructure.Extensions
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
||||
public static string? GetNickName(this HttpContext context)
|
||||
{
|
||||
var nickName = context.User.FindFirstValue("NickName");
|
||||
if (string.IsNullOrEmpty(nickName))
|
||||
nickName = null;
|
||||
return nickName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否是管理员
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspectCore.Abstractions" Version="2.4.0" />
|
||||
<PackageReference Include="Caching.CSRedis" Version="3.8.670" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="RulesEngine" Version="5.0.2" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.7" />
|
||||
|
||||
Reference in New Issue
Block a user