Merge pull request #1337 from morgenthaler-de/cors_order

correct call order of "app.UseCors"
This commit is contained in:
Miguel Veloso 2020-06-17 17:04:46 +01:00 committed by GitHub
commit 9ec4837abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 21 deletions

View File

@ -64,9 +64,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
app.UseCors("CorsPolicy");
app.UseSwagger().UseSwaggerUI(c => app.UseSwagger().UseSwaggerUI(c =>
{ {
@ -79,6 +76,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
}); });
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>

View File

@ -64,9 +64,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
app.UseCors("CorsPolicy");
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseSwagger().UseSwaggerUI(c => app.UseSwagger().UseSwaggerUI(c =>
@ -80,6 +78,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
}); });
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();

View File

@ -209,11 +209,11 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
}); });
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);
app.UseStaticFiles(); app.UseStaticFiles();
app.UseCors("CorsPolicy");
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapGrpcService<BasketService>(); endpoints.MapGrpcService<BasketService>();

View File

@ -82,9 +82,9 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
{ {
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Catalog.API V1"); c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Catalog.API V1");
}); });
app.UseCors("CorsPolicy");
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapDefaultControllerRoute(); endpoints.MapDefaultControllerRoute();

View File

@ -168,9 +168,8 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseCors("CorsPolicy");
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>

View File

@ -163,10 +163,9 @@
{ {
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseCors("CorsPolicy");
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>

View File

@ -89,8 +89,6 @@
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseCors("CorsPolicy");
app.UseSwagger() app.UseSwagger()
.UseSwaggerUI(c => .UseSwaggerUI(c =>
{ {
@ -100,6 +98,7 @@
}); });
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>

View File

@ -133,10 +133,9 @@ namespace Ordering.SignalrHub
loggerFactory.CreateLogger<Startup>().LogDebug("Using PATH BASE '{pathBase}'", pathBase); loggerFactory.CreateLogger<Startup>().LogDebug("Using PATH BASE '{pathBase}'", pathBase);
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseCors("CorsPolicy");
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();

View File

@ -78,9 +78,10 @@ namespace Webhooks.API
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseCors("CorsPolicy");
app.UseRouting(); app.UseRouting();
app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>