From 17e4c7e3e7b3ef60d9da6de3b2a39a14a53c38a0 Mon Sep 17 00:00:00 2001 From: z8018 <1282578289@qq.com> Date: 星期三, 12 三月 2025 14:11:33 +0800 Subject: [PATCH] 1 --- WIDESEAWCS_Server/WIDESEAWCS_Core/Authorization/JwtHelper.cs | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Core/Authorization/JwtHelper.cs b/WIDESEAWCS_Server/WIDESEAWCS_Core/Authorization/JwtHelper.cs index 947fa4e..fc6da1b 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_Core/Authorization/JwtHelper.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_Core/Authorization/JwtHelper.cs @@ -22,7 +22,7 @@ /// <returns></returns> public static string IssueJwt(TokenModelJwt tokenModel) { - string exp = $"{new DateTimeOffset(DateTime.Now.AddMinutes(/*tokenModel.UserId == 1 ? 43200 : */AppSettings.app("ExpMinutes").ObjToInt())).ToUnixTimeSeconds()}"; + string exp = $"{new DateTimeOffset(DateTime.Now.AddMinutes(/*tokenModel.UserId == 1 ? 43200 : */AppSettings.Get("ExpMinutes").ObjToInt())).ToUnixTimeSeconds()}"; List<Claim> claims = new List<Claim> { new Claim(JwtRegisteredClaimNames.Jti, tokenModel.UserId.ToString()), @@ -61,6 +61,8 @@ { UserId = Convert.ToInt32(jwtToken.Id), RoleId = (jwtToken.Payload[ClaimTypes.Role] ?? 0).ObjToInt(), + UserName = (jwtToken.Payload[ClaimTypes.Name] ?? "")?.ToString() ?? "", + TenantId = (jwtToken.Payload[nameof(TokenModelJwt.TenantId)] ?? 0).ObjToInt(), }; return userInfo; } -- Gitblit v1.9.3