Beispiel #1
0
        public SsoUser GetUser()
        {
            //sso逻辑
            var token = HttpContext.Current.Request.QueryString["token"];

            if (token.IsNullOrEmpty())
            {
                token = CookieHelper.GetCookieValue("token");
            }
            //根据token 获取用户信息,并保存token
            if (!token.IsNullOrEmpty())
            {
                try
                {
                    var ssoserver    = ConfigSettingHelper.GetAppStr("ssoserver");
                    var userinfojson = ApiDataHelper.GetData(ssoserver + api + "?token=" + token);
                    var user         = JsonHelper.DeserializeObject <SsoUser>(userinfojson);
                    return(user);
                }
                catch (Exception ex)
                {
                    LogHelper.Error(ex);
                }
            }
            return(null);
        }
 /// <summary>
 /// 获取string 数据
 /// </summary>
 /// <param name="url"></param>
 /// <returns></returns>
 public static string GetData(this IKernel knl, string url)
 {
     return(ApiDataHelper.GetData(url));
 }