feat: 增加微信登陆认证模块
This commit is contained in:
parent
14567e29ab
commit
b1135d96f1
|
@ -3,6 +3,7 @@ using Bootstrap.DataAccess;
|
|||
using Longbow.GiteeAuth;
|
||||
using Longbow.GitHubAuth;
|
||||
using Longbow.Web;
|
||||
using Longbow.WeChatAuth;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
@ -199,5 +200,16 @@ namespace Bootstrap.Admin.Controllers
|
|||
var enabled = config.GetValue($"{nameof(GitHubOptions)}:Enabled", false);
|
||||
return Challenge(enabled ? GitHubDefaults.AuthenticationScheme : CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WeChat 认证
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IActionResult WeChat([FromServices]IConfiguration config)
|
||||
{
|
||||
var enabled = config.GetValue($"{nameof(GitHubOptions)}:Enabled", false);
|
||||
return Challenge(enabled ? WeChatDefaults.AuthenticationScheme : CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace Bootstrap.Admin
|
|||
services.AddSignalR().AddJsonProtocalDefault();
|
||||
services.AddSignalRExceptionFilterHandler<SignalRHub>((client, ex) => client.SendMessageBody(ex).ConfigureAwait(false));
|
||||
services.AddResponseCompression();
|
||||
services.AddBootstrapAdminAuthentication().AddGitee(OAuthHelper.Configure).AddGitHub(OAuthHelper.Configure);
|
||||
services.AddBootstrapAdminAuthentication().AddGitee(OAuthHelper.Configure).AddGitHub(OAuthHelper.Configure).AddWeChat(OAuthHelper.Configure);
|
||||
services.AddSwagger();
|
||||
services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
|
||||
services.AddBootstrapAdminBackgroundTask();
|
||||
|
|
|
@ -122,8 +122,8 @@
|
|||
</a>
|
||||
</div>
|
||||
<div class="item">
|
||||
<a href="#" data-toggle="tooltip" title="微信-暂未实现">
|
||||
<img class="item" src="~/images/weixin-2.svg" />
|
||||
<a href="~/Account/WeChat" data-toggle="tooltip" title="使用微信帐号登录">
|
||||
<img class="item" src="~/images/weixin.svg" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="item">
|
||||
|
|
|
@ -82,6 +82,16 @@
|
|||
"App": "0",
|
||||
"StarredUrl": "https://api.github.com/user/starred/ArgoZhang/BootstrapAdmin"
|
||||
},
|
||||
"WeChatOptions": {
|
||||
"Enabled": true,
|
||||
"ClientId": "wxe2944ebb9e66551c",
|
||||
"ClientSecret": "a4e36ddb18af218818e44bb7b8744fe6",
|
||||
"CallbackPath": "/signin-weixin",
|
||||
"HomePath": "/Admin/Profiles",
|
||||
"Scope": [ "snsapi_login" ],
|
||||
"Roles": [ "Administrators" ],
|
||||
"App": "0"
|
||||
},
|
||||
"SMSOptions": {
|
||||
"CompanyCode": "<CompanyCode>",
|
||||
"MD5Key": "MD5Key",
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="2.2.21" />
|
||||
<PackageReference Include="Longbow.Configuration" Version="2.2.7" />
|
||||
<PackageReference Include="Longbow.Data" Version="2.3.7" />
|
||||
<PackageReference Include="Longbow.Data" Version="2.3.8" />
|
||||
<PackageReference Include="Longbow.GiteeAuth" Version="2.2.0" />
|
||||
<PackageReference Include="Longbow.GitHubAuth" Version="2.2.0" />
|
||||
<PackageReference Include="Longbow.Logging" Version="2.2.13" />
|
||||
<PackageReference Include="Longbow.PetaPoco" Version="1.0.2" />
|
||||
<PackageReference Include="Longbow.Security.Cryptography" Version="1.3.0" />
|
||||
<PackageReference Include="Longbow.Web" Version="2.2.16" />
|
||||
<PackageReference Include="Longbow.WeChatAuth" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="PetaPoco.Extensions" Version="1.0.9" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue