Browse Source
Merge pull request #3932 from abpframework/liangshiwei/abp-template
Put UseAbpRequestLocalization after the UseMultiTenancy
pull/3970/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with
60 additions and
42 deletions
-
samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs
-
samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs
-
samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs
-
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs
-
samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs
-
samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs
-
samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs
-
templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyProjectNameWebTestModule.cs
-
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
-
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
-
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs
-
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs
|
|
|
@ -95,12 +95,12 @@ namespace AuthServer.Host |
|
|
|
app.UseCorrelationId(); |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
app.UseIdentityServer(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuditing(); |
|
|
|
app.UseConfiguredEndpoints(); |
|
|
|
|
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using Microsoft.AspNetCore.Authentication.OAuth.Claims; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
@ -119,12 +119,14 @@ namespace BackendAdminApp.Host |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using Microsoft.AspNetCore.Authentication.OAuth.Claims; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
@ -97,12 +97,14 @@ namespace PublicWebSite.Host |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseConfiguredEndpoints(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
@ -136,10 +136,12 @@ namespace BloggingService.Host |
|
|
|
currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); |
|
|
|
await next(); |
|
|
|
}); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); //TODO: localization?
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Claims; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
@ -102,10 +102,12 @@ namespace IdentityService.Host |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.Use(async (ctx, next) => |
|
|
|
{ |
|
|
|
var currentPrincipalAccessor = ctx.RequestServices.GetRequiredService<ICurrentPrincipalAccessor>(); |
|
|
|
@ -120,7 +122,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.UseAbpRequestLocalization(); //TODO: localization?
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Claims; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
@ -120,10 +120,12 @@ namespace ProductService.Host |
|
|
|
currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); |
|
|
|
await next(); |
|
|
|
}); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); //TODO: localization?
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Claims; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
@ -121,10 +121,12 @@ namespace TenantManagementService.Host |
|
|
|
currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); |
|
|
|
await next(); |
|
|
|
}); |
|
|
|
|
|
|
|
if (MsDemoConsts.IsMultiTenancyEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); //TODO: localization?
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
@ -179,12 +179,14 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseRouting(); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
@ -169,16 +169,16 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseRouting(); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseJwtTokenMiddleware(); |
|
|
|
|
|
|
|
app.UseJwtTokenMiddleware(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseIdentityServer(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
@ -135,7 +135,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
var app = context.GetApplicationBuilder(); |
|
|
|
@ -155,13 +155,15 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseRouting(); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseIdentityServer(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuditing(); |
|
|
|
app.UseAbpSerilogEnrichers(); |
|
|
|
app.UseConfiguredEndpoints(); |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using Microsoft.AspNetCore.Authentication.OAuth.Claims; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
@ -67,7 +67,7 @@ namespace MyCompanyName.MyProjectName.Web |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
|
@ -232,10 +232,8 @@ namespace MyCompanyName.MyProjectName.Web |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
using Microsoft.AspNetCore; |
|
|
|
@ -211,9 +211,10 @@ namespace MyCompanyName.MyProjectName.Web |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseIdentityServer(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Globalization; |
|
|
|
using Localization.Resources.AbpUi; |
|
|
|
@ -88,11 +88,11 @@ namespace MyCompanyName.MyProjectName |
|
|
|
}); |
|
|
|
|
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
|
|
|
|
app.Use(async (ctx, next) => |
|
|
|
{ |
|
|
|
@ -110,4 +110,4 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseConfiguredEndpoints(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
@ -166,8 +166,9 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseCorrelationId(); |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
@ -186,8 +187,8 @@ namespace MyCompanyName.MyProjectName |
|
|
|
currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer)))); |
|
|
|
await next(); |
|
|
|
}); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
@ -185,16 +185,18 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseCorrelationId(); |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseJwtTokenMiddleware(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseIdentityServer(); |
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
{ |
|
|
|
|
|
|
|
@ -73,7 +73,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
|
@ -234,16 +234,15 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseHttpsRedirection(); |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
|
|
@ -128,19 +128,21 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
{ |
|
|
|
app.UseMultiTenancy(); |
|
|
|
} |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
app.UseSwaggerUI(options => |
|
|
|
{ |
|
|
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); |
|
|
|
}); |
|
|
|
|
|
|
|
app.UseAbpRequestLocalization(); |
|
|
|
app.UseAuditing(); |
|
|
|
app.UseAbpSerilogEnrichers(); |
|
|
|
app.UseConfiguredEndpoints(); |
|
|
|
|