public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); app.UseVirtualFiles(); app.UseIdentityServer(); app.UseAbpRequestLocalization(); app.UseAuditing(); app.UseMvcWithDefaultRouteAndArea(); //TODO: Problem on a clustered environment using (var scope = context.ServiceProvider.CreateScope()) { AsyncHelper.RunSync(async() => { await scope.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( adminUserPassword: "******" ); await scope.ServiceProvider .GetRequiredService <IPermissionDataSeeder>() .SeedAsync( RolePermissionValueProvider.ProviderName, "admin", IdentityPermissions.GetAll() ); }); } }
private static void SeedDatabase(ApplicationInitializationContext context) { using (var scope = context.ServiceProvider.CreateScope()) { AsyncHelper.RunSync(async() => { var identitySeedResult = await scope.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*" ); if (identitySeedResult.CreatedAdminRole) { await scope.ServiceProvider .GetRequiredService <IPermissionDataSeeder>() .SeedAsync( RolePermissionValueProvider.ProviderName, "admin", IdentityPermissions.GetAll().Union(MyProjectNamePermissions.GetAll()) ); } }); } }
public void GetPublicConstantsRecursively_NestedTypes_Test() { var constants = ReflectionHelper.GetPublicConstantsRecursively(typeof(IdentityPermissions)); constants.ShouldNotBeEmpty(); constants.Except(IdentityPermissions.GetAll()).Count().ShouldBe(0); }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); if (context.GetEnvironment().IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseErrorPage(); } app.UseVirtualFiles(); app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); app.UseAuthentication(); app.UseRequestLocalization(app.ApplicationServices.GetRequiredService <IOptions <RequestLocalizationOptions> >().Value); app.UseMvc(routes => { routes.MapRoute( name: "defaultWithArea", template: "{area}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); using (var scope = context.ServiceProvider.CreateScope()) { AsyncHelper.RunSync(async() => { await scope.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*" ); await scope.ServiceProvider .GetRequiredService <IPermissionDataSeeder>() .SeedAsync( RolePermissionValueProvider.ProviderName, "admin", IdentityPermissions.GetAll().Union(BloggingPermissions.GetAll()) ); }); } }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); app.UseRequestLocalization(options => { options.DefaultRequestCulture = new RequestCulture("en-US", "en-US"); options.AddSupportedCultures("en-US"); options.AddSupportedUICultures("en-US"); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseErrorPage(); } //Necessary for LetsEncrypt app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @".well-known")), RequestPath = new PathString("/.well-known"), ServeUnknownFileTypes = true // serve extensionless file }); app.UseVirtualFiles(); app.UseAuthentication(); //TODO: Create an extension method! app.UseMvc(routes => { routes.MapRoute( name: "defaultWithArea", template: "{area}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); AsyncHelper.RunSync(async() => { await context.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*", IdentityPermissions.GetAll() .Union(BloggingPermissions.GetAll()) ); }); }
private void SeedDatabase(ApplicationInitializationContext context) { AsyncHelper.RunSync(async() => { await context.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*", IdentityPermissions.GetAll() //.Union(BookStorePermissions.GetAll()) ); }); }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); app.UseCorrelationId(); app.UseAbpRequestLocalization(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseErrorPage(); } //Necessary for LetsEncrypt app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @".well-known")), RequestPath = new PathString("/.well-known"), ServeUnknownFileTypes = true // serve extensionless file }); app.UseVirtualFiles(); app.UseAuthentication(); app.UseMvcWithDefaultRouteAndArea(); using (var scope = context.ServiceProvider.CreateScope()) { AsyncHelper.RunSync(async() => { await scope.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*" ); await scope.ServiceProvider .GetRequiredService <IPermissionDataSeeder>() .SeedAsync( RolePermissionValueProvider.ProviderName, "admin", IdentityPermissions.GetAll().Union(BloggingPermissions.GetAll()) ); }); } }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); if (context.GetEnvironment().IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseErrorPage(); } app.UseVirtualFiles(); app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); app.UseAuthentication(); app.UseAbpRequestLocalization(); app.UseAuditing(); app.UseMvcWithDefaultRouteAndArea(); using (var scope = context.ServiceProvider.CreateScope()) { AsyncHelper.RunSync(async() => { await scope.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*" ); await scope.ServiceProvider .GetRequiredService <IPermissionDataSeeder>() .SeedAsync( RolePermissionValueProvider.ProviderName, "admin", IdentityPermissions.GetAll().Union(MyProjectNamePermissions.GetAll()) ); }); } }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); if (context.GetEnvironment().IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseErrorPage(); } app.UseVirtualFiles(); app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); app.UseAuthentication(); app.UseAbpRequestLocalization(); app.UseAuditing(); app.UseMvc(routes => { routes.MapRoute( name: "defaultWithArea", template: "{area}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); AsyncHelper.RunSync(async() => { await context.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*", IdentityPermissions.GetAll().Union({ { cookiecutter.pn } } Permissions.GetAll()) ); }); }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); app.UseVirtualFiles(); app.UseIdentityServer(); app.UseAbpRequestLocalization(); app.UseAuditing(); app.UseMvcWithDefaultRouteAndArea(); //TODO: Problem on a clustered environment AsyncHelper.RunSync(async() => { await context.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*", IdentityPermissions.GetAll() ); }); }
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); app.UseDeveloperExceptionPage(); app.UseVirtualFiles(); app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); app.UseAuthentication(); app.UseRequestLocalization(app.ApplicationServices.GetRequiredService <IOptions <RequestLocalizationOptions> >().Value); app.UseMvc(routes => { routes.MapRoute( name: "defaultWithArea", template: "{area}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); AsyncHelper.RunSync(async() => { await context.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*", IdentityPermissions.GetAll().Union(DocsAdminPermissions.GetAll()) ); }); }
private void SeedDatabase(ApplicationInitializationContext context) { using (var scope = context.ServiceProvider.CreateScope()) { AsyncHelper.RunSync(async() => { await scope.ServiceProvider .GetRequiredService <IIdentityDataSeeder>() .SeedAsync( "1q2w3E*" ); await scope.ServiceProvider .GetRequiredService <IPermissionDataSeeder>() .SeedAsync( RolePermissionValueProvider.ProviderName, "admin", IdentityPermissions.GetAll() //.Union(BookStorePermissions.GetAll()) ); }); } }