Пример #1
0
        public virtual ISessionKey Current()
        {
            try
            {
                ISessionKey user = GetCallContextValue("FBState") as ISessionKey;
                if (user == null)
                {
                    if (user != null)
                    {
                        return(user);
                    }
                    user = new ISessionKey();
                    var cookie = CookieHelper.GetCookie(SYSConstants.LoginJWTKey);
                    // Session build
                    user = StateChecker.CheckAuthString(cookie);
                    // StateCheck 验证当前登录状态 todo

                    // Add Context
                    SetCallContextValue("FBState", user);
                }
                // 这里可以做线程缓存处理 ?这里需要check校验? 分两步 第一步bulid 然后校验
                return(user);
            }
            catch (Exception ex)
            {
                //return new ISessionKey();
                throw new Exception(ex.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// 是否为有效的JWTtoken
 /// </summary>
 /// <returns></returns>
 public string IsAuthJWT()
 {
     try
     {
         var cookie = CookieHelper.GetCookie(SYSConstants.LoginJWTKey);
         StateChecker.CheckAuthString(cookie);
         return("");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }