예제 #1
0
        /// <summary>
        /// 读取
        /// </summary>
        /// <returns>数据</returns>
        public ReturnInfo <BasicUserInfo> Reader()
        {
            ReturnInfo <BasicUserInfo> returnInfo = new ReturnInfo <BasicUserInfo>();

            returnInfo.Data = HttpFormsAuthorizationUtil.ParseUserData <BasicUserInfo>();

            return(returnInfo);
        }
예제 #2
0
        /// <summary>
        /// 判断是否已授权
        /// </summary>
        /// <returns>返回信息</returns>
        public ReturnInfo <bool> IsAuthed()
        {
            ReturnInfo <bool> returnInfo = new ReturnInfo <bool>();

            returnInfo.Data = HttpFormsAuthorizationUtil.IsAuthenticated <BasicUserInfo>();

            return(returnInfo);
        }
        /// <summary>
        /// 退出
        /// </summary>
        /// <returns>返回信息</returns>
        public ReturnInfo <bool> Exit()
        {
            ReturnInfo <bool> returnInfo = new ReturnInfo <bool>();

            returnInfo.Data = HttpFormsAuthorizationUtil.RemoveAuthenticate();
            if (returnInfo.Data)
            {
                returnInfo.SetSuccessMsg("退出成功");
            }
            else
            {
                returnInfo.SetFailureMsg("退出失败");
            }

            return(returnInfo);
        }
 /// <summary>
 /// 保存用户信息
 /// </summary>
 /// <param name="basicUser">基本用户</param>
 protected override void SaveUserInfo(BasicUserInfo <int> basicUser) => HttpFormsAuthorizationUtil.SetAuthenticationCookie <BasicUserInfo <int> >(basicUser);