using LINGYUN.Abp.AuditLogging.Elasticsearch; using LINGYUN.Abp.BlobStoring.OssManagement; using LINGYUN.Abp.Data.DbMigrator; using LINGYUN.Abp.ExceptionHandling.Emailing; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.Saas.EntityFrameworkCore; using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.WorkflowCore.Components; using LINGYUN.Abp.WorkflowCore.DistributedLock; using LINGYUN.Abp.WorkflowCore.LifeCycleEvent; using LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore; using LINGYUN.Abp.WorkflowCore.RabbitMQ; using LINGYUN.Abp.WorkflowManagement; using LINGYUN.Abp.WorkflowManagement.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System.Globalization; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.EntityFrameworkCore.MySQL; using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Swashbuckle; namespace LY.MicroService.WorkflowManagement; [DependsOn( typeof(AbpSerilogEnrichersApplicationModule), typeof(AbpSerilogEnrichersUniqueIdModule), typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpEventBusRabbitMqModule), typeof(AbpBlobStoringOssManagementModule), typeof(WorkflowManagementApplicationModule), typeof(WorkflowManagementHttpApiModule), typeof(WorkflowManagementEntityFrameworkCoreModule), typeof(AbpWorkflowCoreComponentsModule), typeof(AbpWorkflowCoreDistributedLockModule), typeof(AbpWorkflowCoreLifeCycleEventModule), typeof(AbpWorkflowCoreRabbitMQModule), typeof(AbpWorkflowCorePersistenceEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreMySQLModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpEmailingExceptionHandlingModule), typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpSaasEntityFrameworkCoreModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule), typeof(AbpDataDbMigratorModule), typeof(AbpCachingStackExchangeRedisModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpSwashbuckleModule), typeof(AbpAutofacModule) )] public partial class WorkflowManagementHttpApiHostModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { PreConfigureApp(); PreConfigureFeature(); } public override void ConfigureServices(ServiceConfigurationContext context) { var hostingEnvironment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); ConfigureDbContext(); ConfigureLocalization(); ConfigureJsonSerializer(); ConfigureExceptionHandling(); ConfigureVirtualFileSystem(); ConfigureCaching(configuration); ConfigureAuditing(configuration); ConfigureMultiTenancy(configuration); ConfigureSwagger(context.Services); ConfigureBlobStoring(context.Services, configuration); ConfigureDistributedLock(context.Services, configuration); ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); // 开发取消权限检查 // context.Services.AddAlwaysAllowAuthorization(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); app.UseStaticFiles(); app.UseCorrelationId(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); app.UseJwtTokenMiddleware(); app.UseMultiTenancy(); app.UseAbpRequestLocalization(options => options.SetDefaultCulture(CultureInfo.CurrentCulture.Name)); app.UseAuthorization(); app.UseSwagger(); app.UseAbpSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); var configuration = context.GetConfiguration(); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); options.OAuthScopes("WorkflowManagement"); }); app.UseAuditing(); app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } }