Exemple #1
0
 public void OnReadObject()
 {
     UseRequestHeader = !NeedResetTime();
     if (!UseRequestHeader)
     {
         ValidTime = JWTUtil.CalcValidTime();
     }
     IsLogOn = !string.IsNullOrEmpty(UserId.ConvertToString());
 }
Exemple #2
0
 public JWTUserInfo(string userName, string logOnName, object userId, object mainOrgId)
 {
     UserName         = userName;
     LogOnName        = logOnName;
     UserId           = userId;
     MainOrgId        = mainOrgId;
     IsLogOn          = true;
     PageSize         = PAGE_SIZE;
     UseRequestHeader = false;
     ValidTime        = JWTUtil.CalcValidTime();
 }
Exemple #3
0
 public JWTUserInfo(IUserInfo info)
 {
     if (info == null)
     {
         IsLogOn  = false;
         PageSize = PAGE_SIZE;
     }
     else
     {
         UserName  = info.UserName;
         LogOnName = info.LogOnName;
         UserId    = info.UserId;
         MainOrgId = info.MainOrgId;
         PageSize  = info.PageSize;
         if (info.RoleIds != null)
         {
             InternalRoleIds = new List <string>();
             foreach (var item in info.RoleIds)
             {
                 if (item != null)
                 {
                     InternalRoleIds.Add(item.ToString());
                 }
             }
         }
         IsLogOn          = info.IsLogOn;
         UseRequestHeader = false;
         if (IsLogOn)
         {
             ValidTime = JWTUtil.CalcValidTime();
         }
         if (info is JWTUserInfo jwt)
         {
             Host = jwt.Host;
             Port = jwt.Port;
         }
     }
 }