|
|
@ -2,21 +2,19 @@ using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.IO; |
|
|
using System.IO; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Security.Claims; |
|
|
|
|
|
using IdentityModel; |
|
|
using IdentityModel; |
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Cors; |
|
|
using Microsoft.AspNetCore.Cors; |
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.Hosting; |
|
|
using Microsoft.Extensions.Hosting; |
|
|
using MyCompanyName.MyProjectName.EntityFrameworkCore; |
|
|
using MyCompanyName.MyProjectName.EntityFrameworkCore; |
|
|
using MyCompanyName.MyProjectName.MultiTenancy; |
|
|
using MyCompanyName.MyProjectName.MultiTenancy; |
|
|
using StackExchange.Redis; |
|
|
using StackExchange.Redis; |
|
|
using Microsoft.OpenApi.Models; |
|
|
using Microsoft.OpenApi.Models; |
|
|
using Swashbuckle.AspNetCore.Swagger; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; |
|
|
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; |
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|
|
using Volo.Abp.AspNetCore.Serilog; |
|
|
using Volo.Abp.AspNetCore.Serilog; |
|
|
@ -32,6 +30,7 @@ using Volo.Abp.MultiTenancy; |
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.Security.Claims; |
|
|
using Volo.Abp.Security.Claims; |
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
|
|
|
|
using Volo.Abp.Swashbuckle; |
|
|
using Volo.Abp.VirtualFileSystem; |
|
|
using Volo.Abp.VirtualFileSystem; |
|
|
|
|
|
|
|
|
namespace MyCompanyName.MyProjectName |
|
|
namespace MyCompanyName.MyProjectName |
|
|
@ -47,7 +46,8 @@ namespace MyCompanyName.MyProjectName |
|
|
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|
|
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|
|
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpAspNetCoreSerilogModule) |
|
|
typeof(AbpAspNetCoreSerilogModule), |
|
|
|
|
|
typeof(AbpSwashbuckleModule) |
|
|
)] |
|
|
)] |
|
|
public class MyProjectNameHttpApiHostModule : AbpModule |
|
|
public class MyProjectNameHttpApiHostModule : AbpModule |
|
|
{ |
|
|
{ |
|
|
@ -79,10 +79,15 @@ namespace MyCompanyName.MyProjectName |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
context.Services.AddSwaggerGen( |
|
|
context.Services.AddAbpSwaggerGenWithOAuth( |
|
|
|
|
|
configuration["AuthServer:Authority"], |
|
|
|
|
|
new Dictionary<string, string> |
|
|
|
|
|
{ |
|
|
|
|
|
{"MyProjectName", "MyProjectName API"} |
|
|
|
|
|
}, |
|
|
options => |
|
|
options => |
|
|
{ |
|
|
{ |
|
|
options.SwaggerDoc("v1", new OpenApiInfo { Title = "MyProjectName API", Version = "v1" }); |
|
|
options.SwaggerDoc("v1", new OpenApiInfo {Title = "MyProjectName API", Version = "v1"}); |
|
|
options.DocInclusionPredicate((docName, description) => true); |
|
|
options.DocInclusionPredicate((docName, description) => true); |
|
|
options.CustomSchemaIds(type => type.FullName); |
|
|
options.CustomSchemaIds(type => type.FullName); |
|
|
}); |
|
|
}); |
|
|
@ -179,6 +184,10 @@ namespace MyCompanyName.MyProjectName |
|
|
app.UseSwaggerUI(options => |
|
|
app.UseSwaggerUI(options => |
|
|
{ |
|
|
{ |
|
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); |
|
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); |
|
|
|
|
|
|
|
|
|
|
|
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>(); |
|
|
|
|
|
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); |
|
|
|
|
|
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); |
|
|
}); |
|
|
}); |
|
|
app.UseAuditing(); |
|
|
app.UseAuditing(); |
|
|
app.UseAbpSerilogEnrichers(); |
|
|
app.UseAbpSerilogEnrichers(); |
|
|
|