diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/MonitorController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/MonitorController.cs
index dda4236..1bc21b8 100644
--- a/ZR.Admin.WebApi/Controllers/System/monitor/MonitorController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/monitor/MonitorController.cs
@@ -30,11 +30,6 @@ namespace ZR.Admin.WebApi.Controllers.monitor
[HttpGet("monitor/cache")]
public ApiResult GetCache()
{
- string redis_connString = Options.Redis;
- var rs = new CSRedis.CSRedisClient(redis_connString);
-
- RedisHelper.Initialization(rs);//初始化Redis
-
return ToJson(1);
}
diff --git a/ZR.Admin.WebApi/Framework/JwtUtil.cs b/ZR.Admin.WebApi/Framework/JwtUtil.cs
index 90cc023..d22fd94 100644
--- a/ZR.Admin.WebApi/Framework/JwtUtil.cs
+++ b/ZR.Admin.WebApi/Framework/JwtUtil.cs
@@ -43,9 +43,6 @@ namespace ZR.Admin.WebApi.Framework
///
public static string GenerateJwtToken(List claims, JwtSettings jwtSettings)
{
- //JwtSettings jwtSettings = new();
- //ConfigUtils.Instance.Bind("JwtSettings", jwtSettings);
-
var authTime = DateTime.Now;
var expiresAt = authTime.AddMinutes(jwtSettings.Expire);
var tokenHandler = new JwtSecurityTokenHandler();
@@ -74,14 +71,14 @@ namespace ZR.Admin.WebApi.Framework
///
public static TokenValidationParameters ValidParameters()
{
- JwtSettings jwtSettings = new();
+ JwtSettings jwtSettings = new JwtSettings();
ConfigUtils.Instance.Bind("JwtSettings", jwtSettings);
if (jwtSettings == null || jwtSettings.SecretKey.IsEmpty())
{
- return null;
+ throw new Exception("JwtSettings获取失败");
}
var key = Encoding.ASCII.GetBytes(jwtSettings.SecretKey);
-
+
var tokenDescriptor = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
@@ -130,8 +127,6 @@ namespace ZR.Admin.WebApi.Framework
{
try
{
- //var userId = jwtToken.FirstOrDefault(x => x.Type == "primarysid").Value;
- //var userName = jwtToken.FirstOrDefault(x => x.Type == "unique_name").Value;
var userData = jwtToken.FirstOrDefault(x => x.Type == ClaimTypes.UserData).Value;
LoginUser loginUser = JsonConvert.DeserializeObject(userData);
diff --git a/ZR.Admin.WebApi/Startup.cs b/ZR.Admin.WebApi/Startup.cs
index 175e0b2..2ea41f1 100644
--- a/ZR.Admin.WebApi/Startup.cs
+++ b/ZR.Admin.WebApi/Startup.cs
@@ -50,12 +50,8 @@ namespace ZR.Admin.WebApi
services.AddSession();
services.AddHttpContextAccessor();
-
//Model
services.Configure(Configuration);
- services.Configure(Configuration);
- var jwtSettings = new JwtSettings();
- Configuration.Bind("JwtSettings", jwtSettings);
//Cookie ֤
services.AddAuthentication(options =>