You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.6 KiB

2 years ago
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Identity.Web;
using Volo.Abp.Modularity;
using Volo.Abp.SettingManagement.Web;
using Volo.Abp.Swashbuckle;
using Volo.Abp.TenantManagement.Web;
using Volo.Abp.UI.Navigation;
using Volo.Abp.UI.Navigation.Urls;
using Win_in.Sfs.Auth.EntityFrameworkCore;
using Win_in.Sfs.Auth.Localization;
using Win_in.Sfs.Auth.Web.Menus;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.FileStorage;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Message.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Host;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Auth.Web;
[DependsOn(
typeof(AuthHttpApiModule),
typeof(AuthApplicationModule),
typeof(AuthEntityFrameworkCoreModule),
typeof(AbpAutofacModule),
typeof(AbpIdentityWebModule),
typeof(AbpSettingManagementWebModule),
typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpTenantManagementWebModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
typeof(AuthDomainSharedModule),
//---------------这里要添加 服务--------------
typeof(BasedataApplicationContractsModule),
typeof(InventoryApplicationContractsModule),
typeof(StoreApplicationContractsModule),
typeof(LabelApplicationContractsModule),
typeof(MessageApplicationContractsModule),
typeof(FileStorageApplicationContractsModule)
)]
public class AuthWebModule : ModuleBase<AuthWebModule>
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
base.ConfigureServices(context);
ConfigureNavigationServices();
ConfigureUrls(context);
base.ConfigureBundles();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
CreateDatabase<AuthDbContext>(context);
base.OnApplicationInitialization(context);
ConfigureIdentityServer4(context);
}
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
{
options.AddAssemblyResource(
typeof(AuthResource),
typeof(AuthDomainModule).Assembly,
typeof(AuthDomainSharedModule).Assembly,
typeof(AuthApplicationModule).Assembly,
typeof(AuthApplicationContractsModule).Assembly,
typeof(AuthWebModule).Assembly
);
});
}
private static void ConfigureIdentityServer4(ApplicationInitializationContext context)
{
context.ServiceProvider.SetPasswordRules();
context.GetApplicationBuilder().UseIdentityServer();
}
private void ConfigureNavigationServices()
{
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new AuthMenuContributor());
});
}
private void ConfigureUrls(ServiceConfigurationContext context)
{
Configure<AppUrlOptions>(options =>
{
options.Applications["MVC"].RootUrl = context.Services.GetConfiguration()["App:SelfUrl"];
});
}
}