sync with OpenAuth.Core

This commit is contained in:
yubaolee
2020-12-27 00:00:28 +08:00
parent 368eae8d63
commit 20a717b2e6
19 changed files with 451 additions and 199 deletions

View File

@@ -91,13 +91,17 @@ namespace OpenAuth.WebApi.Controllers
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
private static string lockobj = "lock";
[HttpPost]
public Response UnAssignDataProperty(AssignDataReq request)
{
var result = new Response();
try
{
_app.UnAssignData(request);
lock (lockobj)
{
_app.UnAssignData(request);
}
}
catch (Exception ex)
{

View File

@@ -67,7 +67,6 @@ namespace OpenAuth.WebApi.Controllers
/// <param name="files"></param>
/// <returns>服务器存储的文件信息</returns>
[HttpPost]
[AllowAnonymous]
public Response<IList<UploadFile>> Upload(IFormFileCollection files)
{
var result = new Response<IList<UploadFile>>();

View File

@@ -41,8 +41,10 @@ namespace OpenAuth.WebApi.Controllers
return result;
}
//添加或修改
[HttpPost]
/// <summary>
/// 添加角色如果当前登录用户不是System则直接把新角色分配给当前登录用户
/// </summary>
[HttpPost]
public Response<RoleView> Add(RoleView obj)
{
var result = new Response<RoleView>();
@@ -60,8 +62,12 @@ namespace OpenAuth.WebApi.Controllers
return result;
}
//添加或修改
/// <summary>
/// 更新角色属性
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
[HttpPost]
public Response Update(RoleView obj)
{

View File

@@ -17,8 +17,6 @@ namespace OpenAuth.WebApi
.ConfigureLogging((hostingContext, logging) =>
{
logging.ClearProviders(); //去掉默认的日志
logging.AddFilter("System", LogLevel.Error);
logging.AddFilter("Microsoft", LogLevel.Error);
logging.AddLog4Net();
})
.UseServiceProviderFactory(

View File

@@ -4,10 +4,10 @@ using System.IO;
using System.Linq;
using Autofac;
using IdentityServer4.AccessTokenValidation;
using Infrastructure.Extensions;
using Infrastructure.Extensions.AutofacManager;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@@ -38,6 +38,11 @@ namespace OpenAuth.WebApi
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
services.AddSingleton(provider =>
{
var service = provider.GetRequiredService<ILogger<StartupLogger>>();
@@ -161,8 +166,10 @@ namespace OpenAuth.WebApi
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostEnvironment env)
public void Configure(IApplicationBuilder app, IHostEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddLog4Net();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();

View File

@@ -2,8 +2,9 @@
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
"System": "Error",
"Microsoft": "Error",
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
}
}
}