diff --git a/src/Destiny.Core.Flow.AuthenticationCenter/Destiny.Core.Flow.AuthenticationCenter.csproj b/src/Destiny.Core.Flow.AuthenticationCenter/Destiny.Core.Flow.AuthenticationCenter.csproj index d5bfa86a..92946160 100644 --- a/src/Destiny.Core.Flow.AuthenticationCenter/Destiny.Core.Flow.AuthenticationCenter.csproj +++ b/src/Destiny.Core.Flow.AuthenticationCenter/Destiny.Core.Flow.AuthenticationCenter.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Destiny.Core.Flow.AuthenticationCenter/Quickstart/Account/AccountController.cs b/src/Destiny.Core.Flow.AuthenticationCenter/Quickstart/Account/AccountController.cs index ebefe31b..64c1b146 100644 --- a/src/Destiny.Core.Flow.AuthenticationCenter/Quickstart/Account/AccountController.cs +++ b/src/Destiny.Core.Flow.AuthenticationCenter/Quickstart/Account/AccountController.cs @@ -19,6 +19,7 @@ using Microsoft.AspNetCore.Mvc; using System; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace IdentityServerHost.Quickstart.UI @@ -172,7 +173,7 @@ public async Task Login(LoginInputModel model, string button) } else if (string.IsNullOrEmpty(model.ReturnUrl)) { - return Redirect("~/"); + return Redirect("/Home/Index"); } else { @@ -374,5 +375,28 @@ private async Task BuildLoggedOutViewModelAsync(string logou return vm; } + + /// + /// 打开qq授权页面 + /// + /// + public virtual IActionResult QQAuthorize() + { + var appId = "101945230"; + var url = string.Format("https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id={0}&redirect_uri={1}&state=State", appId, WebUtility.UrlEncode("http://localhost:50001/signin-qq")); + return new RedirectResult(url); + } + /// + /// QQ回掉方法 + /// + /// + public virtual IActionResult QQCallbackLogin() + { + //var code = Request.Query["code"]; + //var token = GetAuthorityAccessToken(code); + //var dis = GetAuthorityOpendIdAndUnionId(token); + //var userInfo = GetUserInfo(token, dis["openid"]); + return null; + } } } diff --git a/src/Destiny.Core.Flow.AuthenticationCenter/Startups/IdentityModule.cs b/src/Destiny.Core.Flow.AuthenticationCenter/Startups/IdentityModule.cs index a9133623..c7f40342 100644 --- a/src/Destiny.Core.Flow.AuthenticationCenter/Startups/IdentityModule.cs +++ b/src/Destiny.Core.Flow.AuthenticationCenter/Startups/IdentityModule.cs @@ -1,6 +1,5 @@ using Destiny.Core.Flow.Model.Entities.Identity; using Destiny.Core.Flow.Model.Security; -using Microsoft.AspNetCore.Authentication.QQ; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using System; @@ -17,11 +16,11 @@ public class IdentityModule : IdentityModuleBase - //{ - - // x.AppId - //}); + services.AddAuthentication().AddQQ(x => + { + x.ClientId = "adasdasd"; + x.ClientSecret = "asdasdadas"; + }); } protected override Action IdentityOption() diff --git a/src/Destiny.Core.Flow.AuthenticationCenter/Views/Account/Login.cshtml b/src/Destiny.Core.Flow.AuthenticationCenter/Views/Account/Login.cshtml index 3487bafe..a6239a27 100644 --- a/src/Destiny.Core.Flow.AuthenticationCenter/Views/Account/Login.cshtml +++ b/src/Destiny.Core.Flow.AuthenticationCenter/Views/Account/Login.cshtml @@ -35,7 +35,7 @@
- + QQ
@@ -55,7 +55,7 @@
  • @provider.DisplayName