Beispiel #1
0
        public void SaveRequestSession<T>(T businessRequest, IHttpRequest httpRequest)
        {
            CustomUserSession userSession =
                GetRequestSession<T>(businessRequest, httpRequest);

            if (userSession != null)
            {
                RequestSessionFactory.Create<T>(httpRequest, businessRequest).
                    SaveRequestSession(userSession.TimeOut);
            }
        }
        public virtual void CheckUserSession()
        {
            RequestSessionManager <T> rsMgr = RequestSessionFactory.Create <T>(httpRequest, this.businessRequest);

            if (rsMgr.GetCookies().Length == 0)
            {
                //throw new ArgumentException("请求没有携带Cookie值!");

                if (this.IsNormal())
                {
                    return;
                }
            }

            CustomUserSession session = this.GetRequestSession();

            if (session == null)
            {
                throw new Exception("CustomUserSession缓存实例NULL");
            }

            if (this.IsNotAuthenticated())
            {
                string loginId = string.Empty;
                if (this.sessionDto != null)
                {
                    loginId = this.sessionDto.LoginId;
                }

                throw new Exception(string.Format("没有登录或登录过期"));
            }

            if (this.IsNotAuthority())
            {
                throw new Exception("没有授权");
            }
        }
Beispiel #3
0
 public static CustomUserSession GetRequestSession <T>(IHttpRequest serviceStackHttpRequest, T businessRequest)
 {
     return(RequestSessionFactory.Create <T>(serviceStackHttpRequest, businessRequest).GetRequestSession());
 }
Beispiel #4
0
 public static CustomUserSession GetRequestSession<T>(T businessRequest, IHttpRequest httpRequest)
 {
     return RequestSessionFactory.Create<T>(httpRequest, businessRequest).GetRequestSession();
 }
Beispiel #5
0
 public static void CheckUserSession <T>(IHttpRequest serviceStackHttpRequest, T businessRequest)
 {
     RequestSessionFactory.Create <T>(serviceStackHttpRequest, businessRequest).CheckUserSession();
 }