feat: 初始化 api 项目

This commit is contained in:
zhangpeihang 2022-01-27 13:37:25 +08:00
parent acf4ed75dc
commit 52a69ec511
15 changed files with 1165 additions and 1 deletions

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

@ -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,60 @@
// 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.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace BootstrapAdmin.Api.Controllers;
/// <summary>
///
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
[Authorize]
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> Login([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 = "account:200", Message = "login successed!", Token = token, RefershToken = refershtoken };
}
else
{
return new LoginResult { Code = "account:400", Message = "login failed!", Token = token, RefershToken = refershtoken };
}
}
}

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,31 @@
// 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 string? Token { get; set; }
/// <summary>
///
/// </summary>
public string? RefershToken { get; set; }
}

View File

@ -0,0 +1,21 @@
// 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 LoginUser
{
/// <summary>
///
/// </summary>
public string? UserName { get; set; }
/// <summary>
///
/// </summary>
public string? Password { get; set; }
}

View File

@ -0,0 +1,66 @@
using Microsoft.OpenApi.Models;
using PetaPoco;
using PetaPoco.Providers;
var builder = WebApplication.CreateBuilder(args);
// Configure the service container.
builder.Services.AddControllers();
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": "所有任务数据"
}
]
}
}