diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index 4414dc73ae..0976699f07 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.AspNetCore.Authentication.OAuth.Claims; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; @@ -118,8 +118,8 @@ namespace BackendAdminApp.Host app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); if (MsDemoConsts.IsMultiTenancyEnabled) { app.UseMultiTenancy(); diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs index 9ea7543228..1b2c0de935 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.AspNetCore.Authentication.OAuth.Claims; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; @@ -96,8 +96,8 @@ namespace PublicWebSite.Host app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); if (MsDemoConsts.IsMultiTenancyEnabled) { app.UseMultiTenancy(); diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs index c546c57ae5..97c351e93e 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -120,7 +120,6 @@ namespace BloggingService.Host app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); //TODO: localization? app.UseAuthentication(); app.Use(async (ctx, next) => @@ -137,6 +136,7 @@ namespace BloggingService.Host currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); await next(); }); + app.UseAbpRequestLocalization(); //TODO: localization? if (MsDemoConsts.IsMultiTenancyEnabled) { app.UseMultiTenancy(); diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs index 49c0bbd933..b950da980f 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Builder; @@ -101,12 +101,14 @@ namespace IdentityService.Host app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); //TODO: localization? app.UseAuthentication(); + app.UseAbpRequestLocalization(); //TODO: localization? + if (MsDemoConsts.IsMultiTenancyEnabled) { app.UseMultiTenancy(); } + app.Use(async (ctx, next) => { var currentPrincipalAccessor = ctx.RequestServices.GetRequiredService(); @@ -121,7 +123,6 @@ namespace IdentityService.Host currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); await next(); }); - app.UseSwagger(); app.UseSwaggerUI(options => { diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs index 9fb074fe76..6bb74c1f2b 100644 --- a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Builder; @@ -104,7 +104,6 @@ namespace ProductService.Host app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); //TODO: localization? app.UseAuthentication(); app.Use(async (ctx, next) => @@ -121,6 +120,7 @@ namespace ProductService.Host currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); await next(); }); + app.UseAbpRequestLocalization(); //TODO: localization? if (MsDemoConsts.IsMultiTenancyEnabled) { app.UseMultiTenancy(); diff --git a/samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs b/samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs index f068c2adf9..61c0d5105a 100644 --- a/samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Security.Claims; using Microsoft.AspNetCore.Builder; @@ -105,7 +105,6 @@ namespace TenantManagementService.Host app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); //TODO: localization? app.UseAuthentication(); app.Use(async (ctx, next) => @@ -122,6 +121,7 @@ namespace TenantManagementService.Host currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); await next(); }); + app.UseAbpRequestLocalization(); //TODO: localization? if (MsDemoConsts.IsMultiTenancyEnabled) { app.UseMultiTenancy(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index f560ac7e0a..5368ac81ed 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using Microsoft.AspNetCore.Builder; @@ -178,8 +178,8 @@ namespace MyCompanyName.MyProjectName app.UseVirtualFiles(); app.UseRouting(); app.UseCors(DefaultCorsPolicyName); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs index 06f52defb1..5b950c1d23 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Net.Http; @@ -168,10 +168,10 @@ namespace MyCompanyName.MyProjectName app.UseVirtualFiles(); app.UseRouting(); app.UseCors(DefaultCorsPolicyName); - app.UseAbpRequestLocalization(); app.UseAuthentication(); app.UseJwtTokenMiddleware(); - + app.UseAbpRequestLocalization(); + if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs index e3d6d5aa67..6835c537dc 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using Localization.Resources.AbpUi; @@ -154,12 +154,14 @@ namespace MyCompanyName.MyProjectName app.UseVirtualFiles(); app.UseRouting(); app.UseCors(DefaultCorsPolicyName); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); + if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); } + app.UseIdentityServer(); app.UseAuthorization(); app.UseAuditing(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs index 86738e3e1b..12c20e9ffe 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using Microsoft.AspNetCore.Authentication.OAuth.Claims; using Microsoft.AspNetCore.Builder; @@ -225,8 +225,8 @@ namespace MyCompanyName.MyProjectName.Web app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); if (MultiTenancyConsts.IsEnabled) { diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 541a2c5e3a..1a578ac994 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using Localization.Resources.AbpUi; using Microsoft.AspNetCore; @@ -204,9 +204,9 @@ namespace MyCompanyName.MyProjectName.Web app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); app.UseAuthentication(); app.UseJwtTokenMiddleware(); + app.UseAbpRequestLocalization(); if (MultiTenancyConsts.IsEnabled) { diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs index edde134027..28b5e3b55b 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using Localization.Resources.AbpUi; @@ -88,9 +88,9 @@ namespace MyCompanyName.MyProjectName }); app.UseVirtualFiles(); - app.UseRouting(); - app.UseAbpRequestLocalization(); + app.UseRouting(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); app.UseAuthorization(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index 8de889e88e..845126a67b 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using IdentityModel; @@ -164,13 +164,15 @@ namespace MyCompanyName.MyProjectName app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseCors(DefaultCorsPolicyName); - app.UseAbpRequestLocalization(); + app.UseCors(DefaultCorsPolicyName); app.UseAuthentication(); + app.UseAbpRequestLocalization(); + if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); } + app.UseAuthorization(); app.UseSwagger(); app.UseSwaggerUI(options => diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs index 4bfd5f689a..11627c93b9 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors; @@ -185,14 +185,16 @@ namespace MyCompanyName.MyProjectName app.UseCorrelationId(); app.UseVirtualFiles(); app.UseRouting(); - app.UseCors(DefaultCorsPolicyName); - app.UseAbpRequestLocalization(); + app.UseCors(DefaultCorsPolicyName); app.UseAuthentication(); app.UseJwtTokenMiddleware(); + app.UseAbpRequestLocalization(); + if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); } + app.UseIdentityServer(); app.UseAuthorization(); app.UseSwagger(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs index 6d16829e25..cf306f5277 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs @@ -234,8 +234,8 @@ namespace MyCompanyName.MyProjectName app.UseHttpsRedirection(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); if (MultiTenancyConsts.IsEnabled) { diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs index 57b77e5f50..653738d8ac 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs @@ -127,9 +127,10 @@ namespace MyCompanyName.MyProjectName app.UseHttpsRedirection(); app.UseVirtualFiles(); app.UseRouting(); - app.UseAbpRequestLocalization(); app.UseAuthentication(); + app.UseAbpRequestLocalization(); app.UseAuthorization(); + if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy();