Ejemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
                {
                    Authority            = "http://localhost:5000",
                    RequireHttpsMetadata = false,
                    ApiName = "api1"
                });
                app.UseCors("devCors");
            }
            else
            {
                var options = new RewriteOptions().AddRedirectToHttps(302); // redirect to https
                app.UseRewriter(options);

                app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
                {
                    Authority            = "https://identityserver-d1.azurewebsites.net",
                    RequireHttpsMetadata = false,
                    ApiName = "api1"
                });
                app.UseCors("prodCors");
            }

            app.UseMvc();

            NumberService.Initialize();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors("default");
            app.UseAuthentication();
            app.UseMvc();

            NumberService.Initialize();
        }