|
|
@@ -73,9 +73,10 @@ namespace CallCenterApi.Interface
|
|
73
|
73
|
context.Response.Write(new AjaxResult { state = ResultTypes.error.ToString(), message = "非法输入!" }.ToJson());
|
|
74
|
74
|
context.Response.End();
|
|
75
|
75
|
}
|
|
|
76
|
+
|
|
|
77
|
+ var log = LogFactory.GetLogger(this.GetType().ToString());
|
|
76
|
78
|
if (Configs.GetValue("IsLog").ToString() == "1")
|
|
77
|
79
|
{
|
|
78
|
|
- var log = LogFactory.GetLogger(this.GetType().ToString());
|
|
79
|
80
|
log.Debug(Params.ToJson());
|
|
80
|
81
|
}
|
|
81
|
82
|
|
|
|
@@ -87,31 +88,37 @@ namespace CallCenterApi.Interface
|
|
87
|
88
|
}
|
|
88
|
89
|
try
|
|
89
|
90
|
{
|
|
90
|
|
- ////获取缓存
|
|
91
|
|
- //var dict = CacheHelper.Get(token);
|
|
92
|
|
- //获取redis缓存
|
|
93
|
|
- var dict = RedisHelper.StringGet(CommonHelper.MD5(token));
|
|
|
91
|
+ //////获取缓存
|
|
|
92
|
+ ////var dict = CacheHelper.Get(token);
|
|
|
93
|
+ ////获取redis缓存
|
|
|
94
|
+ //var dict = RedisHelper.StringGet(CommonHelper.MD5(token));
|
|
94
|
95
|
|
|
95
|
|
- if (dict == null)
|
|
96
|
|
- {
|
|
97
|
|
- //log.Debug(Params.ToJson());
|
|
98
|
|
- return;
|
|
99
|
|
- }
|
|
|
96
|
+ //if (dict == null)
|
|
|
97
|
+ //{
|
|
|
98
|
+ // //log.Debug(Params.ToJson());
|
|
|
99
|
+ // return;
|
|
|
100
|
+ //}
|
|
100
|
101
|
Dictionary<string, string> userData = null;
|
|
101
|
102
|
//获取FormsAuthenticationTicket对象
|
|
102
|
103
|
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(token);
|
|
103
|
|
- if (ticket != null && string.IsNullOrEmpty(ticket.UserData) == false)
|
|
104
|
|
- userData = (new JavaScriptSerializer()).Deserialize<Dictionary<string, string>>(ticket.UserData); //还原用户数据
|
|
105
|
|
- if (ticket != null && userData != null)
|
|
106
|
|
- context.User = new FormsPrincipal<Dictionary<string, string>>(ticket, userData);//重新给context.User赋值。
|
|
107
|
|
-
|
|
|
104
|
+ if (ticket != null)
|
|
|
105
|
+ {
|
|
|
106
|
+ if (!ticket.Expired)
|
|
|
107
|
+ {
|
|
|
108
|
+ if (!string.IsNullOrEmpty(ticket.UserData))
|
|
|
109
|
+ userData = (new JavaScriptSerializer()).Deserialize<Dictionary<string, string>>(ticket.UserData); //还原用户数据
|
|
|
110
|
+ if (userData != null)
|
|
|
111
|
+ context.User = new FormsPrincipal<Dictionary<string, string>>(ticket, userData);//重新给context.User赋值。
|
|
|
112
|
+ }
|
|
|
113
|
+ //log.Debug(ticket.ToJson());
|
|
|
114
|
+ }
|
|
108
|
115
|
//var obj = new { UserCode = userData["F_UserCode"], Params = Params };
|
|
109
|
116
|
//log.Debug(Params.ToJson());
|
|
110
|
117
|
|
|
111
|
118
|
}
|
|
112
|
|
- catch {
|
|
|
119
|
+ catch (Exception ex){
|
|
113
|
120
|
/* 有异常也不要抛出,防止攻击者试探。 */
|
|
114
|
|
- //log.Debug(Params.ToJson());
|
|
|
121
|
+ log.Debug(ex.ToString());
|
|
115
|
122
|
}
|
|
116
|
123
|
}
|
|
117
|
124
|
|