// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApp(Configuration); services.AddControllersWithViews(options => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); options.Filters.Add(new AuthorizeFilter(policy)); }); services.AddRazorPages(); services.AddServerSideBlazor(); services.Configure <KustoOptions>(Configuration.GetSection("Kusto")); services.Configure <AzureADOptions>(Configuration.GetSection("AzureAd")); services.AddSingleton <AzureAuthenticationService>(); // App Services for Containers options services.Configure <ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; // Only loopback proxies are allowed by default. // Clear that restriction because forwarders are enabled by explicit // configuration. options.KnownNetworks.Clear(); options.KnownProxies.Clear(); }); var repositoryConfig = new RepositoryConfig(); Configuration.Bind("RepositoryConfig", repositoryConfig); services.AddSingleton(repositoryConfig); services.AddSingleton <Data.IssuesByRepository>(); services.AddSingleton <Data.AreaStatsByWeek>(); services.AddSingleton <KustoContextFactory>(); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(AzureADDefaults.AuthenticationScheme) .AddAzureAD(options => Configuration.Bind("AzureAd", options)); services.AddControllersWithViews(options => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); options.Filters.Add(new AuthorizeFilter(policy)); }); services.AddRazorPages(); services.AddServerSideBlazor(); services.Configure <KustoOptions>(Configuration.GetSection("Kusto")); services.AddSingleton <AzureAuthenticationService>(); // App Services for Containers options services.Configure <ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("::ffff:10.0.0.0"), 104)); options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("::ffff:192.168.0.0"), 112)); options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("::ffff:172.16.0.0"), 108)); }); var repositoryConfig = new RepositoryConfig(); Configuration.Bind("RepositoryConfig", repositoryConfig); services.AddSingleton(repositoryConfig); services.AddSingleton <Data.IssuesByRepository>(); services.AddSingleton <Data.AreaStatsByWeek>(); services.AddSingleton <KustoContextFactory>(); }