diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..91986a4 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,6 @@ + + + + 8.0.0-preview21 + + diff --git a/InterfaceForward.sln b/InterfaceForward.sln index 3e83c54..4149f2d 100644 --- a/InterfaceForward.sln +++ b/InterfaceForward.sln @@ -15,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution .gitignore = .gitignore global.json = global.json docker-compose.yml = docker-compose.yml + Directory.Build.props = Directory.Build.props EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InterfaceForward.Repositories", "src\InterfaceForward.Repositories\InterfaceForward.Repositories.csproj", "{AB53F0CC-DE7A-4AE9-B6AA-2A8283B4EB23}" diff --git a/src/InterfaceForward.Api/InterfaceForward.Api.csproj b/src/InterfaceForward.Api/InterfaceForward.Api.csproj index d81b7d8..249cb20 100644 --- a/src/InterfaceForward.Api/InterfaceForward.Api.csproj +++ b/src/InterfaceForward.Api/InterfaceForward.Api.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/InterfaceForward.Api/InterfaceForwardApiModule.cs b/src/InterfaceForward.Api/InterfaceForwardApiModule.cs index 9e86e11..47a9da4 100644 --- a/src/InterfaceForward.Api/InterfaceForwardApiModule.cs +++ b/src/InterfaceForward.Api/InterfaceForwardApiModule.cs @@ -1,10 +1,12 @@ using Fake.AspNetCore; using Fake.AspNetCore.Auditing; +using Fake.AspNetCore.Mvc; using Fake.AspNetCore.Mvc.Conventions; using Fake.AspNetCore.Mvc.Filters; using Fake.Authorization; using Fake.Autofac; using Fake.Modularity; +using Fake.Security.Claims; using InterfaceForward.Application; using InterfaceForward.Application.Filters; using InterfaceForward.Domain.Shared; @@ -24,6 +26,12 @@ namespace InterfaceForward.Api; public class InterfaceForwardApiModule : FakeModule { private const string DefaultCorsPolicyName = "default"; + + public override void PreConfigureServices(ServiceConfigurationContext context) + { + FakeClaimTypes.UserId = "mapId"; + } + public override void ConfigureServices(ServiceConfigurationContext context) { var services = context.Services; @@ -32,9 +40,9 @@ public class InterfaceForwardApiModule : FakeModule // Add services to the container. services.AddProblemDetails(); - services.Configure(options => + services.Configure(options => { - options.ScanApplicationServices(); + options.ApplicationServices2Controller(); }); // 全局授权配置:所有接口默认需要授权 @@ -80,10 +88,7 @@ public class InterfaceForwardApiModule : FakeModule } }); }) - .AddFakeExceptionFilter() - .AddFakeValidationActionFilter() - .AddFakeAspNetCoreAuditing() - .AddFakeUnitOfWorkActionFilter(); + .AddFakeAspNetCoreAuditing(); services.AddCors(options => { @@ -104,16 +109,8 @@ public class InterfaceForwardApiModule : FakeModule options.KnownNetworks.Clear(); options.KnownProxies.Clear(); }); - - services.AddAuthentication(options => - { - options.DefaultAuthenticateScheme = "Bearer"; - options.DefaultChallengeScheme = "Bearer"; - }).AddJwtBearer(options => - { - var jwtSettings = configuration.GetSection("JWTSettings").Get(); - options.TokenValidationParameters = JWTEncryption.CreateTokenValidationParameters(jwtSettings); - }); + + services.AddFakeJwtAuthentication(); // 添加授权服务 services.AddAuthorization(); diff --git a/src/InterfaceForward.Application/InterfaceForward.Application.csproj b/src/InterfaceForward.Application/InterfaceForward.Application.csproj index 393af4d..cbb506c 100644 --- a/src/InterfaceForward.Application/InterfaceForward.Application.csproj +++ b/src/InterfaceForward.Application/InterfaceForward.Application.csproj @@ -14,13 +14,13 @@ - + - - - - + + + + diff --git a/src/InterfaceForward.Domain.Shared/InterfaceForward.Domain.Shared.csproj b/src/InterfaceForward.Domain.Shared/InterfaceForward.Domain.Shared.csproj index e7c0e9e..6f63269 100644 --- a/src/InterfaceForward.Domain.Shared/InterfaceForward.Domain.Shared.csproj +++ b/src/InterfaceForward.Domain.Shared/InterfaceForward.Domain.Shared.csproj @@ -5,12 +5,12 @@ - + - + diff --git a/src/InterfaceForward.Repositories/InterfaceForward.Repositories.csproj b/src/InterfaceForward.Repositories/InterfaceForward.Repositories.csproj index b4fa23e..9494678 100644 --- a/src/InterfaceForward.Repositories/InterfaceForward.Repositories.csproj +++ b/src/InterfaceForward.Repositories/InterfaceForward.Repositories.csproj @@ -7,7 +7,7 @@ - +