Exemple #1
0
        internal static void LogicSessionUpdateFromAuthSessionTask()
        {
            bool flag = !AuthUtils.IsCheckAuthSession();

            if (!flag)
            {
                DateTime dateTime = AppRuntime.ServerDateTime.AddMinutes(-480.0);
                Database database = LogicContext.GetDatabase();
                HSQL     sql      = new HSQL(database);
                sql.Clear();
                sql.Raw = true;
                sql.Add("select AUTH_SESSIONID,AUTH_USERID,AUTH_LASTREFRESH,AUTH_LASTREQUEST");
                sql.Add("from AUTH");
                sql.Add("where AUTH_SESSIONID <> :AUTH_SESSIONID");
                sql.ParamByName("AUTH_SESSIONID").Value = "876978727978717673657871";
                DataSet dataSet = database.OpenDataSet(sql);
                for (int index = 0; index < dataSet.Tables[0].Rows.Count; index++)
                {
                    string sessionId = dataSet.Tables[0].Rows[index]["AUTH_SESSIONID"].ToString().Trim();
                    dataSet.Tables[0].Rows[index]["AUTH_USERID"].ToString().Trim();
                    bool flag2 = dataSet.Tables[0].Rows[index]["AUTH_LASTREQUEST"].ToString().ToDateTime() < dateTime;
                    if (flag2)
                    {
                        AuthUtils.DeleteAuth(sessionId);
                    }
                    else
                    {
                        AuthUtils.UpdateAuthLastRefresh(sessionId);
                    }
                    Thread.Sleep(100);
                }
            }
        }
Exemple #2
0
        internal static void SignOut()
        {
            LogicContext current = LogicContext.Current;
            bool         flag    = current == null;

            if (!flag)
            {
                LogicSession userSession = current.UserSession;
                bool         flag2       = userSession != null;
                if (flag2)
                {
                    object lockObj = AuthUtils._lockObj;
                    lock (lockObj)
                    {
                        AuthUtils.GlobalLogicSession.Remove(userSession.SessionId);
                        userSession.Ignore = true;
                        AuthUtils.DeleteAuth(userSession.SessionId);
                    }
                }
            }
        }