Compare commits

...

24 Commits

Author SHA1 Message Date
zhangpeihang 76126b05d1 fix: 修复 EFCore 创建用户时不创建默认角色 2022-03-04 22:31:46 +08:00
Argo-Tianyi 32d74ea81a feat: 完善菜单维护父级菜单功能 2022-03-04 22:31:46 +08:00
Argo-Tianyi 1f2a169cc7 style: 侧边栏增加竖线分割 2022-03-04 22:31:46 +08:00
Argo-Lenovo ed77ed0059 feat: 增加任务日志滚动条样式 2022-03-04 22:31:46 +08:00
Argo-Lenovo 453c2a6446 feat: 任务日志增加最大数功能 2022-03-04 22:31:46 +08:00
Argo-Lenovo dc93fa9c7b feat: 增加任务日志功能 2022-03-04 22:31:45 +08:00
Argo-Lenovo ddffcae1bf feat: 实现缓存清楚逻辑 2022-03-04 22:31:45 +08:00
zhangpeihang 4ee2e69a25 feat: 初始化vue项目 2022-01-29 15:00:26 +08:00
zhangpeihang a1736215e6 refactor: 初始化控制器 2022-01-29 14:59:58 +08:00
zhangpeihang 8f479da90a feat: 登录接口 2022-01-29 14:59:22 +08:00
zhangpeihang 7482183c48 feat: 添加 vue 为子项目 2022-01-29 13:56:37 +08:00
Argo-Tianyi a0509aea4b fix: 修复 Client 工程编译报错问题 2022-01-29 13:56:37 +08:00
Argo-Tianyi 955f65a7aa feat: 登录首页增加切换功能 2022-01-29 13:56:37 +08:00
Argo-Tianyi 84422250c6 feat: 增加 AdminLoginFooter 组件用于切换登录页 2022-01-29 13:56:37 +08:00
Argo-Tianyi 7ef733c28c feat: 增加码云高仿登录界面 2022-01-29 13:56:37 +08:00
Argo-Tianyi 1fdb4f014b feat: 增加登录首页切换功能 2022-01-29 13:56:36 +08:00
Argo-Tianyi 7a35184c4c feat: 登录首页配置增加顺序 2022-01-29 13:56:36 +08:00
Argo-Tianyi 15c311b3d1 refactor: 改造登录首页组件 2022-01-29 13:56:36 +08:00
Argo-Tianyi ce9cc849d4 feat: 增加更新 DisplayName 逻辑 2022-01-29 13:56:36 +08:00
Argo-Tianyi f748b69dfe chore: 更新依赖包 2022-01-29 13:56:35 +08:00
zhangpeihang 8357e17d1d refactor: 移除无用命名空间 2022-01-27 17:34:11 +08:00
zhangpeihang fa7fae9575 feat: 添加 字典 菜单 角色 用户 控制器 2022-01-27 17:33:50 +08:00
zhangpeihang 75716a9444 feat: api 改为小写 2022-01-27 17:33:05 +08:00
zhangpeihang 52a69ec511 feat: 初始化 api 项目 2022-01-27 13:37:25 +08:00
63 changed files with 2266 additions and 148 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/vue/admin"]
path = src/vue/admin
url = https://gitee.com/zhangpeihang/vue-vben-admin.git

View File

@ -157,7 +157,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapClient.Web", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootStarpAdmin.DataAccess.FreeSql", "src\blazor\admin\BootStarpAdmin.DataAccess.FreeSql\BootStarpAdmin.DataAccess.FreeSql.csproj", "{11122D97-B349-4A3E-B7DD-73B8B363C47C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootStarpAdmin.DataAccess.SqlSugar", "src\blazor\admin\BootStarpAdmin.DataAccess.SqlSugar\BootStarpAdmin.DataAccess.SqlSugar.csproj", "{1D20E6CF-9825-4CDE-B732-AE586BD1AABA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootStarpAdmin.DataAccess.SqlSugar", "src\blazor\admin\BootStarpAdmin.DataAccess.SqlSugar\BootStarpAdmin.DataAccess.SqlSugar.csproj", "{1D20E6CF-9825-4CDE-B732-AE586BD1AABA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapClient.Web.Core", "src\blazor\client\BootstrapClient.Web.Core\BootstrapClient.Web.Core.csproj", "{FFDF9FF9-0B29-47D3-AD42-53A476B570EC}"
EndProject
@ -165,6 +165,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapClient.DataAccess.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapAdmin.Caching", "src\blazor\admin\BootstrapAdmin.Caching\BootstrapAdmin.Caching.csproj", "{ADD20515-1C1C-418B-84F6-8B05A7AA315B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vue", "vue", "{31F93CAE-7ADD-490F-A129-49D90FE4574A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{FED2B095-F0EA-4E52-A095-BD4C5AEA5C04}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapAdmin.Api", "src\vue\api\BootstrapAdmin.Api\BootstrapAdmin.Api.csproj", "{7B38D4EF-9297-40B4-ADA5-0A67FC82CF1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -251,6 +257,10 @@ Global
{ADD20515-1C1C-418B-84F6-8B05A7AA315B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADD20515-1C1C-418B-84F6-8B05A7AA315B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADD20515-1C1C-418B-84F6-8B05A7AA315B}.Release|Any CPU.Build.0 = Release|Any CPU
{7B38D4EF-9297-40B4-ADA5-0A67FC82CF1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B38D4EF-9297-40B4-ADA5-0A67FC82CF1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B38D4EF-9297-40B4-ADA5-0A67FC82CF1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B38D4EF-9297-40B4-ADA5-0A67FC82CF1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -293,6 +303,9 @@ Global
{FFDF9FF9-0B29-47D3-AD42-53A476B570EC} = {55A2459A-6BDE-4493-B2C0-5BE1673E99EE}
{CC3DF23A-2880-438F-BDEB-DB093E919ABA} = {55A2459A-6BDE-4493-B2C0-5BE1673E99EE}
{ADD20515-1C1C-418B-84F6-8B05A7AA315B} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
{31F93CAE-7ADD-490F-A129-49D90FE4574A} = {41B6D37A-5E5E-42B3-85E4-D81A81E3D757}
{FED2B095-F0EA-4E52-A095-BD4C5AEA5C04} = {31F93CAE-7ADD-490F-A129-49D90FE4574A}
{7B38D4EF-9297-40B4-ADA5-0A67FC82CF1C} = {FED2B095-F0EA-4E52-A095-BD4C5AEA5C04}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {221EAE38-5F75-4391-9A48-E462A9F3B8FC}

View File

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.2.7" />
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta07" />
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.0.100" />
</ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.2.7" />
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta07" />
<PackageReference Include="SqlSugarCore" Version="5.0.5.2" />
</ItemGroup>

View File

@ -71,9 +71,9 @@ class DefaultCacheManager : ICacheManager
{
Cache.Remove(key);
}
else
else if (Cache is MemoryCache c)
{
//Cache.Compact(100);
c.Compact(100);
}
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta06" />
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta07" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1" />
</ItemGroup>

View File

@ -306,6 +306,7 @@ public class UserService : IUser
Password = pwd
};
dbcontext.Add(user);
ret = dbcontext.SaveChanges() > 0;
// 授权 Default 角色
dbcontext.Database.ExecuteSqlRaw("insert into UserRole (UserID, RoleID) select ID, (select ID from Roles where RoleName = 'Default') RoleId from Users where UserName = {0}", userName);
ret = dbcontext.SaveChanges() > 0;

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta06" />
<PackageReference Include="BootstrapBlazor" Version="6.3.4-beta03" />
<PackageReference Include="Longbow.Security.Cryptography" Version="5.2.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.1" />
<PackageReference Include="PetaPoco.Extensions" Version="6.0.0" />

View File

@ -1,4 +1,6 @@
<form method="post" class="form-signin" action="@PostUrl" @ref="LoginForm">
<div class="wrap white">
<div class="container">
<form method="post" class="form-signin" action="@PostUrl" @ref="LoginForm">
<h2 class="form-signin-heading">@Title</h2>
<div class="@ClassString">
@if (AllowMobile)
@ -32,4 +34,6 @@
</div>
</Block>
</div>
</form>
</form>
</div>
</div>

View File

@ -3,6 +3,7 @@
// Website: https://admin.blazor.zone
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Utils;
using Microsoft.JSInterop;
namespace BootstrapAdmin.Web.Components;
@ -12,19 +13,40 @@ namespace BootstrapAdmin.Web.Components;
/// </summary>
public partial class AdminLogin : IDisposable
{
private string? Title { get; set; }
/// <summary>
///
/// </summary>
protected string? Title { get; set; }
private bool AllowMobile { get; set; } = true;
/// <summary>
///
/// </summary>
protected bool AllowMobile { get; set; } = true;
private bool UseMobileLogin { get; set; }
/// <summary>
///
/// </summary>
protected bool UseMobileLogin { get; set; }
private bool AllowOAuth { get; set; } = true;
/// <summary>
///
/// </summary>
protected bool AllowOAuth { get; set; } = true;
private bool RememberPassword { get; set; }
/// <summary>
///
/// </summary>
protected bool RememberPassword { get; set; }
private ElementReference LoginForm { get; set; }
/// <summary>
///
/// </summary>
protected ElementReference LoginForm { get; set; }
private string? PostUrl { get; set; }
/// <summary>
///
/// </summary>
protected string? PostUrl { get; set; }
private JSInterop<AdminLogin>? Interop { get; set; }
@ -40,13 +62,19 @@ public partial class AdminLogin : IDisposable
[Parameter]
public string? AppId { get; set; }
/// <summary>
///
/// </summary>
[Inject]
[NotNull]
private IDict? DictsService { get; set; }
protected IDict? DictsService { get; set; }
/// <summary>
///
/// </summary>
[Inject]
[NotNull]
private ILogin? LoginService { get; set; }
protected ILogin? LoginService { get; set; }
[Inject]
[NotNull]
@ -57,7 +85,7 @@ public partial class AdminLogin : IDisposable
/// </summary>
[Inject]
[NotNull]
private WebClientService? WebClientService { get; set; }
protected WebClientService? WebClientService { get; set; }
/// <summary>
///
@ -66,7 +94,10 @@ public partial class AdminLogin : IDisposable
[NotNull]
private IIPLocatorProvider? IPLocatorProvider { get; set; }
private string? ClassString => CssBuilder.Default("login-wrap")
/// <summary>
///
/// </summary>
protected string? ClassString => CssBuilder.Default("login-wrap")
.AddClass("is-mobile", UseMobileLogin)
.Build();
@ -78,17 +109,20 @@ public partial class AdminLogin : IDisposable
base.OnInitialized();
Title = DictsService.GetWebTitle();
PostUrl = QueryHelper.AddQueryString("/Account/Login", new Dictionary<string, string?>
PostUrl = QueryHelper.AddQueryString("Account/Login", new Dictionary<string, string?>
{
["ReturnUrl"] = ReturnUrl,
["AppId"] = AppId
});
}
void OnClickSwitchButton()
/// <summary>
///
/// </summary>
protected void OnClickSwitchButton()
{
var rem = RememberPassword ? "true" : "false";
PostUrl = QueryHelper.AddQueryString(UseMobileLogin ? "/Account/Mobile" : "/Account/Login", new Dictionary<string, string?>()
PostUrl = QueryHelper.AddQueryString(UseMobileLogin ? "Account/Mobile" : "Account/Login", new Dictionary<string, string?>()
{
[nameof(ReturnUrl)] = ReturnUrl,
["AppId"] = AppId,
@ -113,18 +147,29 @@ public partial class AdminLogin : IDisposable
}
}
Task OnRememberPassword(bool remember)
/// <summary>
///
/// </summary>
/// <param name="remember"></param>
/// <returns></returns>
protected Task OnRememberPassword(bool remember)
{
OnClickSwitchButton();
return Task.CompletedTask;
}
void OnSignUp()
/// <summary>
///
/// </summary>
protected void OnSignUp()
{
}
void OnForgotPassword()
/// <summary>
///
/// </summary>
protected void OnForgotPassword()
{
}

View File

@ -1,4 +1,29 @@
.form-signin-heading {
.wrap {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
@media (min-width: 768px) {
.wrap {
background-color: #5bc0de;
background: url('../images/bg2.jpg') fixed no-repeat;
background-size: 100% 100%;
}
.container {
background: url('../images/bg3.png') no-repeat;
background-size: contain;
width: 704px;
height: 404px;
margin: 0 auto;
margin-top: calc(100vh / 2 - 190px);
}
}
.form-signin-heading {
margin: 0;
padding: 20px 15px;
text-align: center;
@ -123,3 +148,17 @@
color: #e0e0e0;
}
}
@media (min-width: 768px) {
.gitee.wrap {
background-color: #f1f2f7;
background-image: none;
}
.gitee .container {
width: 704px;
height: 404px;
margin: 0 auto;
margin-top: calc(100vh / 2 - 190px);
}
}

View File

@ -0,0 +1,11 @@
<div class="login-footer">
<ul class="login-footer-body">
<li><a href="https://www.gitee.com/LongbowEnterprise" target="_blank"><i class="fa fa-copyright"></i> Bootstrap Admin</a></li>
<li><a href="https://www.gitee.com/LongbowEnterprise/BootstrapAdmin/wikis" target="_blank">帮助文档</a></li>
<li><a href="Account/Login?View=Login">系统默认</a></li>
<li><a href="Account/Login?View=Login-Gitee">高仿码云</a></li>
<li><a href="Account/Login?View=Login-Blue">蓝色简约</a></li>
<li><a href="Account/Login?View=Login-Tec">科技动感</a></li>
<li><a href="Account/Login?View=Login-LTE">Admin-LTE</a></li>
</ul>
</div>

View File

@ -0,0 +1,24 @@
.login-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: center;
}
.login-footer-body {
display: flex;
}
li {
list-style: none;
}
li:not(:last-child) {
margin-right: 1rem;
}
.white + .login-footer li a {
color: #fff;
}

View File

@ -0,0 +1,68 @@
@inherits AdminLogin
<div class="wrap">
<div class="container">
<section class="login-sidebox">
<div class="login-sidebox-content">
<div class="login-sidebox-header">
<div class="login-sidebox-logo">
<img alt="logo" src="../favicon.png"><span>Bootstrap Admin</span>
</div>
<h2 class="login-sidebox-subtitle">
通用后台权限管理系统
</h2>
</div>
<div class="login-sidebox-body">
<p>
基于 RBAC 的 NetCore 后台管理框架权限管理前后台分离支持多站点单点登录兼容所有主流浏览器内置微信、支付宝、QQ等多种登录方式内置多种样式可切换至 Blazor 多 Tabs 模式,权限控制细化到网页内任意元素(按钮、表格、文本框等等)
</p>
</div>
<div class="login-sidebox-footer">
<div>开源文档:<a href="https://gitee.com/LongbowEnterprise/BootstrapAdmin/wikis">码云托管平台 - Wiki</a></div>
</div>
</div>
</section>
<section class="login-form">
<div class="login-form-header">
<h2>登录</h2>
<span class="flex-self-end">
没有帐号?
<LinkButton Text="申请账号" OnClick="OnSignUp" />
</span>
</div>
<form method="post" class="form-signin" action="@PostUrl" @ref="LoginForm">
<div class="@ClassString">
@if (AllowMobile)
{
<div class="login-sms">
<SMSLogin />
</div>
}
<div class="login-up">
<UserLogin />
</div>
</div>
<div class="d-flex justify-content-between mt-4">
<Checkbox @bind-Value="RememberPassword" Color="Color.Primary" ShowAfterLabel="true" DisplayText="记住密码自动登录" OnValueChanged="OnRememberPassword" />
<Block Condition="AllowMobile">
<SwitchButton @bind-ToggleState="UseMobileLogin" OnClick="OnClickSwitchButton" OffText="短信验证登录" OnText="用户密码登录" />
</Block>
</div>
<button class="btn-login btn-lg btn-block mt-4" data-bs-toggle="tooltip" title="不填写密码默认使用 Gitee 认证">登 录</button>
<div class="d-flex justify-content-center mt-3 mb-4">
<LinkButton Text="已有账号,忘记密码?" OnClick="OnForgotPassword" />
</div>
<Block Condition="AllowOAuth">
<Divider Text="其他方式登录" />
<div class="login-list">
<LinkButton Url="Account/Gitee" Title="使用 Gitee 帐号登录" ImageUrl="images/gitee.svg" />
<LinkButton Url="Account/Gitee" Title="使用 GitHub 帐号登录" ImageUrl="images/git.svg" />
<LinkButton Url="#" Title="微信-暂未实现" ImageUrl="images/weixin-2.svg" />
<LinkButton Url="Account/Tencent" Title="使用 QQ 账号登录" ImageUrl="images/qq.svg" />
<LinkButton Url="Account/Alipay" Title="使用支付宝账号登录" ImageUrl="images/zhifubao.svg" />
</div>
</Block>
</form>
</section>
</div>
</div>

View File

@ -0,0 +1,228 @@
.wrap {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
color: #40485b;
background-color: #f1f2f7;
-webkit-font-smoothing: antialiased;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
}
.container {
display: flex;
box-shadow: 0px 20px 80px 0px rgb(0 0 0 / 30%);
width: 1000px;
height: 500px;
padding: 0;
margin: 0 auto;
margin-top: calc(100vh / 2 - 275px);
}
section {
width: 50%;
}
.login-sidebox {
position: relative;
background: -webkit-gradient(linear, left bottom, left top, from(#3a485a), to(#607089));
background: linear-gradient(0deg, #3a485a 0%, #607089 100%);
color: #fff;
}
.login-sidebox::before,
.login-sidebox::after {
content: '';
top: 0;
right: 0;
bottom: 0;
left: 0;
position: absolute;
}
.login-sidebox::before {
background: url(../images/left-1.png) no-repeat 0 0;
}
.login-sidebox::after {
background: url(../images/left-2.png) no-repeat right bottom;
}
.login-sidebox .login-sidebox-content {
padding: 80px 80px 48px;
position: relative;
z-index: 1;
}
.login-sidebox-header {
margin-bottom: 40px;
}
.login-sidebox-logo {
display: flex;
align-items: center;
margin-bottom: 14px;
}
.login-sidebox-logo img {
width: 48px;
height: auto;
border-radius: 50%;
margin-right: 14px;
}
.login-sidebox-logo span {
display: inline;
font-size: 1.5rem;
font-weight: 700;
}
.login-sidebox-subtitle {
font-size: 20pt;
font-weight: normal;
}
.login-sidebox-footer {
margin-top: 40px;
border-top: solid 1px #ddd;
padding-top: 28px;
font-size: 0.875rem;
font-weight: 500;
}
.login-sidebox-footer a {
cursor: pointer;
color: #fff;
}
.login-form {
padding: 64px;
font-size: 0.875rem;
}
.login-form-header {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 20px;
}
.login-form-header h2 {
margin-bottom: 0;
font-size: 24px;
font-weight: bold;
line-height: 32px;
}
.login-list {
display: flex;
justify-content: space-between;
}
.login-list .item {
width: 32px;
height: 32px;
}
.forget-password {
padding: 16px 0;
}
.form-signin-heading {
margin: 0;
padding: 20px 15px;
text-align: center;
background-color: #41cac0;
border-radius: 5px 5px 0 0;
color: #fff;
}
.login-sms,
.is-mobile .login-up {
display: none;
}
.is-mobile .login-sms {
display: block;
}
::deep .btn-login {
color: #fff;
background: #fe7300;
border-color: transparent;
text-transform: uppercase;
font-weight: 300;
font-family: 'Open Sans', sans-serif;
line-height: 1;
}
::deep .btn-login:hover {
background: #fe7300;
}
::deep .divider-wrap {
background-color: #7c86bb;
}
::deep .divider-text {
background-color: #f1f2f7;
}
.login-list {
display: flex;
justify-content: space-between;
}
.login-list ::deep img {
width: 32px;
height: 32px;
}
::deep .btn-sms {
width: 140px;
}
@media (max-width: 767px) {
.form-signin {
margin: 0 auto;
background: #fff;
border-radius: 5px;
max-width: 320px;
border: solid 1px #ddd;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
}
}
@media (min-width: 768px) {
.form-signin-heading {
padding: 28px 0;
background-color: transparent;
}
.slidercaptcha {
width: 300px;
}
.slidercaptcha, .slidercaptcha.oauth {
height: 280px;
}
.slidercaptcha.card .card-body {
padding: 15px 15px 0 15px;
}
.login-footer {
width: 100%;
display: flex;
justify-content: space-around;
}
.login-footer .login-footer-body li a {
color: #e0e0e0;
}
}
::deep .divider {
margin: 1.5rem 0;
}

View File

@ -0,0 +1,29 @@
<div class="row g-3 form-inline">
<div class="col-12 col-sm-6 col-md-6">
<BootstrapInput @bind-Value="Value.Name" DisplayText="菜单名称" ShowLabel="true"></BootstrapInput>
</div>
<div class="col-12 col-sm-6 col-md-6">
<MenuTree @bind-Value="Value.ParentId" Lookup="@ParementMenus" DisplayText="父级菜单"></MenuTree>
</div>
<div class="col-12 col-sm-6 col-md-6">
<BootstrapInput @bind-Value="Value.Order"></BootstrapInput>
</div>
<div class="col-12 col-sm-6 col-md-6">
<BootstrapInput @bind-Value="Value.Icon"></BootstrapInput>
</div>
<div class="col-12">
<BootstrapInput @bind-Value="Value.Url"></BootstrapInput>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select @bind-Value="Value.Category"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select Items="@Targets" @bind-Value="Value.Target"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select @bind-Value="Value.IsResource"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select Items="@Apps" @bind-Value="Value.Application"></Select>
</div>
</div>

View File

@ -0,0 +1,42 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.DataAccess.Models;
namespace BootstrapAdmin.Web.Components;
public partial class MenuEditor
{
/// <summary>
///
/// </summary>
[Parameter]
[EditorRequired]
[NotNull]
public Navigation? Value { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
[EditorRequired]
[NotNull]
public List<SelectedItem>? ParementMenus { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
[EditorRequired]
[NotNull]
public List<SelectedItem>? Targets { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
[EditorRequired]
[NotNull]
public List<SelectedItem>? Apps { get; set; }
}

View File

@ -0,0 +1,8 @@
<div class="tree-dialog">
<label class="form-label">@DisplayText</label>
<BootstrapInputGroup>
<Display Value="Value" Lookup="Lookup" ShowLabel="false"></Display>
<Button Icon="fa fa-times" Color="Color.Secondary" OnClick="OnClearText"></Button>
<Button Icon="fa fa-bars" OnClick="OnSelectMenu"></Button>
</BootstrapInputGroup>
</div>

View File

@ -0,0 +1,87 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Services;
using Microsoft.AspNetCore.Components.Web;
namespace BootstrapAdmin.Web.Components;
/// <summary>
///
/// </summary>
public partial class MenuTree
{
/// <summary>
///
/// </summary>
[Parameter]
[NotNull]
public List<SelectedItem>? Lookup { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
[NotNull]
public string? DisplayText { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
[NotNull]
public string? Value { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
[NotNull]
public EventCallback<string> ValueChanged { get; set; }
[Inject]
[NotNull]
private DialogService? DialogService { get; set; }
private DialogOption? Option { get; set; }
private async Task OnSelectMenu()
{
Option = new DialogOption()
{
IsScrolling = true,
Title = "选择菜单",
BodyTemplate = BootstrapDynamicComponent.CreateComponent<ParentMenuTree>(new Dictionary<string, object?>
{
[nameof(ParentMenuTree.Value)] = Value,
[nameof(ParentMenuTree.ValueChanged)] = EventCallback.Factory.Create<string>(this, v => OnValueChanged(v))
}).Render(),
FooterTemplate = BootstrapDynamicComponent.CreateComponent<Button>(new Dictionary<string, object?>
{
[nameof(Button.Color)] = Color.Primary,
[nameof(Button.Text)] = "确认",
[nameof(Button.OnClick)] = EventCallback.Factory.Create<MouseEventArgs>(this, () =>
{
Option?.Dialog.Close();
}),
}).Render()
};
await DialogService.Show(Option);
}
private Task OnClearText() => OnValueChanged("0");
private async Task OnValueChanged(string v)
{
if (Value != v)
{
Value = v;
if (ValueChanged.HasDelegate)
{
await ValueChanged.InvokeAsync(Value);
}
}
}
}

View File

@ -0,0 +1,7 @@
.tree-dialog {
display: flex;
}
.tree-dialog ::deep .input-group {
flex-wrap: nowrap !important
}

View File

@ -0,0 +1,6 @@
<Tree Items="InternalItems" ShowRadio="true" ShowIcon="true" OnTreeItemChecked="@OnTreeItemChecked" />
@code {
RenderFragment<Navigation> RenderTreeItem => item =>
@<div class="d-flex flex-fill"><span class="flex-fill">@item.Name</span><span class="mx-3">@item.Order</span><span class="app-type">@item.IsResource.ToDescriptionString()</span><span class="app-text">@GetApp(item.Application)</span></div>;
}

View File

@ -0,0 +1,66 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Extensions;
using BootstrapAdmin.Web.Services;
namespace BootstrapAdmin.Web.Components;
/// <summary>
///
/// </summary>
public partial class ParentMenuTree
{
/// <summary>
///
/// </summary>
[Parameter]
[EditorRequired]
[NotNull]
public string? Value { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
public EventCallback<string> ValueChanged { get; set; }
[NotNull]
private List<TreeItem>? InternalItems { get; set; }
[Inject]
[NotNull]
private INavigation? NavigationService { get; set; }
[Inject]
[NotNull]
private IDict? DictService { get; set; }
[Inject]
[NotNull]
private BootstrapAppContext? Context { get; set; }
/// <summary>
///
/// </summary>
protected override void OnInitialized()
{
base.OnInitialized();
var items = NavigationService.GetAllMenus(Context.UserName);
InternalItems = items.ToTreeItemList(new List<string> { Value }, RenderTreeItem);
}
private async Task OnTreeItemChecked(List<TreeItem> items)
{
Value = items.First().Key?.ToString();
if (ValueChanged.HasDelegate)
{
await ValueChanged.InvokeAsync(Value);
}
}
private string GetApp(string? app) => DictService.GetApps().FirstOrDefault(i => i.Key == app).Value ?? "未设置";
}

View File

@ -0,0 +1 @@
<BootstrapBlazor.Components.Console Items="@Messages" Height="280" ShowAutoScroll="true" />

View File

@ -0,0 +1,77 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.Web.Models;
using Longbow.Tasks;
namespace BootstrapAdmin.Web.Components;
/// <summary>
///
/// </summary>
public partial class TaskInfo : IDisposable
{
/// <summary>
///
/// </summary>
[Parameter]
[NotNull]
[EditorRequired]
public TasksModel? Model { get; set; }
private List<ConsoleMessageItem> Messages { get; } = new(24);
/// <summary>
///
/// </summary>
/// <param name="firstRender"></param>
/// <returns></returns>
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
var sche = TaskServicesManager.Get(Model.Name);
if (sche != null)
{
sche.Triggers.First().PulseCallback = async t => await DispatchMessage(t);
await DispatchMessage(sche.Triggers.First());
}
}
}
private async Task DispatchMessage(ITrigger trigger)
{
var message = $"Trigger({trigger.GetType().Name}) LastRuntime: {trigger.LastRuntime} Run({trigger.LastResult}) NextRuntime: {trigger.NextRuntime} Elapsed: {trigger.LastRunElapsedTime.TotalSeconds}";
Messages.Add(new ConsoleMessageItem()
{
Message = message
});
if (Messages.Count > 20)
{
Messages.RemoveAt(0);
}
await InvokeAsync(StateHasChanged);
}
private void Dispose(bool disposing)
{
if (disposing)
{
var sche = TaskServicesManager.Get(Model.Name);
if (sche != null)
{
sche.Triggers.First().PulseCallback = null;
}
}
}
/// <summary>
///
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}

View File

@ -0,0 +1,69 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.Web.Components;
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Shared;
using BootstrapAdmin.Web.Utils;
using Microsoft.AspNetCore.Components.Rendering;
namespace BootstrapAdmin.Web.Pages.Account;
/// <summary>
///
/// </summary>
[Layout(typeof(LoginLayout))]
[Route("/Account/Login")]
public class Login : ComponentBase
{
/// <summary>
///
/// </summary>
[SupplyParameterFromQuery]
[Parameter]
public string? ReturnUrl { get; set; }
/// <summary>
///
/// </summary>
[SupplyParameterFromQuery]
[Parameter]
public string? AppId { get; set; }
/// <summary>
///
/// </summary>
[SupplyParameterFromQuery]
[Parameter]
public string? View { get; set; }
[Inject]
[NotNull]
private IDict? DictsService { get; set; }
/// <summary>
/// BuildRenderTree 方法
/// </summary>
/// <param name="builder"></param>
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
if (!string.IsNullOrEmpty(View))
{
View = $"0-{View}";
}
var view = LoginHelper.GetCurrentLoginTheme(View ?? DictsService.GetCurrentLogin());
var componentType = view switch
{
"gitee" => typeof(AdminLoginGitee),
_ => typeof(AdminLogin)
};
builder.OpenComponent(0, componentType);
builder.AddAttribute(1, nameof(AdminLogin.ReturnUrl), ReturnUrl);
builder.AddAttribute(2, nameof(AdminLogin.AppId), AppId);
builder.CloseComponent();
builder.OpenComponent<AdminLoginFooter>(3);
builder.CloseComponent();
}
}

View File

@ -1,8 +0,0 @@
@layout LoginLayout
@page "/Account/Login"
<div class="wrap">
<div class="container">
<AdminLogin ReturnUrl="@ReturnUrl" AppId="@AppId" />
</div>
</div>

View File

@ -1,24 +0,0 @@
.wrap {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
@media (min-width: 768px) {
.wrap {
background-color: #5bc0de;
background: url('../images/bg2.jpg') fixed no-repeat;
background-size: 100% 100%;
}
.container {
background: url('../images/bg3.png') no-repeat;
background-size: contain;
width: 704px;
height: 404px;
margin: 0 auto;
margin-top: calc(100vh / 2 - 190px);
}
}

View File

@ -23,35 +23,7 @@
<TableColumn @bind-Field="@context.Application" Filterable="true" Lookup="Apps"></TableColumn>
</TableColumns>
<EditTemplate Context="v">
<div class="row g-3 form-inline">
<div class="col-12 col-sm-6 col-md-6">
<BootstrapInput @bind-Value="v.Name" DisplayText="菜单名称" ShowLabel="true"></BootstrapInput>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select @bind-Value="v.ParentId" Items="@ParementMenus" IsDisabled="@(v.ParentId == "0")" DisplayText="父级菜单" ShowLabel="true"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<BootstrapInput @bind-Value="v.Order"></BootstrapInput>
</div>
<div class="col-12 col-sm-6 col-md-6">
<BootstrapInput @bind-Value="v.Icon"></BootstrapInput>
</div>
<div class="col-12">
<BootstrapInput @bind-Value="v.Url"></BootstrapInput>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select @bind-Value="v.Category"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select Items="@Targets" @bind-Value="v.Target"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select @bind-Value="v.IsResource"></Select>
</div>
<div class="col-12 col-sm-6 col-md-6">
<Select Items="@Apps" @bind-Value="v.Application"></Select>
</div>
</div>
<MenuEditor Value="v" ParementMenus="ParementMenus" Targets="Targets" Apps="Apps" />
</EditTemplate>
<RowButtonTemplate>
<TableCellButton Size="Size.ExtraSmall" IsShow="@AuthorizeButton("assignRole")" Color="Color.Info" Icon="fa fa-sitemap" Text="分配角色" OnClick="() => OnAssignmentRoles(context)" />

View File

@ -56,6 +56,10 @@ public partial class Profiles
[NotNull]
private string? DefaultLogoFolder { get; set; }
[CascadingParameter]
[NotNull]
private Layout? Layout { get; set; }
/// <summary>
///
/// </summary>
@ -109,8 +113,13 @@ public partial class Profiles
private async Task OnSaveDisplayName(EditContext context)
{
var ret = UserService.SaveDisplayName(CurrentUser.DisplayName, CurrentUser.UserName);
var ret = UserService.SaveDisplayName(CurrentUser.UserName, CurrentUser.DisplayName);
await ShowToast(ret, "显示名称");
if (ret)
{
AppContext.DisplayName = CurrentUser.DisplayName;
await RenderLayout("displayName");
}
}
private async Task OnSavePassword(EditContext context)
@ -177,4 +186,12 @@ public partial class Profiles
await ShowToast(ret, "用户头像", "删除");
return ret;
}
private async Task RenderLayout(string key)
{
if (Layout.OnUpdateAsync != null)
{
await Layout.OnUpdateAsync(key);
}
}
}

View File

@ -48,7 +48,7 @@ public partial class Settings
base.OnInitialized();
IsDemo = DictService.IsDemo();
Logins = DictService.GetLogins().ToSelectedItemList();
Logins = DictService.GetLogins().ToSelectedItemList().OrderBy(i => i.Value).ToList();
Themes = DictService.GetThemes().ToSelectedItemList();
IPLocators = DictService.GetIpLocators().ToSelectedItemList();
IPLocators.Insert(0, new SelectedItem("", "未选择"));
@ -180,9 +180,9 @@ public partial class Settings
private async Task RenderLayout(string key)
{
if (Layout.OnUpdate != null)
if (Layout.OnUpdateAsync != null)
{
await Layout.OnUpdate(key);
await Layout.OnUpdateAsync(key);
}
}
}

View File

@ -2,6 +2,7 @@
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.Web.Components;
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Extensions;
using BootstrapAdmin.Web.Models;
@ -32,6 +33,10 @@ public partial class Tasks
[NotNull]
private IDict? DictService { get; set; }
[Inject]
[NotNull]
private DialogService? DialogService { get; set; }
private bool IsDemo { get; set; }
/// <summary>
@ -157,9 +162,18 @@ public partial class Tasks
return Task.CompletedTask;
}
private static Task OnLog(TasksModel model)
private async Task OnLog(TasksModel model)
{
return Task.CompletedTask;
var option = new DialogOption()
{
Class = "modal-dialog-task",
Title = $"{model.Name} - 日志窗口(最新 20 条)",
Component = BootstrapDynamicComponent.CreateComponent<TaskInfo>(new Dictionary<string, object?>
{
[nameof(TaskInfo.Model)] = model
})
};
await DialogService.Show(option);
}
private static bool OnCheckTaskStatus(TasksModel model) => model.Status != SchedulerStatus.Disabled;

View File

@ -44,5 +44,5 @@ class AdminTaskService : BackgroundService
// 真实任务负责周期性设置健康检查结果开关为开启
TaskServicesManager.GetOrAdd("健康检查", token => Task.FromResult(DictService.SaveHealthCheck()), TriggerBuilder.Build(Cron.Minutely(10)));
});
}, stoppingToken);
}

View File

@ -3,10 +3,10 @@
<Layout SideWidth="0" IsPage="true" IsFullSide="true" IsFixedHeader="true"
ShowFooter="true" ShowGotoTop="true" ShowCollapseBar="true" Menus="@MenuItems"
OnAuthorizing="@OnAuthorizing" OnErrorHandleAsync="OnErrorHandleAsync"
UseTabSet="true" TabDefaultUrl="/Admin/Index" OnUpdate="OnUpdate">
UseTabSet="true" TabDefaultUrl="/Admin/Index" OnUpdateAsync="OnUpdateAsync">
<Header>
<span class="ms-3 flex-fill">Bootstrap of Blazor</span>
<Logout ImageUrl="@Icon" DisplayName="@DisplayName" UserName="@UserName">
<Logout ImageUrl="@Icon" DisplayName="@Context.DisplayName" UserName="@UserName">
<LinkTemplate>
<a href="/Admin/Profiles"><i class="fa fa-suitcase"></i>个人中心</a>
<a href="/Admin/Index"><i class="fa fa-cog"></i>设置</a>
@ -26,7 +26,7 @@
<div class="layout-user">
<img class="layout-avatar" src="@Icon">
<div class="layout-title">
<span>@DisplayName</span>
<span>@Context.DisplayName</span>
</div>
<div class="layout-user-state"></div>
</div>

View File

@ -74,8 +74,6 @@ namespace BootstrapAdmin.Web.Shared
private string? Footer { get; set; }
private string? DisplayName { get; set; }
private string? UserName { get; set; }
private bool Lock { get; set; }
@ -133,9 +131,8 @@ namespace BootstrapAdmin.Web.Shared
if (!string.IsNullOrEmpty(UserName))
{
var user = UsersService.GetUserByUserName(UserName);
DisplayName = user?.DisplayName ?? "未注册账户";
Context.UserName = UserName;
Context.DisplayName = DisplayName;
Context.DisplayName = user?.DisplayName ?? "未注册账户"; ;
Icon = string.IsNullOrEmpty(user?.Icon) ? "/images/uploader/default.jpg" : GetIcon(user.Icon);
MenuItems = NavigationsService.GetAllMenus(UserName).ToMenus();
@ -161,7 +158,7 @@ namespace BootstrapAdmin.Web.Shared
/// <summary>
///
/// </summary>
public Task OnUpdate(string key)
public Task OnUpdateAsync(string key)
{
if (key == "title")
{

View File

@ -50,4 +50,20 @@ public static class LoginHelper
return returnUrl ?? "/Admin/Index";
}
/// <summary>
/// 将字典表中的配置 1-Login-Gitee 转化为 gitee
/// </summary>
/// <param name="loginTheme"></param>
/// <returns></returns>
public static string? GetCurrentLoginTheme(string loginTheme)
{
string? ret = null;
var segs = loginTheme.Split('-');
if (segs.Length == 3)
{
ret = segs[2].ToLowerInvariant();
}
return ret;
}
}

View File

@ -1,4 +1,4 @@
.layout.is-page .layout-side {
.layout.is-page .layout-side {
color: #3f4254;
background-color: #fff;
box-shadow: 0 0 28px 0 rgb(82 63 105 / 5%);
@ -26,3 +26,11 @@
background-color: #fff !important;
}
}
.modal-dialog-task ::-webkit-scrollbar-thumb {
background-color: #ffffff66;
}
.modal-dialog-task ::-webkit-scrollbar-thumb:hover {
background-color: #ffffffb3;
}

View File

@ -122,3 +122,8 @@
.cell-icon {
margin-top: 4px;
}
.layout-user,
.layout-menu {
border-right: 1px solid #ddd;
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta04" />
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta07" />
<PackageReference Include="Longbow.Security.Cryptography" Version="5.2.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.1" />
<PackageReference Include="PetaPoco.Extensions" Version="6.0.0" />

View File

@ -56,4 +56,18 @@ public class AdminService : IBootstrapAdminService
}
return Task.FromResult(ret);
}
/// <summary>
///
/// </summary>
/// <param name="userName"></param>
/// <param name="url"></param>
/// <param name="blockName"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool AuhorizingBlock(string userName, string url, string blockName)
{
// Client 暂时未使用
return true;
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Bootstrap.Security.Blazor" Version="6.0.1-beta01" />
<PackageReference Include="Bootstrap.Security.Blazor" Version="6.0.1" />
</ItemGroup>
<ItemGroup>

View File

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.2.7" />
<PackageReference Include="BootstrapBlazor" Version="6.2.9-beta07" />
<PackageReference Include="Exceptionless.AspNetCore" Version="4.6.2" />
<PackageReference Include="Longbow.Logging" Version="5.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />

1
src/vue/admin Submodule

@ -0,0 +1 @@
Subproject commit dba7769cabd52a4bccd563e9430687c8b2457607

View File

@ -0,0 +1,70 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
namespace BootstrapAdmin.Api.Authencation;
/// <summary>
///
/// </summary>
public static class BootstrapAdminJwtHandler
{
/// <summary>
///
/// </summary>
/// <param name="userName"></param>
/// <param name="configure"></param>
/// <returns></returns>
public static string CreateToken(string userName, Action<TokenValidateOption>? configure = null)
{
ClaimsIdentity claimsIdentity = new ClaimsIdentity("Bearer");
claimsIdentity.AddClaim(new Claim(ClaimTypes.Name, userName));
JwtSecurityTokenHandler jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
TokenValidateOption tokenValidateOption = new TokenValidateOption();
configure?.Invoke(tokenValidateOption);
return jwtSecurityTokenHandler.CreateEncodedJwt(new SecurityTokenDescriptor
{
Issuer = tokenValidateOption.Issuer,
Audience = tokenValidateOption.Audience,
Subject = claimsIdentity,
Expires = DateTime.Now.AddMinutes(tokenValidateOption.Expires),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(tokenValidateOption.SecurityKey)), "HS256")
});
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public static string CreateRefershToken()
{
JwtSecurityTokenHandler jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
TokenValidateOption tokenValidateOption = new TokenValidateOption();
return jwtSecurityTokenHandler.CreateEncodedJwt(new SecurityTokenDescriptor
{
Issuer = tokenValidateOption.Issuer,
Audience = tokenValidateOption.Audience,
Expires = DateTime.Now.AddMinutes(10),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(tokenValidateOption.SecurityKey)), "HS256")
});
}
/// <summary>
///
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public static bool ValidateTokenExpires(string token)
{
JwtSecurityTokenHandler jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
var parmeter = jwtSecurityTokenHandler.ReadJwtToken(token);
var value = parmeter.Claims.FirstOrDefault(s => s.Type == ClaimTypes.Expired);
return value!.Value != null;
}
}

View File

@ -0,0 +1,32 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
namespace BootstrapAdmin.Api.Authencation;
/// <summary>
///
/// </summary>
public class TokenValidateOption
{
/// <summary>
///
/// </summary>
public string Issuer { get; set; } = "BA";
/// <summary>
///
/// </summary>
public string Audience { get; set; } = "api";
/// <summary>
///
/// </summary>
public int Expires { get; set; } = 5;
/// <summary>
///
/// </summary>
public string SecurityKey { get; set; } = "BootstrapAdmin-V1.1";
}

View File

@ -0,0 +1,12 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
namespace BootstrapAdmin.Api;
/// <summary>
///
/// </summary>
public static class Authorization
{
}

View File

@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.15.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\blazor\admin\BootstrapAdmin.DataAccess.PetaPoco\BootstrapAdmin.DataAccess.PetaPoco.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -0,0 +1,58 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.Api.Authencation;
using BootstrapAdmin.Api.Extensions;
using BootstrapAdmin.Api.Models;
using BootstrapAdmin.Web.Core;
using Microsoft.AspNetCore.Mvc;
namespace BootstrapAdmin.Api.Controllers;
/// <summary>
///
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class AccountController : ControllerBase
{
private IUser UserService { get; }
/// <summary>
///
/// </summary>
/// <param name="userService"></param>
public AccountController(IUser userService) => UserService = userService;
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpPost]
public ActionResult<LoginResult> Post([FromServices] IConfiguration configuration, [FromBody] LoginUser user)
{
string? token = null;
string? refershtoken = null;
string? userName = user.UserName;
string? password = user.Password;
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password) && UserService.Authenticate(userName, password))
{
token = BootstrapAdminJwtHandler.CreateToken(userName, op =>
{
var tokenOption = configuration.GetOption(() => new TokenValidateOption());
op.Audience = tokenOption.Audience;
op.Expires = tokenOption.Expires;
op.Issuer = tokenOption.Issuer;
op.SecurityKey = tokenOption.SecurityKey;
});
refershtoken = BootstrapAdminJwtHandler.CreateRefershToken();
return new LoginResult { Code = "0", Message = "login successed!", Result = new Result { Token = token, RefershToken = refershtoken } };
}
else
{
return new LoginResult { Code = "0", Message = "login failed!", Result = new Result { Token = token, RefershToken = refershtoken } };
}
}
}

View File

@ -0,0 +1,58 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.DataAccess.Models;
using BootstrapAdmin.Web.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace BootstrapAdmin.Api.Controllers
{
/// <summary>
/// 字典表维护控制器
/// </summary>
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class DictsController : ControllerBase
{
private IDict DictService { get; }
/// <summary>
///
/// </summary>
/// <param name="dictService"></param>
public DictsController(IDict dictService) => DictService = dictService;
/// <summary>
/// 获取所有字典表数据方法
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult<List<Dict>> Get()
{
return DictService.GetAll();
}
/// <summary>
/// 保存字典方法
/// </summary>
/// <param name="value"></param>
[HttpPost]
public bool Post([FromBody] Dict value)
{
return true;
}
/// <summary>
/// 删除字典项方法
/// </summary>
/// <param name="value"></param>
[HttpDelete]
[Authorize(Roles = "Administrators")]
public bool Delete([FromBody] IEnumerable<string> value)
{
return true;
}
}
}

View File

@ -0,0 +1,23 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using Bootstrap.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Collections.Generic;
namespace Bootstrap.Admin.Controllers.Api
{
/// <summary>
///
/// </summary>
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class MenusController : ControllerBase
{
}
}

View File

@ -0,0 +1,23 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.Admin.Controllers.Api
{
/// <summary>
/// 角色维护控制器
/// </summary>
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class RolesController : ControllerBase
{
}
}

View File

@ -0,0 +1,49 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using BootstrapAdmin.DataAccess.Models;
using BootstrapAdmin.Web.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace BootstrapAdmin.Api.Controllers
{
/// <summary>
/// 用户控制器
/// </summary>
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class UsersController : ControllerBase
{
private IUser UserService { get; }
/// <summary>
///
/// </summary>
/// <param name="userService"></param>
public UsersController(IUser userService) => UserService = userService;
/// <summary>
/// 调用获取所有用户信息 用户管理查询按钮
/// </summary>
/// <returns></returns>
[HttpGet]
public IActionResult Get()
{
return new JsonResult(new { Code = "0", Message = "login successed!", Result = new { roles = Array.Empty<string>() } }) ;
}
/// <summary>
/// api 握手协议
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[HttpOptions]
public string? Options()
{
return null;
}
}
}

View File

@ -0,0 +1,41 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
namespace BootstrapAdmin.Api.Extensions;
/// <summary>
///
/// </summary>
public static class ConfigurationExtension
{
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="configuration"></param>
/// <param name="valueFactory"></param>
/// <returns></returns>
public static T GetOption<T>(this IConfiguration configuration, Func<T> valueFactory) where T : class
{
T val = null;
Type typeFromHandle = typeof(T);
IConfigurationSection section = configuration.GetSection(typeFromHandle.Name);
if (!section.Exists())
{
section = configuration.GetSection(typeFromHandle.FullName);
}
if (section.Exists())
{
val = section.Get<T>();
}
if (val == null)
{
val = valueFactory();
}
return val;
}
}

View File

@ -0,0 +1,54 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using PetaPoco;
using PetaPoco.Providers;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using System.Text;
using BootstrapAdmin.Api.Authencation;
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
///
/// </summary>
public static class ServiceCollectionExtension
{
/// <summary>
///
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddBootstrapAdminService(this IServiceCollection services)
{
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, option =>
{
var tokenValidateOption = new TokenValidateOption();
option.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,//是否验证Issuer
ValidateAudience = true,//是否验证Audience
ValidateLifetime = true,//是否验证失效时间
ClockSkew = TimeSpan.Zero,
ValidateIssuerSigningKey = true,//是否验证SecurityKey
ValidAudience = tokenValidateOption.Audience,//Audience
ValidIssuer = tokenValidateOption.Issuer,//Issuer这两项和前面签发jwt的设置一致
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(tokenValidateOption.SecurityKey)),//拿到SecurityKey
};
option.RequireHttpsMetadata = false;
});
services.AddPetaPocoDataAccessServices((provider, builder) =>
{
var configuration = provider.GetRequiredService<IConfiguration>();
var connString = configuration.GetConnectionString("bb");
builder.UsingProvider<SQLiteDatabaseProvider>()
.UsingConnectionString(connString);
});
return services;
}
}

View File

@ -0,0 +1,33 @@
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
namespace BootstrapAdmin.Api.Models;
/// <summary>
///
/// </summary>
public class LoginResult
{
/// <summary>
///
/// </summary>
public string? Code { get; set; }
/// <summary>
///
/// </summary>
public string? Message { get; set; }
/// <summary>
///
/// </summary>
public Result? Result { get; set; }
}
public class Result
{
public string? Token { get; set; }
public string? RefershToken { get; set; }
}

View File

@ -2,24 +2,20 @@
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
namespace BootstrapAdmin.Web.Pages.Account;
namespace BootstrapAdmin.Api.Models;
/// <summary>
///
/// </summary>
public partial class Login
public class LoginUser
{
/// <summary>
///
/// </summary>
[SupplyParameterFromQuery]
[Parameter]
public string? ReturnUrl { get; set; }
public string? UserName { get; set; }
/// <summary>
///
/// </summary>
[SupplyParameterFromQuery]
[Parameter]
public string? AppId { get; set; }
public string? Password { get; set; }
}

View File

@ -0,0 +1,65 @@
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
// Configure the service container.
builder.Services.AddControllers();
builder.Services.AddRouting(s => s.LowercaseUrls = true);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "BootstrapAdmin API"
});
//Set the comments path for the swagger json and ui.
//var xmlPath = Path.Combine(AppContext.BaseDirectory, "Bootstrap.Admin.xml");
//options.IncludeXmlComments(xmlPath);
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Name = "Authorization",
Type = SecuritySchemeType.ApiKey,
Scheme = "Bearer",
BearerFormat = "JWT",
In = ParameterLocation.Header,
Description = "JWT Authorization header using the Bearer scheme."
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
}
},
new string[]{ }
}
});
});
builder.Services.AddBootstrapAdminService();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(option =>
{
option.DocumentTitle = "BootstrapAdmin API V1";
});
}
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:11008",
"sslPort": 0
}
},
"profiles": {
"BootstrapAdmin.Api": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5046",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,350 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"Longbow.Tasks": "Error"
},
"LgbFile": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Error"
},
"FileName": "Error\\Log.log"
}
},
"SimulateUserName": "",
"AutoGenerateDatabase": true,
"BootstrapAdminAuthenticationOptions": {
"KeyPath": "..\\..\\keys"
},
"DB": [
{
"Enabled": false,
"ProviderName": "SqlServer",
"SqlFolder": "..\\..\\..\\db\\SqlServer",
"ConnectionStrings": {
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"
}
},
{
"Enabled": true,
"ProviderName": "Sqlite",
"SqlFolder": "..\\..\\..\\db\\SQLite",
"ConnectionStrings": {
"ba": "Data Source=BootstrapAdmin.db;"
}
},
{
"Enabled": false,
"ProviderName": "MySql",
"SqlFolder": "..\\..\\..\\db\\MySQL",
"ConnectionStrings": {
"ba": "Server=localhost;Database=BA;Uid=argozhang;Pwd=argo@163.com;SslMode=none;"
}
},
{
"Enabled": false,
"ProviderName": "Oracle",
"ConnectionStrings": {
"ba": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXX)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)));User Id=XX;Password=XX"
}
},
{
"Enabled": false,
"ProviderName": "Npgsql",
"ConnectionStrings": {
"ba": "Server=localhost;Database=BootstrapAdmin;User ID=argozhang;Password=argo@163.com;"
}
},
{
"Enabled": false,
"Widget": "Bootstrap.DataAccess.MongoDB",
"ProviderName": "MongoDB",
"SqlFolder": "..\\..\\..\\db\\MongoDB",
"ConnectionStrings": {
"ba": "mongodb://localhost:27017/BootstrapAdmin"
}
}
],
"SwaggerPathBase": "",
"GiteeHealthChecks": "true",
"AllowOrigins": "http://localhost:49185",
"HealthsCloudUrl": "https://client.blazor.zone/api/Interface/Healths",
"FileStorageOptions": {
"Enabled": true,
"Folder": "TaskStorage",
"Secure": false
},
"GiteeOptions": {
"Enabled": true,
"ClientId": "9bfe9b95d813ca7d613b110a54eda28bf227154b314c95f0c69e7680d64525e1",
"ClientSecret": "3427f2d901ba9afc76c1842a7303b2d67f8e098e71acc15051f89fe6f3d265db",
"CallbackPath": "/signin-gitee",
"HomePath": "/Admin/Profiles",
"Scope": [ "user_info", "projects" ],
"Roles": [ "Administrators" ],
"App": "Demo",
"StarredUrl": "https://gitee.com/api/v5/user/starred/LongbowEnterprise/BootstrapAdmin"
},
"GitHubOptions": {
"Enabled": true,
"ClientId": "ec53ecfe238558a0423b",
"ClientSecret": "ffa759ca599df941b869efecb5e750bc1b27334e",
"CallbackPath": "/signin-github",
"HomePath": "/Admin/Profiles",
"Scope": [ "user_info", "repo" ],
"Roles": [ "Administrators" ],
"App": "Demo",
"StarredUrl": "https://api.github.com/user/starred/ArgoZhang/BootstrapAdmin"
},
"WeChatOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<secret>",
"CallbackPath": "/signin-weixin",
"HomePath": "/Admin/Profiles",
"Scope": [ "snsapi_login" ],
"Roles": [ "Administrators" ],
"App": "Demo"
},
"TencentOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<ClientSecret>",
"CallbackPath": "/signin-tencent",
"HomePath": "/Admin/Profiles",
"Scope": [ "get_user_info" ],
"Roles": [ "Administrators" ],
"App": "Demo"
},
"SMSOptions": {
"CompanyCode": "<CompanyCode>",
"MD5Key": "MD5Key",
"Roles": [ "Administrators" ],
"HomePath": "/Admin/Profiles",
"App": "Demo"
},
"AlipayOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<ClientSecret>",
"CallbackPath": "/signin-alipay",
"HomePath": "/Admin/Profiles",
"SignKey": "",
"Scope": [ "auth_user" ],
"Roles": [ "Administrators" ],
"App": "Demo"
},
"TencentSMSOptions": {
"AppId": "<TencentAppId>",
"AppKey": "<TencentAppKey>",
"TplId": 0,
"Sign": "<TencentSign>",
"Roles": [ "Default" ],
"HomePath": "/Admin/Profiles",
"App": "Demo",
"Debug": true
},
"AppMenus": [
"首页",
"测试页面",
"关于",
"返回码云",
"多级菜单",
"第二层",
"第三层",
"第四层"
],
"LongbowCache": {
"Enabled": true,
"CorsItems": [
{
"Enabled": true,
"Key": "ba",
"Url": "CacheList.axd",
"Desc": "后台管理数据缓存接口",
"Self": true
},
{
"Enabled": true,
"Key": "App",
"Url": "http://localhost:49185/CacheList.axd",
"Desc": "测试系统",
"Self": false
}
],
"CacheItems": [
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户角色数据缓存"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByUrl",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过菜单获得角色数据"
},
{
"Enabled": true,
"Key": "AppHelper-RetrieveAppsByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户授权应用数据缓存"
},
{
"Enabled": true,
"Key": "BootstrapUser-RetrieveUsersByName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "登录用户数据"
},
{
"Enabled": true,
"Key": "BootstrapDict-RetrieveDicts",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有字典数据缓存"
},
{
"Enabled": true,
"Key": "BootstrapMenu-RetrieveMenus",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "用户所有菜单数据缓存"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroupsByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户组数据缓存"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveUsers",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有用户数据"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveUsersByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有用户数据"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveUsersByGroupId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过部门ID获得所有用户数据"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveNewUsers",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "新用户数据"
},
{
"Enabled": true,
"Key": "MenuHelper-RetrieveMenusByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有菜单数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRoles",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有角色数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByUserId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过用户ID获得所有角色数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByMenuId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过菜单ID获得所有角色数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByGroupId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过部门ID获得所有角色数据"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroups",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有部门数据"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroupsByUserId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过用户ID获得所有部门数据"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroupsByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有部门数据"
},
{
"Enabled": true,
"Key": "AppHelper-RetrieveAppsByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有应用程序数据"
},
{
"Enabled": true,
"Key": "DictHelper-RetrieveDictsCategory",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "字典分类数据"
},
{
"Enabled": true,
"Key": "ExceptionHelper-RetrieveExceptions",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "程序异常数据"
},
{
"Enabled": true,
"Key": "MessageHelper-RetrieveMessages",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "站内消息数据"
},
{
"Enabled": true,
"Key": "TaskHelper-RetrieveTasks",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有任务数据"
}
]
}
}

View File

@ -0,0 +1,350 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"LgbFile": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Error"
},
"FileName": "Error\\Log.log"
},
"Cloud": {
"LogLevel": {
"Default": "Error"
},
"Url": "https://client.blazor.zone/api/Interface/Log"
}
},
"ConnectionStrings": {
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa",
"bb": "Data Source=BootstrapAdmin.db;"
},
"AutoGenerateDatabase": false,
"DB": [
{
"Enabled": false,
"ProviderName": "SqlServer",
"ConnectionStrings": {
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"
}
},
{
"Enabled": true,
"ProviderName": "Sqlite",
"ConnectionStrings": {
"ba": "Data Source=BootstrapAdmin.db;"
}
},
{
"Enabled": false,
"ProviderName": "MySql",
"ConnectionStrings": {
"ba": "Server=localhost;Database=BA;Uid=argozhang;Pwd=argo@163.com;SslMode=none;"
}
},
{
"Enabled": false,
"ProviderName": "Npgsql",
"ConnectionStrings": {
"ba": "Server=localhost;Database=BootstrapAdmin;User ID=argozhang;Password=argo@163.com;"
}
},
{
"Enabled": false,
"Widget": "Bootstrap.DataAccess.MongoDB",
"ProviderName": "MongoDB",
"ConnectionStrings": {
"ba": "mongodb://localhost:27017/BootstrapAdmin"
}
}
],
"AppId": "BA",
"UseHttps": true,
"SwaggerPathBase": "",
"AllowOrigins": "http://localhost,http://admin.blazor.zone",
"HealthsCloudUrl": "https://client.blazor.zone/api/Interface/Healths",
"GiteeHealthChecks": false,
"Sentry": {
"Dsn": "https://70bdfff562e84fa7b9a43d65924ab9ad@sentry.io/1469396"
},
"BootstrapBlazorOptions": {
"DefaultCultureInfo": "zh-CN"
},
"Exceptionless": {
"ApiKey": "AgQlY1MRWpX5qOF2edpK2IZYBhgPYImhr4UnZdAT"
},
"TokenValidateOption": {
"Issuer": "BA",
"Audience": "api",
"Expires": 5,
"SecurityKey": "BootstrapAdmin-V1.1"
},
"TaskServicesOptions": {
"ShutdownTimeout": "00:00:05"
},
"FileStorageOptions": {
"Enabled": true,
"Folder": "TaskStorage",
"Secure": true
},
"GiteeOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<ClientSecret>",
"CallbackPath": "/signin-gitee",
"HomePath": "/Home/Index",
"Scope": [ "user_info", "projects" ],
"Roles": [ "Default" ],
"App": "Demo"
},
"GitHubOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<ClientSecret>",
"CallbackPath": "/signin-github",
"HomePath": "/Home/Index",
"Scope": [ "user_info", "repo" ],
"Roles": [ "Default" ],
"App": "Demo"
},
"WeChatOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<secret>",
"CallbackPath": "/signin-weixin",
"HomePath": "/Admin/Profiles",
"Scope": [ "snsapi_login" ],
"Roles": [ "Default" ],
"App": "Demo"
},
"TencentOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<ClientSecret>",
"CallbackPath": "/signin-tencent",
"HomePath": "/Admin/Profiles",
"Scope": [ "get_user_info" ],
"Roles": [ "Administrators" ],
"App": "Demo"
},
"AlipayOptions": {
"Enabled": true,
"ClientId": "<ClientId>",
"ClientSecret": "<ClientSecret>",
"CallbackPath": "/signin-alipay",
"HomePath": "/Admin/Profiles",
"SignKey": "",
"Scope": [ "auth_user" ],
"Roles": [ "Administrators" ],
"App": "Demo"
},
"SMSOptions": {
"CompanyCode": "<CompanyCode>",
"MD5Key": "MD5Key",
"Roles": [ "Default" ],
"HomePath": "/Home/Index",
"App": "Demo"
},
"TencentSMSOptions": {
"AppId": "<TencentAppId>",
"AppKey": "<TencentAppKey>",
"TplId": 0,
"Sign": "<TencentSign>",
"Roles": [ "Default" ],
"HomePath": "/Admin/Profiles",
"App": "Demo"
},
"LongbowCache": {
"Enabled": true,
"CorsItems": [
{
"Enabled": true,
"Key": "ba",
"Url": "CacheList.axd",
"Desc": "后台管理数据缓存接口",
"Self": true
},
{
"Enabled": true,
"Key": "App",
"Url": "../Client/CacheList.axd",
"Desc": "测试系统",
"Self": false
}
],
"CacheItems": [
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户角色数据缓存"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByUrl",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过菜单获得角色数据"
},
{
"Enabled": true,
"Key": "AppHelper-RetrieveAppsByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户授权应用数据缓存"
},
{
"Enabled": true,
"Key": "BootstrapUser-RetrieveUsersByName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "登录用户数据"
},
{
"Enabled": true,
"Key": "BootstrapDict-RetrieveDicts",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有字典数据缓存"
},
{
"Enabled": true,
"Key": "BootstrapMenu-RetrieveMenus",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "用户所有菜单数据缓存"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroupsByUserName",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "指定用户组数据缓存"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveUsers",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有用户数据"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveUsersByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有用户数据"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveUsersByGroupId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过部门ID获得所有用户数据"
},
{
"Enabled": true,
"Key": "UserHelper-RetrieveNewUsers",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "新用户数据"
},
{
"Enabled": true,
"Key": "MenuHelper-RetrieveMenusByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有菜单数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRoles",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有角色数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByUserId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过用户ID获得所有角色数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByMenuId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过菜单ID获得所有角色数据"
},
{
"Enabled": true,
"Key": "RoleHelper-RetrieveRolesByGroupId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过部门ID获得所有角色数据"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroups",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有部门数据"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroupsByUserId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过用户ID获得所有部门数据"
},
{
"Enabled": true,
"Key": "GroupHelper-RetrieveGroupsByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有部门数据"
},
{
"Enabled": true,
"Key": "AppHelper-RetrieveAppsByRoleId",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "通过角色ID获得所有应用程序数据"
},
{
"Enabled": true,
"Key": "DictHelper-RetrieveDictsCategory",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "字典分类数据"
},
{
"Enabled": true,
"Key": "ExceptionHelper-RetrieveExceptions",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "程序异常数据"
},
{
"Enabled": true,
"Key": "MessageHelper-RetrieveMessages",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "站内消息数据"
},
{
"Enabled": true,
"Key": "TaskHelper-RetrieveTasks",
"Interval": 600000,
"SlidingExpiration": true,
"Desc": "所有任务数据"
}
]
}
}