对接fake admin
This commit is contained in:
parent
9b28998dcc
commit
8a7c1b895a
6
Directory.Build.props
Normal file
6
Directory.Build.props
Normal file
@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<!-- All Fake packages -->
|
||||
<FakePackageVersion>8.0.0-preview21</FakePackageVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -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}"
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InterfaceForward.Application\InterfaceForward.Application.csproj" />
|
||||
<ProjectReference Include="..\InterfaceForward.ServiceDefaults\InterfaceForward.ServiceDefaults.csproj"/>
|
||||
<PackageReference Include="Fake.Autofac" Version="8.0.0-preview18" />
|
||||
<PackageReference Include="Fake.Autofac" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.18" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
|
||||
@ -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<ApplicationService2ControllerOptions>(options =>
|
||||
services.Configure<FakeAspNetCoreMvcOptions>(options =>
|
||||
{
|
||||
options.ScanApplicationServices<InterfaceForwardApplicationModule>();
|
||||
options.ApplicationServices2Controller<InterfaceForwardApplicationModule>();
|
||||
});
|
||||
|
||||
// 全局授权配置:所有接口默认需要授权
|
||||
@ -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<JWTSettingsOptions>();
|
||||
options.TokenValidationParameters = JWTEncryption.CreateTokenValidationParameters(jwtSettings);
|
||||
});
|
||||
|
||||
services.AddFakeJwtAuthentication();
|
||||
|
||||
// 添加授权服务
|
||||
services.AddAuthorization();
|
||||
|
||||
@ -14,13 +14,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DiffPlex" Version="1.7.2" />
|
||||
<PackageReference Include="DiffPlex" Version="1.9.0" />
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
|
||||
<PackageReference Include="DotNetCore.Natasha.CSharp" Version="5.2.2.1"/>
|
||||
<PackageReference Include="Fake.AspNetCore" Version="8.0.0-preview18" />
|
||||
<PackageReference Include="Fake.EventBus.RabbitMQ" Version="8.0.0-preview18" />
|
||||
<PackageReference Include="Fake.ObjectMapping.AutoMapper" Version="8.0.0-preview18" />
|
||||
<PackageReference Include="FreeRedis" Version="1.3.6" />
|
||||
<PackageReference Include="Fake.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Fake.EventBus.RabbitMQ" Version="8.0.0" />
|
||||
<PackageReference Include="Fake.ObjectMapping.AutoMapper" Version="8.0.0" />
|
||||
<PackageReference Include="FreeRedis" Version="1.5.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -5,12 +5,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="Serilog" Version="4.2.1-dev-02337" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0-preview18" />
|
||||
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fake.SqlSugarCore" Version="8.0.0-preview18" />
|
||||
<PackageReference Include="Fake.SqlSugarCore" Version="8.0.0" />
|
||||
<PackageReference Include="NEST" Version="7.17.5" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user