Browse Source

Add multi-tenancy packages and enabled multi-tenancy for all applications.

pull/3032/head
Halil İbrahim Kalkan 7 years ago
parent
commit
1c07d20c97
  1. 9
      samples/MicroserviceDemo/MicroserviceDemo.sln
  2. 1
      samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj
  3. 8
      samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs
  4. 1
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj
  5. 11
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs
  6. 1
      samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj
  7. 12
      samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs
  8. 2
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj
  9. 16
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs
  10. 4
      samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj
  11. 16
      samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs
  12. 2
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj
  13. 16
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs
  14. 2
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj
  15. 16
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs
  16. 2
      samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj
  17. 16
      samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs
  18. 2
      samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj
  19. 16
      samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs
  20. 4
      samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementService.Host.csproj
  21. 16
      samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs
  22. 7
      samples/MicroserviceDemo/shared/MsDemo.Shared/MsDemo.Shared.csproj
  23. 7
      samples/MicroserviceDemo/shared/MsDemo.Shared/MsDemoConsts.cs

9
samples/MicroserviceDemo/MicroserviceDemo.sln

@ -63,6 +63,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicWebSite.Host", "appli
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TenantManagementService.Host", "microservices\TenantManagementService.Host\TenantManagementService.Host.csproj", "{3E1DDEDA-A897-470F-81C2-5A3AFA6D0B61}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{2B3B460C-0293-44A1-BEF4-91A778CE73CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsDemo.Shared", "shared\MsDemo.Shared\MsDemo.Shared.csproj", "{D4549E30-18CC-4157-B994-C0097216C2C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -161,6 +165,10 @@ Global
{3E1DDEDA-A897-470F-81C2-5A3AFA6D0B61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E1DDEDA-A897-470F-81C2-5A3AFA6D0B61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E1DDEDA-A897-470F-81C2-5A3AFA6D0B61}.Release|Any CPU.Build.0 = Release|Any CPU
{D4549E30-18CC-4157-B994-C0097216C2C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4549E30-18CC-4157-B994-C0097216C2C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4549E30-18CC-4157-B994-C0097216C2C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4549E30-18CC-4157-B994-C0097216C2C8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -192,6 +200,7 @@ Global
{BB8FA269-460D-42BE-90A0-E97D6A3FDEB1} = {8F6834D7-E6FA-4A04-83BB-955F68EA0A0A}
{29A3A4EF-DEC4-4E43-B6B8-D565667F85EC} = {8F6834D7-E6FA-4A04-83BB-955F68EA0A0A}
{3E1DDEDA-A897-470F-81C2-5A3AFA6D0B61} = {3B26D176-390B-4F51-BE52-E9B422C28A88}
{D4549E30-18CC-4157-B994-C0097216C2C8} = {2B3B460C-0293-44A1-BEF4-91A778CE73CE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {37474F0D-2E52-4D2F-B39B-7FE3FF31B4EC}

1
samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj

@ -36,6 +36,7 @@
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application.Contracts\Volo.Abp.TenantManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.EntityFrameworkCore\Volo.Abp.TenantManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

8
samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs

@ -2,6 +2,7 @@ using AuthServer.Host.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using MsDemo.Shared;
using StackExchange.Redis;
using Volo.Abp;
using Volo.Abp.Account;
@ -57,7 +58,7 @@ namespace AuthServer.Host
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = true;
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
Configure<AbpDbContextOptions>(options =>
@ -94,7 +95,10 @@ namespace AuthServer.Host
app.UseCorrelationId();
app.UseVirtualFiles();
app.UseRouting();
app.UseMultiTenancy();
if (MsDemoConsts.IsMultiTenancyEnabled)
{
app.UseMultiTenancy();
}
app.UseIdentityServer();
app.UseAbpRequestLocalization();
app.UseAuditing();

1
samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj

@ -36,6 +36,7 @@
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.Application.Contracts\Volo.Blogging.Application.Contracts.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.HttpApi.Client\ProductManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.Web\ProductManagement.Web.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

11
samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs

@ -7,6 +7,7 @@ using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using ProductManagement;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.Authentication.OAuth;
@ -19,6 +20,7 @@ using Volo.Abp.Identity;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.TenantManagement;
using Volo.Abp.TenantManagement.Web;
@ -53,6 +55,11 @@ namespace BackendAdminApp.Host
options.Languages.Add(new LanguageInfo("en", "en", "English"));
});
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
@ -106,6 +113,10 @@ namespace BackendAdminApp.Host
app.UseVirtualFiles();
app.UseRouting();
app.UseAuthentication();
if (MsDemoConsts.IsMultiTenancyEnabled)
{
app.UseMultiTenancy();
}
app.UseAuthorization();
app.UseAbpRequestLocalization();
app.UseSwagger();

1
samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj

@ -29,6 +29,7 @@
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.HttpApi.Client\Volo.Blogging.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.Web\Volo.Blogging.Web.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.HttpApi.Client\ProductManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

12
samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using MsDemo.Shared;
using ProductManagement;
using StackExchange.Redis;
using Volo.Abp;
@ -14,6 +15,7 @@ using Volo.Abp.Autofac;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.UI.Navigation;
using Volo.Blogging;
@ -40,6 +42,11 @@ namespace PublicWebSite.Host
options.Languages.Add(new LanguageInfo("en", "en", "English"));
});
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new PublicWebSiteMenuContributor());
@ -90,6 +97,11 @@ namespace PublicWebSite.Host
app.UseVirtualFiles();
app.UseRouting();
app.UseAuthentication();
if (MsDemoConsts.IsMultiTenancyEnabled)
{
app.UseMultiTenancy();
}
app.UseAuthorization();
app.UseAbpRequestLocalization();
app.UseMvcWithDefaultRouteAndArea();
}

2
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj

@ -24,6 +24,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.Web\Volo.Abp.Http.Client.IdentityModel.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.csproj" />
@ -42,6 +43,7 @@
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.HttpApi\Volo.Abp.TenantManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.HttpApi.Client\Volo.Abp.TenantManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs

@ -9,8 +9,10 @@ using Ocelot.Middleware;
using ProductManagement;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Autofac;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
@ -19,6 +21,7 @@ using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.HttpApi;
@ -50,7 +53,8 @@ namespace BackendAdminAppGateway.Host
typeof(AbpTenantManagementHttpApiClientModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule),
typeof(AbpFeatureManagementApplicationModule),
typeof(AbpFeatureManagementHttpApiModule)
typeof(AbpFeatureManagementHttpApiModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class BackendAdminAppGatewayHostModule : AbpModule
{
@ -58,6 +62,11 @@ namespace BackendAdminAppGateway.Host
{
var configuration = context.Services.GetConfiguration();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -113,7 +122,10 @@ namespace BackendAdminAppGateway.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.UseSwagger();
app.UseSwaggerUI(options =>
{

4
samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
@ -24,6 +24,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.HttpApi\Volo.Abp.TenantManagement.HttpApi.csproj" />
@ -31,6 +32,7 @@
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs

@ -9,13 +9,16 @@ using Ocelot.Middleware;
using ProductManagement;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Autofac;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
@ -32,7 +35,8 @@ namespace InternalGateway.Host
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpTenantManagementHttpApiModule)
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class InternalGatewayHostModule : AbpModule
{
@ -40,6 +44,11 @@ namespace InternalGateway.Host
{
var configuration = context.Services.GetConfiguration();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -95,7 +104,10 @@ namespace InternalGateway.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.UseSwagger();
app.UseSwaggerUI(options =>
{

2
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj

@ -24,11 +24,13 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.HttpApi\Volo.Blogging.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs

@ -9,12 +9,15 @@ using Ocelot.Middleware;
using ProductManagement;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Autofac;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
@ -28,7 +31,8 @@ namespace PublicWebSiteGateway.Host
typeof(ProductManagementHttpApiModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule)
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class PublicWebSiteGatewayHostModule : AbpModule
{
@ -36,6 +40,11 @@ namespace PublicWebSiteGateway.Host
{
var configuration = context.Services.GetConfiguration();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -91,7 +100,10 @@ namespace PublicWebSiteGateway.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.UseSwagger();
app.UseSwaggerUI(options =>
{

2
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj

@ -23,6 +23,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.MongoDB\Volo.Abp.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.Web\Volo.Abp.Http.Client.IdentityModel.Web.csproj" />
@ -34,6 +35,7 @@
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs

@ -9,8 +9,10 @@ using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Auditing;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
@ -23,6 +25,7 @@ using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
@ -45,7 +48,8 @@ namespace BloggingService.Host
typeof(BloggingMongoDbModule),
typeof(BloggingApplicationModule),
typeof(AbpHttpClientIdentityModelWebModule),
typeof(AbpIdentityHttpApiClientModule)
typeof(AbpIdentityHttpApiClientModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class BloggingServiceHostModule : AbpModule
{
@ -54,6 +58,11 @@ namespace BloggingService.Host
var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -123,7 +132,10 @@ 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 =>

2
samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj

@ -23,6 +23,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.csproj" />
@ -31,6 +32,7 @@
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs

@ -6,8 +6,10 @@ using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Auditing;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
@ -18,6 +20,7 @@ using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
@ -33,7 +36,8 @@ namespace IdentityService.Host
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpIdentityHttpApiModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpIdentityApplicationModule)
typeof(AbpIdentityApplicationModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class IdentityServiceHostModule : AbpModule
{
@ -41,6 +45,11 @@ namespace IdentityService.Host
{
var configuration = context.Services.GetConfiguration();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -90,7 +99,10 @@ 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>();

2
samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj

@ -24,6 +24,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
@ -32,6 +33,7 @@
<ProjectReference Include="..\..\modules\product\src\ProductManagement.Application\ProductManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.EntityFrameworkCore\ProductManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\product\src\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs

@ -8,8 +8,10 @@ using ProductManagement;
using ProductManagement.EntityFrameworkCore;
using StackExchange.Redis;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Auditing;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
@ -19,6 +21,7 @@ using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
@ -35,7 +38,8 @@ namespace ProductService.Host
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(ProductManagementApplicationModule),
typeof(ProductManagementHttpApiModule),
typeof(ProductManagementEntityFrameworkCoreModule)
typeof(ProductManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class ProductServiceHostModule : AbpModule
{
@ -43,6 +47,11 @@ namespace ProductService.Host
{
var configuration = context.Services.GetConfiguration();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -107,7 +116,10 @@ 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 =>

4
samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementService.Host.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
@ -23,6 +23,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.HttpApi\Volo.Abp.TenantManagement.HttpApi.csproj" />
@ -31,6 +32,7 @@
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\shared\MsDemo.Shared\MsDemo.Shared.csproj" />
</ItemGroup>
<ItemGroup>

16
samples/MicroserviceDemo/microservices/TenantManagementService.Host/TenantManagementServiceHostModule.cs

@ -5,8 +5,10 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using MsDemo.Shared;
using StackExchange.Redis;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Auditing;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
@ -15,6 +17,7 @@ using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
@ -32,7 +35,8 @@ namespace TenantManagementService.Host
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpTenantManagementApplicationModule)
typeof(AbpTenantManagementApplicationModule),
typeof(AbpAspNetCoreMultiTenancyModule)
)]
public class TenantManagementServiceHostModule : AbpModule
{
@ -40,6 +44,11 @@ namespace TenantManagementService.Host
{
var configuration = context.Services.GetConfiguration();
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MsDemoConsts.IsMultiTenancyEnabled;
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
@ -104,7 +113,10 @@ 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 =>

7
samples/MicroserviceDemo/shared/MsDemo.Shared/MsDemo.Shared.csproj

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

7
samples/MicroserviceDemo/shared/MsDemo.Shared/MsDemoConsts.cs

@ -0,0 +1,7 @@
namespace MsDemo.Shared
{
public class MsDemoConsts
{
public const bool IsMultiTenancyEnabled = true;
}
}
Loading…
Cancel
Save