Exemplo n.º 1
0
        public async Task <UserView> SigninByGit(GitSignInPara data)
        {
            UserView user = new UserView();

            if (User.Identity.IsAuthenticated)
            {
                string accountSource = CookieUtil.GetCookie(AccountSource.LoginSource, User);
                if (accountSource == AccountSource.Git)
                {
                    //直接返回cookie中的结果,并建立session
                    user = SignInService.GetGitUser();
                }
            }
            else
            {
                //没有授权 先获取授权,插入自己的库,再加cookie
                user = await SignInService.OauthFromGit(data);
            }

            return(user);
        }