Last active
January 25, 2018 05:00
-
-
Save saurabhpati/295ea54e8c2bbcf7559911c7e76ccaeb to your computer and use it in GitHub Desktop.
Startup class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
// Use this method to add services to the container. | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddSingleton<IDependecy, Dependency>() | |
.AddScoped<UserManager<AppUser>>() | |
.AddTransient<IUserClaimsPrincipalFactory<AppUser>, AppUserClaimsPrincipalFactory>(); | |
} | |
// Use this method to configure the HTTP request pipeline. | |
public void Configure(IApplicationBuilder app) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
app.UseHsts(option => option.MaxAge(days: 10)) // Using http strict transport security protocol. | |
.UseCsp(option => option.DefaultSources(source => source.Self())) // Using content security protocol for anti xss. | |
.UseXfo(option => option.Deny()) // Denying X-Frames to run on the site to prevent click-jacking. | |
.UseStaticFiles() | |
.UseStatusCodePages() | |
.UseAuthentication() | |
.UseMvc(route => route.MapRoute(name: "default", template: "{Controller=HomeController}/{Action=Index}/{id?}")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment