Exemplo n.º 1
0
        public bool SSOLogout(LoginInfoDto loginInfo)
        {
            bool result = false;

            var oAuthValidateDto = GetOAuthValidateDto(loginInfo.AccessToken);

            if (oAuthValidateDto != null)
            {
                SessionModel sessionModel = new SessionModel()
                {
                    SessionID = oAuthValidateDto.Code
                };

                if (sessionManager.IsExist(sessionModel))
                {
                    result = sessionManager.RemoveSession(sessionModel);
                }
                else
                {
                    result = true;
                }
                if (result)
                {
                    OAuthValidateDto dto = new OAuthValidateDto()
                    {
                        Code = oAuthValidateDto.Code
                    };

                    result = oAuthValidateRepository.Delete(dto.ToEntity()) > 0;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存验证成功后的你登录信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool Save(OAuthValidateDto dto)
        {
            //是否已经登录
            bool result     = false;
            var  loginModel = IsLogin(dto);

            if (loginModel != null)
            {
                //
                Repository.Delete(loginModel.Code);
            }
            result = Repository.Add(dto.ToEntity()) > 0;

            return(result);
        }