mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-05-06 21:58:05 +08:00
Merge branch 'main' of https://gitee.com/dotnetchina/OpenAuth.Net
This commit is contained in:
commit
f9ea57a06c
@ -13,7 +13,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "AccessObjs")]
|
||||
[ApiExplorerSettings(GroupName = "分配资源_AccessObjs")]
|
||||
public class AccessObjsController : ControllerBase
|
||||
{
|
||||
private readonly RevelanceManagerApp _app;
|
||||
|
@ -11,7 +11,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Applications")]
|
||||
[ApiExplorerSettings(GroupName = "应用管理_Applications")]
|
||||
public class ApplicationsController : ControllerBase
|
||||
{
|
||||
private readonly AppManager _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "BuilderTableColumns")]
|
||||
[ApiExplorerSettings(GroupName = "代码生成器_字段_BuilderTableColumns")]
|
||||
public class BuilderTableColumnsController : ControllerBase
|
||||
{
|
||||
private readonly BuilderTableColumnApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "BuilderTables")]
|
||||
[ApiExplorerSettings(GroupName = "代码生成器_表_BuilderTables")]
|
||||
public class BuilderTablesController : ControllerBase
|
||||
{
|
||||
private readonly BuilderTableApp _app;
|
||||
|
@ -13,7 +13,7 @@ using OpenAuth.App.Response;
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "CategoryTypes")]
|
||||
[ApiExplorerSettings(GroupName = "字典所属分类_CategoryTypes")]
|
||||
public class CategoryTypesController : ControllerBase
|
||||
{
|
||||
private readonly CategoryTypeApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Categorys")]
|
||||
[ApiExplorerSettings(GroupName = "分类字典_Categorys")]
|
||||
public class CategorysController : ControllerBase
|
||||
{
|
||||
private readonly CategoryApp _app;
|
||||
|
@ -33,7 +33,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Check")]
|
||||
[ApiExplorerSettings(GroupName = "登录验证_Check")]
|
||||
public class CheckController : ControllerBase
|
||||
{
|
||||
private readonly IAuth _authUtil;
|
||||
@ -341,7 +341,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
{
|
||||
var result = new LoginResult();
|
||||
try
|
||||
{
|
||||
{
|
||||
result = _authUtil.Login(request.AppKey, request.Account, request.Password);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "DataPrivilegeRules")]
|
||||
[ApiExplorerSettings(GroupName = "数据权限_DataPrivilegeRules")]
|
||||
public class DataPrivilegeRulesController : ControllerBase
|
||||
{
|
||||
private readonly DataPrivilegeRuleApp _app;
|
||||
|
@ -18,7 +18,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Files")]
|
||||
[ApiExplorerSettings(GroupName = "文件管理_Files")]
|
||||
public class FilesController :ControllerBase
|
||||
{
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "FlowInstances")]
|
||||
[ApiExplorerSettings(GroupName = "流程实例_FlowInstances")]
|
||||
public class FlowInstancesController : ControllerBase
|
||||
{
|
||||
private readonly FlowInstanceApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "FlowSchemes")]
|
||||
[ApiExplorerSettings(GroupName = "流程模版_FlowSchemes")]
|
||||
public class FlowSchemesController : ControllerBase
|
||||
{
|
||||
private readonly FlowSchemeApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Forms")]
|
||||
[ApiExplorerSettings(GroupName = "表单_Forms")]
|
||||
public class FormsController : ControllerBase
|
||||
{
|
||||
private readonly FormApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Modules")]
|
||||
[ApiExplorerSettings(GroupName = "模块菜单_Modules")]
|
||||
public class ModulesController : ControllerBase
|
||||
{
|
||||
private ModuleManagerApp _app;
|
||||
|
@ -16,7 +16,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "OpenJobs")]
|
||||
[ApiExplorerSettings(GroupName = "定时任务_OpenJobs")]
|
||||
public class OpenJobsController : ControllerBase
|
||||
{
|
||||
private readonly OpenJobApp _app;
|
||||
|
@ -11,7 +11,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Orgs")]
|
||||
[ApiExplorerSettings(GroupName = "组织机构_Orgs")]
|
||||
public class OrgsController : ControllerBase
|
||||
{
|
||||
private readonly OrgManagerApp _app;
|
||||
|
@ -17,7 +17,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Resources")]
|
||||
[ApiExplorerSettings(GroupName = "资源管理_Resources")]
|
||||
public class ResourcesController : ControllerBase
|
||||
{
|
||||
private readonly ResourceApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Roles")]
|
||||
[ApiExplorerSettings(GroupName = "角色管理_Roles")]
|
||||
public class RolesController : ControllerBase
|
||||
{
|
||||
private readonly RoleApp _app;
|
||||
|
@ -11,7 +11,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "SysConf")]
|
||||
[ApiExplorerSettings(GroupName = "系统配置_SysConf")]
|
||||
public class SysConfController :ControllerBase
|
||||
{
|
||||
private IOptions<AppSetting> _appConfiguration;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "SysLogs")]
|
||||
[ApiExplorerSettings(GroupName = "系统日志_SysLogs")]
|
||||
public class SysLogsController : ControllerBase
|
||||
{
|
||||
private readonly SysLogApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "SysMessages")]
|
||||
[ApiExplorerSettings(GroupName = "消息中心_SysMessages")]
|
||||
public class SysMessagesController : ControllerBase
|
||||
{
|
||||
private readonly SysMessageApp _app;
|
||||
|
@ -13,7 +13,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "Users")]
|
||||
[ApiExplorerSettings(GroupName = "用户管理_Users")]
|
||||
public class UsersController : ControllerBase
|
||||
{
|
||||
private readonly UserManagerApp _app;
|
||||
|
@ -15,7 +15,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "WmsInboundOrderDtbls")]
|
||||
[ApiExplorerSettings(GroupName = "订单明细_WmsInboundOrderDtbls")]
|
||||
public class WmsInboundOrderDtblsController : ControllerBase
|
||||
{
|
||||
private readonly WmsInboundOrderDtblApp _app;
|
||||
|
@ -14,7 +14,7 @@ namespace OpenAuth.WebApi.Controllers
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "WmsInboundOrderTbls")]
|
||||
[ApiExplorerSettings(GroupName = "订单_WmsInboundOrderTbls")]
|
||||
public class WmsInboundOrderTblsController : ControllerBase
|
||||
{
|
||||
private readonly WmsInboundOrderTblApp _app;
|
||||
|
@ -41,11 +41,8 @@ namespace OpenAuth.WebApi
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//在startup中需要强制创建log4net
|
||||
var loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
builder.AddLog4Net();
|
||||
});
|
||||
//在startup中需要强制创建log4net
|
||||
var loggerFactory = LoggerFactory.Create(builder => { builder.AddLog4Net(); });
|
||||
ILogger logger = loggerFactory.CreateLogger<Startup>();
|
||||
|
||||
var identityServer =
|
||||
@ -62,29 +59,32 @@ namespace OpenAuth.WebApi
|
||||
options.Audience = "openauthapi";
|
||||
});
|
||||
}
|
||||
|
||||
// 添加MiniProfiler服务
|
||||
services.AddMiniProfiler(options =>
|
||||
{
|
||||
// 设定访问分析结果URL的路由基地址
|
||||
options.RouteBasePath = "/profiler";
|
||||
|
||||
|
||||
options.ColorScheme = StackExchange.Profiling.ColorScheme.Auto;
|
||||
options.PopupRenderPosition = StackExchange.Profiling.RenderPosition.BottomLeft;
|
||||
options.PopupShowTimeWithChildren = true;
|
||||
options.PopupShowTrivial = true;
|
||||
options.SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter();
|
||||
// options.IgnoredPaths.Add("/swagger/");
|
||||
}).AddEntityFramework();//显示SQL语句及耗时
|
||||
}).AddEntityFramework(); //显示SQL语句及耗时
|
||||
|
||||
//添加swagger
|
||||
services.AddSwaggerGen(option =>
|
||||
{
|
||||
foreach (var controller in GetControllers())
|
||||
{
|
||||
option.SwaggerDoc(controller.Name.Replace("Controller", ""), new OpenApiInfo
|
||||
var groupname = GetSwaggerGroupName(controller);
|
||||
|
||||
option.SwaggerDoc(groupname, new OpenApiInfo
|
||||
{
|
||||
Version = "v1",
|
||||
Title = controller.Name.Replace("Controller", ""),
|
||||
Title = groupname,
|
||||
Description = "by yubaolee"
|
||||
});
|
||||
}
|
||||
@ -173,22 +173,11 @@ namespace OpenAuth.WebApi
|
||||
|
||||
services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(Configuration["DataProtection"]));
|
||||
|
||||
|
||||
|
||||
//设置定时启动的任务
|
||||
services.AddHostedService<QuartzService>();
|
||||
}
|
||||
|
||||
private List<Type> GetControllers()
|
||||
{
|
||||
Assembly asm = Assembly.GetExecutingAssembly();
|
||||
|
||||
var controlleractionlist = asm.GetTypes()
|
||||
.Where(type => typeof(ControllerBase).IsAssignableFrom(type))
|
||||
.OrderBy(x => x.Name).ToList();
|
||||
return controlleractionlist;
|
||||
}
|
||||
|
||||
public void ConfigureContainer(ContainerBuilder builder)
|
||||
{
|
||||
AutofacExt.InitAutofac(builder);
|
||||
@ -234,25 +223,56 @@ namespace OpenAuth.WebApi
|
||||
|
||||
//配置ServiceProvider
|
||||
AutofacContainerModule.ConfigServiceProvider(app.ApplicationServices);
|
||||
|
||||
|
||||
|
||||
app.UseSwagger();
|
||||
|
||||
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
|
||||
// specifying the Swagger JSON endpoint.
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.IndexStream = () => GetType().GetTypeInfo().Assembly.GetManifestResourceStream("OpenAuth.WebApi.index.html");
|
||||
|
||||
{
|
||||
c.IndexStream = () =>
|
||||
GetType().GetTypeInfo().Assembly.GetManifestResourceStream("OpenAuth.WebApi.index.html");
|
||||
|
||||
foreach (var controller in GetControllers())
|
||||
{
|
||||
c.SwaggerEndpoint($"/swagger/{controller.Name.Replace("Controller", "")}/swagger.json",
|
||||
controller.Name.Replace("Controller", ""));
|
||||
var groupname = GetSwaggerGroupName(controller);
|
||||
|
||||
c.SwaggerEndpoint($"/swagger/{groupname}/swagger.json", groupname);
|
||||
}
|
||||
|
||||
c.DocExpansion(DocExpansion.List); //默认展开列表
|
||||
c.DocExpansion(DocExpansion.List); //默认展开列表
|
||||
c.OAuthClientId("OpenAuth.WebApi"); //oauth客户端名称
|
||||
c.OAuthAppName("开源版webapi认证"); // 描述
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取控制器对应的swagger分组值
|
||||
/// </summary>
|
||||
private string GetSwaggerGroupName(Type controller)
|
||||
{
|
||||
var groupname = controller.Name.Replace("Controller", "");
|
||||
var apisetting = controller.GetCustomAttribute(typeof(ApiExplorerSettingsAttribute));
|
||||
if (apisetting != null)
|
||||
{
|
||||
groupname = ((ApiExplorerSettingsAttribute) apisetting).GroupName;
|
||||
}
|
||||
|
||||
return groupname;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有的控制器
|
||||
/// </summary>
|
||||
private List<Type> GetControllers()
|
||||
{
|
||||
Assembly asm = Assembly.GetExecutingAssembly();
|
||||
|
||||
var controlleractionlist = asm.GetTypes()
|
||||
.Where(type => typeof(ControllerBase).IsAssignableFrom(type))
|
||||
.OrderBy(x => x.Name).ToList();
|
||||
return controlleractionlist;
|
||||
}
|
||||
}
|
||||
}
|
14
README.md
14
README.md
@ -36,13 +36,15 @@
|
||||
|
||||
|
||||
|
||||
## 关于OpenAuth.Net企业版的说明:
|
||||
## 关于OpenAuth.Net企业版/高级版的说明:
|
||||
|
||||
目前OpenAuth.Net以全部开源的方式向大众开放,对于有经验的开发者,官方文档足以满足日常开发。为了能让项目走的更远,特推出基于vue + element UI 的单页面应用程序,即企业版OpenAuth.Pro
|
||||
目前OpenAuth.Net以全部开源的方式向大众开放,对于有经验的开发者,官方文档足以满足日常开发。为了能让项目走的更远,特推出基于vue + element UI 的单页面应用程序,即企业版/高级版OpenAuth.Pro
|
||||
|
||||
**该版本后端基于OpenAuth.Core的API接口,前端基于vue-element-admin,采用VUE全家桶(VUE+VUEX+VUE-ROUTER)单页面SPA开发**
|
||||
**该版本是一套后端基于OpenAuth.WebAPI接口,前端基于vue-element-admin,采用VUE全家桶(VUE+VUEX+VUE-ROUTER)单页面SPA开发的管理后台 [点击这里查看效果](http://demo.openauth.me:1803)**
|
||||
|
||||
版本附赠VIP服务,提供VIP专属QQ群,企业报销凭据、专属内部文档、技术咨询服务等。[如何获取请查看这里](http://openauth.me/question/detail.html?id=a2be2d61-7fcb-4df8-8be2-9f296c22a89c),快加入VIP大家庭 **与有理想的.NET开发者一起成长**
|
||||
**另外** 企业版包含一套基于有赞Vant+Vue3的移动端界面,[请使用浏览器移动模式查看效果](http://demo.openauth.me:1804)
|
||||
|
||||
企业版/高级版附赠VIP服务,提供VIP专属QQ群,企业报销凭据、专属内部文档、技术咨询服务等。[如何获取请查看这里](http://openauth.me/question/detail.html?id=a2be2d61-7fcb-4df8-8be2-9f296c22a89c),快加入VIP大家庭 **与有理想的.NET开发者一起成长**
|
||||
|
||||
效果如下:
|
||||

|
||||
@ -62,7 +64,9 @@
|
||||
|
||||
## 演示直达
|
||||
|
||||
* 企业版演示地址: http://demo.openauth.me:1803
|
||||
* 企业版/高级版演示地址: http://demo.openauth.me:1803
|
||||
|
||||
* 企业版H5演示地址(请使用浏览器移动模式或直接用手机打开): http://demo.openauth.me:1804
|
||||
|
||||
* 开源版演示地址: http://demo.openauth.me:1802
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user