| | |
| | | /// <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()), |
| | |
| | | { |
| | | 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; |
| | | } |