Example #1
0
 /// <param name="bindAccount">返回绑定的账号(若未绑定返回空)</param>
 public bool Authorize(out OAuth2Account account)
 {
     account = null;
     if (Authorize())
     {
         account = GetBindAccount();
         return(true);
     }
     return(false);
 }
Example #2
0
        /// <summary>
        /// 读取已经绑定的账号
        /// </summary>
        /// <returns></returns>
        public OAuth2Account GetBindAccount()
        {
            OAuth2Account oa = new OAuth2Account();

            oa.Token       = token;
            oa.ExpireTime  = expiresTime;
            oa.NickName    = nickName;
            oa.HeadUrl     = headUrl;
            oa.BindAccount = "";
            return(oa);
        }
Example #3
0
        /// <summary>
        /// 添加绑定账号
        /// </summary>
        /// <param name="bindAccount"></param>
        /// <returns></returns>
        public bool SetBindAccount(string bindAccount)
        {
            bool result = false;

            if (!string.IsNullOrEmpty(openID) && !string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(bindAccount))
            {
                OAuth2Account oa = new OAuth2Account();
                oa.OAuthServer = server.ToString();
                oa.Token       = token;
                oa.OpenID      = openID;
                oa.ExpireTime  = expiresTime;
                oa.BindAccount = bindAccount;
                oa.NickName    = nickName;
                oa.HeadUrl     = headUrl;
                result         = true;//oa.Insert 执行添加操作
            }
            return(result);
        }