public override void ConfigureServices(IServiceCollection services) { var configuration = BuildConfiguration(Directory.GetCurrentDirectory()); AbpDeskDbConfigurer.Configure(services, configuration); services.AddAssemblyOf <AbpDeskConsoleDemoModule>(); }
public override void ConfigureServices(IServiceCollection services) { var hostingEnvironment = services.GetSingletonInstance <IHostingEnvironment>(); var configuration = BuildConfiguration(hostingEnvironment); AbpDeskDbConfigurer.Configure(services, configuration); services.Configure <NavigationOptions>(options => { options.MenuContributors.Add(new MainMenuContributor()); }); services.Configure <PermissionOptions>(options => { options.DefinitionProviders.Add <AbpDeskPermissionDefinitionProvider>(); }); //services.Configure<RemoteServiceOptions>(configuration); //Needed when we use Volo.Abp.Identity.HttpApi.Client var authentication = services.AddAuthentication(); services.AddAuthorization(options => { options.AddPolicy("RequirePhoneNumber", policy => { policy.RequireClaim("phone_number"); }); }); authentication.AddIdentityServerAuthentication("Bearer", options => { options.Authority = "http://localhost:59980"; options.RequireHttpsMetadata = false; options.ApiName = "api1"; }); ////Adding Facebook authentication (TODO: Move to Account module as much as possible) //if (bool.Parse(configuration["Authentication:Facebook:IsEnabled"])) //{ // authentication.AddFacebook(options => // { // options.AppId = configuration["Authentication:Facebook:AppId"]; // options.AppSecret = configuration["Authentication:Facebook:AppSecret"]; // options.Scope.Add("email"); // options.Scope.Add("public_profile"); // }); //} services.AddAssemblyOf <AbpDeskWebMvcModule>(); services.Configure <BundlingOptions>(options => { //TODO: To the framework! options.ScriptBundles.Add("GlobalScripts", new[] { "/Abp/ApplicationConfigurationScript?_v=" + DateTime.Now.Ticks, "/Abp/ServiceProxyScript?_v=" + DateTime.Now.Ticks }); }); services.Configure <AbpAspNetCoreMvcOptions>(options => { options.ConventionalControllers.Create(typeof(AbpDeskApplicationModule).Assembly); }); if (hostingEnvironment.IsDevelopment()) { services.Configure <VirtualFileSystemOptions>(options => { options.FileSets.ReplaceEmbeddedByPyhsical <AbpAspNetCoreMvcUiModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\..\\Volo.Abp.AspNetCore.Mvc.UI")); options.FileSets.ReplaceEmbeddedByPyhsical <AbpAspNetCoreMvcUiBootstrapModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\..\\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap")); options.FileSets.ReplaceEmbeddedByPyhsical <AbpAccountWebModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\..\\Volo.Abp.Account.Web")); options.FileSets.ReplaceEmbeddedByPyhsical <AbpIdentityWebModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\..\\Volo.Abp.Identity.Web")); options.FileSets.ReplaceEmbeddedByPyhsical <AbpMultiTenancyWebModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\..\\Volo.Abp.MultiTenancy.Web")); options.FileSets.ReplaceEmbeddedByPyhsical <AbpPermissionsWebModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\..\\Volo.Abp.Permissions.Web")); }); } }