Compare commits
	
		
			2 Commits
		
	
	
		
			dv_karl
			...
			c667df1ce3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c667df1ce3 | |||
| 886cec11fb | 
							
								
								
									
										44
									
								
								KonSoft.sln
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								KonSoft.sln
									
									
									
									
									
								
							| @ -1,7 +1,7 @@ | ||||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||||
| # Visual Studio Version 17 | ||||
| VisualStudioVersion = 17.14.36414.22 d17.14 | ||||
| VisualStudioVersion = 17.14.36414.22 | ||||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "applications", "applications", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" | ||||
| EndProject | ||||
| @ -49,8 +49,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E67FA5C3-132 | ||||
| EndProject | ||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{1C06151A-45F0-4D48-8303-3D4CBE9517F7}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared", "shared\KonSoft.Shared\KonSoft.Shared.csproj", "{345B5CDA-DC77-4956-BF96-80707EC1B5B2}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Admin.Application", "modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj", "{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Admin.Application.Contracts", "modules\admin\src\KonSoft.Admin.Application.Contracts\KonSoft.Admin.Application.Contracts.csproj", "{9F68B0E2-0B1D-E0E8-1BE7-079F693A4643}" | ||||
| @ -185,6 +183,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Report.HttpApi.Host | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.TenantManagement.HttpApi.Host", "microservices\KonSoft.TenantManagement.HttpApi.Host\KonSoft.TenantManagement.HttpApi.Host.csproj", "{3641CA05-99C5-2245-C663-6CE00730E87C}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Localization", "shared\KonSoft.Shared.Localization\KonSoft.Shared.Localization.csproj", "{A773C53C-F145-043A-7F55-79ABDB11893B}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting", "shared\KonSoft.Shared.Hosting\KonSoft.Shared.Hosting.csproj", "{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting.AspNetCore", "shared\KonSoft.Shared.Hosting.AspNetCore\KonSoft.Shared.Hosting.AspNetCore.csproj", "{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting.Gateways", "shared\KonSoft.Shared.Hosting.Gateways\KonSoft.Shared.Hosting.Gateways.csproj", "{BBB1A129-9ED7-4F08-B710-B6C287197BFB}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KonSoft.Shared.Hosting.Microservices", "shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj", "{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Any CPU = Debug|Any CPU | ||||
| @ -203,10 +211,6 @@ Global | ||||
| 		{AEBC7053-743F-4F80-BD10-8ED6A8A7B3EE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{AEBC7053-743F-4F80-BD10-8ED6A8A7B3EE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{AEBC7053-743F-4F80-BD10-8ED6A8A7B3EE}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{345B5CDA-DC77-4956-BF96-80707EC1B5B2}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| @ -475,6 +479,26 @@ Global | ||||
| 		{3641CA05-99C5-2245-C663-6CE00730E87C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{3641CA05-99C5-2245-C663-6CE00730E87C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{3641CA05-99C5-2245-C663-6CE00730E87C}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{A773C53C-F145-043A-7F55-79ABDB11893B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{A773C53C-F145-043A-7F55-79ABDB11893B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{A773C53C-F145-043A-7F55-79ABDB11893B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{A773C53C-F145-043A-7F55-79ABDB11893B}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{8CA6B487-3AAF-4E77-ACE0-01D878DE4836}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{BBB1A129-9ED7-4F08-B710-B6C287197BFB}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{ADF28580-F8A0-4495-96D6-736C6C7CF3FF}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| @ -498,7 +522,6 @@ Global | ||||
| 		{6C762F40-30BB-4CDA-951B-01D45F7C2B53} = {AAF02051-771B-4CC0-BD17-1A3643F83E09} | ||||
| 		{E67FA5C3-132C-4F47-B6A6-8FA4376C70BB} = {CF59695F-7948-4743-A467-42E4B4C9EECA} | ||||
| 		{1C06151A-45F0-4D48-8303-3D4CBE9517F7} = {CF59695F-7948-4743-A467-42E4B4C9EECA} | ||||
| 		{345B5CDA-DC77-4956-BF96-80707EC1B5B2} = {7EFFD2C6-2041-4967-A715-0F817D70C433} | ||||
| 		{9D9D979A-AFC7-F9D0-2D23-8809E83F9EF9} = {EBCB740D-07E7-4CED-A422-90EB824B9021} | ||||
| 		{9F68B0E2-0B1D-E0E8-1BE7-079F693A4643} = {EBCB740D-07E7-4CED-A422-90EB824B9021} | ||||
| 		{D1A86C77-533D-5B68-04F1-7F7BFBF56AC7} = {EBCB740D-07E7-4CED-A422-90EB824B9021} | ||||
| @ -566,6 +589,11 @@ Global | ||||
| 		{9A034977-0FBC-A3C8-8432-9FDD073F215A} = {4CBFE8AF-968B-453D-B763-3D0437C0883D} | ||||
| 		{1C89424B-DA16-8840-4AB0-C446CFBD634C} = {4CBFE8AF-968B-453D-B763-3D0437C0883D} | ||||
| 		{3641CA05-99C5-2245-C663-6CE00730E87C} = {4CBFE8AF-968B-453D-B763-3D0437C0883D} | ||||
| 		{A773C53C-F145-043A-7F55-79ABDB11893B} = {7EFFD2C6-2041-4967-A715-0F817D70C433} | ||||
| 		{2DBCE12E-4A5F-4AB9-82BB-4BDDE48AABBF} = {7EFFD2C6-2041-4967-A715-0F817D70C433} | ||||
| 		{8CA6B487-3AAF-4E77-ACE0-01D878DE4836} = {7EFFD2C6-2041-4967-A715-0F817D70C433} | ||||
| 		{BBB1A129-9ED7-4F08-B710-B6C287197BFB} = {7EFFD2C6-2041-4967-A715-0F817D70C433} | ||||
| 		{ADF28580-F8A0-4495-96D6-736C6C7CF3FF} = {7EFFD2C6-2041-4967-A715-0F817D70C433} | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||
| 		SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} | ||||
|  | ||||
| @ -69,4 +69,8 @@ | ||||
|     <PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="8.3.4" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| </Project> | ||||
|  | ||||
| @ -1,48 +1,31 @@ | ||||
| using KonSoft.Shared.Hosting.AspNetCore; | ||||
| using KonSoft.Shared.Hosting.Microservices; | ||||
| using KonSoft.Shared.Localization.Localization; | ||||
| using Localization.Resources.AbpUi; | ||||
| using Medallion.Threading; | ||||
| using Medallion.Threading.Redis; | ||||
| using Microsoft.AspNetCore.Builder; | ||||
| using Microsoft.AspNetCore.Cors; | ||||
| using Microsoft.AspNetCore.DataProtection; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Hosting; | ||||
| using StackExchange.Redis; | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using Volo.Abp; | ||||
| using Volo.Abp.Account; | ||||
| using Volo.Abp.Account.Localization; | ||||
| using Volo.Abp.Account.Web; | ||||
| using Volo.Abp.AspNetCore.Mvc.UI.Bundling; | ||||
| using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; | ||||
| using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling; | ||||
| using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; | ||||
| using Volo.Abp.AspNetCore.Serilog; | ||||
| using Volo.Abp.Auditing; | ||||
| using Volo.Abp.Autofac; | ||||
| using Volo.Abp.BackgroundJobs; | ||||
| using Volo.Abp.Caching; | ||||
| using Volo.Abp.Caching.StackExchangeRedis; | ||||
| using Volo.Abp.DistributedLocking; | ||||
| using Volo.Abp.Localization; | ||||
| using Volo.Abp.Modularity; | ||||
| using Volo.Abp.OpenIddict; | ||||
| using Volo.Abp.Security.Claims; | ||||
| using Volo.Abp.UI.Navigation.Urls; | ||||
| using Volo.Abp.VirtualFileSystem; | ||||
|  | ||||
| namespace KonSoft; | ||||
|  | ||||
| [DependsOn( | ||||
|     typeof(AbpAutofacModule), | ||||
|     typeof(AbpCachingStackExchangeRedisModule), | ||||
|     typeof(AbpDistributedLockingModule), | ||||
|     typeof(AbpAccountWebOpenIddictModule), | ||||
|     typeof(AbpAccountApplicationModule), | ||||
|     typeof(AbpAccountHttpApiModule), | ||||
|     typeof(AbpAspNetCoreMvcUiBasicThemeModule), | ||||
|     typeof(AbpAspNetCoreSerilogModule) | ||||
|     typeof(KonSoftSharedHostingMicroservicesModule) | ||||
|     )] | ||||
| public class KonSoftAuthServerModule : AbpModule | ||||
| { | ||||
| @ -107,54 +90,11 @@ public class KonSoftAuthServerModule : AbpModule | ||||
|                 options.ApplicationName = "AuthServer"; | ||||
|         }); | ||||
|  | ||||
|         Configure<AppUrlOptions>(options => | ||||
|         { | ||||
|             options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; | ||||
|             options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"]?.Split(',') ?? []); | ||||
|         }); | ||||
|  | ||||
|         Configure<AbpBackgroundJobOptions>(options => | ||||
|         { | ||||
|             options.IsJobExecutionEnabled = false; | ||||
|         }); | ||||
|  | ||||
|         Configure<AbpDistributedCacheOptions>(options => | ||||
|         { | ||||
|             options.KeyPrefix = "KonSoft:"; | ||||
|         }); | ||||
|  | ||||
|         var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("KonSoft"); | ||||
|         if (!hostingEnvironment.IsDevelopment()) | ||||
|         { | ||||
|             var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); | ||||
|             dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "KonSoft-Protection-Keys"); | ||||
|         } | ||||
|  | ||||
|         context.Services.AddSingleton<IDistributedLockProvider>(sp => | ||||
|         { | ||||
|             var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); | ||||
|             return new RedisDistributedSynchronizationProvider(connection.GetDatabase()); | ||||
|         }); | ||||
|  | ||||
|         context.Services.AddCors(options => | ||||
|         { | ||||
|             options.AddDefaultPolicy(builder => | ||||
|             { | ||||
|                 builder | ||||
|                     .WithOrigins( | ||||
|                         configuration["App:CorsOrigins"]? | ||||
|                             .Split(",", StringSplitOptions.RemoveEmptyEntries) | ||||
|                             .Select(o => o.RemovePostFix("/")) | ||||
|                             .ToArray() ?? [] | ||||
|                     ) | ||||
|                     .WithAbpExposedHeaders() | ||||
|                     .SetIsOriginAllowedToAllowWildcardSubdomains() | ||||
|                     .AllowAnyHeader() | ||||
|                     .AllowAnyMethod() | ||||
|                     .AllowCredentials(); | ||||
|             }); | ||||
|         }); | ||||
|  | ||||
|         context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options => | ||||
|         { | ||||
|             options.IsDynamicClaimsEnabled = true; | ||||
| @ -185,7 +125,7 @@ public class KonSoftAuthServerModule : AbpModule | ||||
|         app.UseAuthentication(); | ||||
|         app.UseAbpOpenIddictValidation(); | ||||
|  | ||||
|         if (MultiTenancyConsts.IsEnabled) | ||||
|         if (KonSoftConsts.MultiTenancyEnabled) | ||||
|         { | ||||
|             app.UseMultiTenancy(); | ||||
|         } | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| using Microsoft.Extensions.Localization; | ||||
| using KonSoft.Localization; | ||||
| using Volo.Abp.Ui.Branding; | ||||
| using KonSoft.Shared.Localization.Localization; | ||||
| using Microsoft.Extensions.Localization; | ||||
| using Volo.Abp.DependencyInjection; | ||||
| using Volo.Abp.Ui.Branding; | ||||
|  | ||||
| namespace KonSoft; | ||||
|  | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| @using Microsoft.AspNetCore.Http.Extensions | ||||
| @using Microsoft.AspNetCore.Mvc.Localization | ||||
| @using KonSoft.Pages | ||||
| @using KonSoft.Localization | ||||
| @using KonSoft.Shared.Localization.Localization | ||||
| @using Volo.Abp.Users | ||||
| @using Volo.Abp.AspNetCore.Mvc.UI.Theming | ||||
| @using Volo.Abp.Ui.Branding | ||||
|  | ||||
| @ -1,179 +1,37 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using Medallion.Threading; | ||||
| using Medallion.Threading.Redis; | ||||
| using Microsoft.AspNetCore.Authentication.JwtBearer; | ||||
| using KonSoft.Admin.EntityFrameworkCore; | ||||
| using KonSoft.Shared.Hosting.AspNetCore; | ||||
| using KonSoft.Shared.Hosting.Microservices; | ||||
| using Microsoft.AspNetCore.Builder; | ||||
| using Microsoft.AspNetCore.Cors; | ||||
| using Microsoft.AspNetCore.DataProtection; | ||||
| using Microsoft.AspNetCore.Hosting; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Hosting; | ||||
| using KonSoft.Admin.EntityFrameworkCore; | ||||
| using KonSoft.Admin.MultiTenancy; | ||||
| using StackExchange.Redis; | ||||
| using Microsoft.OpenApi.Models; | ||||
| using Volo.Abp; | ||||
| using Volo.Abp.AspNetCore.Authentication.JwtBearer; | ||||
| using Volo.Abp.AspNetCore.Mvc; | ||||
| using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; | ||||
| using Volo.Abp.AspNetCore.Serilog; | ||||
| using Volo.Abp.Autofac; | ||||
| using Volo.Abp.Caching; | ||||
| using Volo.Abp.Caching.StackExchangeRedis; | ||||
| using Volo.Abp.DistributedLocking; | ||||
| using Volo.Abp.Identity; | ||||
| using Volo.Abp.Localization; | ||||
| using Volo.Abp.BackgroundJobs; | ||||
| using Volo.Abp.Modularity; | ||||
| using Volo.Abp.Security.Claims; | ||||
| using Volo.Abp.Swashbuckle; | ||||
| using Volo.Abp.VirtualFileSystem; | ||||
|  | ||||
| namespace KonSoft.Admin; | ||||
|  | ||||
| [DependsOn( | ||||
|     typeof(AdminHttpApiModule), | ||||
|     typeof(AbpAutofacModule), | ||||
|     typeof(AbpCachingStackExchangeRedisModule), | ||||
|     typeof(AbpDistributedLockingModule), | ||||
|     typeof(AbpAspNetCoreMvcUiMultiTenancyModule), | ||||
|     typeof(AbpAspNetCoreAuthenticationJwtBearerModule), | ||||
|     typeof(AdminApplicationModule), | ||||
|     typeof(AdminEntityFrameworkCoreModule), | ||||
|     typeof(AbpAspNetCoreSerilogModule), | ||||
|     typeof(AbpSwashbuckleModule) | ||||
|     typeof(KonSoftSharedHostingMicroservicesModule) | ||||
| )] | ||||
| public class AdminHttpApiHostModule : AbpModule | ||||
| { | ||||
|     public override void ConfigureServices(ServiceConfigurationContext context) | ||||
|     { | ||||
|         var configuration = context.Services.GetConfiguration(); | ||||
|         var hostingEnvironment = context.Services.GetHostingEnvironment(); | ||||
|  | ||||
|         ConfigureConventionalControllers(); | ||||
|         ConfigureAuthentication(context, configuration); | ||||
|         ConfigureCache(configuration); | ||||
|         ConfigureVirtualFileSystem(context); | ||||
|         ConfigureDataProtection(context, configuration, hostingEnvironment); | ||||
|         ConfigureDistributedLocking(context, configuration); | ||||
|         ConfigureCors(context, configuration); | ||||
|         ConfigureSwaggerServices(context, configuration); | ||||
|     } | ||||
|         SwaggerConfigurationHelper.ConfigureWithOidc( | ||||
|             context: context, | ||||
|             authority: configuration["AuthServer:Authority"]!, | ||||
|             scopes: ["AdministrationService"], | ||||
|             discoveryEndpoint: configuration["AuthServer:MetadataAddress"], | ||||
|             apiTitle: "Administration Service API" | ||||
|         ); | ||||
|  | ||||
|     private void ConfigureCache(IConfiguration configuration) | ||||
|     { | ||||
|         Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Admin:"; }); | ||||
|     } | ||||
|  | ||||
|     private void ConfigureVirtualFileSystem(ServiceConfigurationContext context) | ||||
|     { | ||||
|         var hostingEnvironment = context.Services.GetHostingEnvironment(); | ||||
|  | ||||
|         if (hostingEnvironment.IsDevelopment()) | ||||
|         { | ||||
|             Configure<AbpVirtualFileSystemOptions>(options => | ||||
|             { | ||||
|                 options.FileSets.ReplaceEmbeddedByPhysical<AdminDomainSharedModule>( | ||||
|                     Path.Combine(hostingEnvironment.ContentRootPath, | ||||
|                         $"..{Path.DirectorySeparatorChar}KonSoft.Admin.Domain.Shared")); | ||||
|                 options.FileSets.ReplaceEmbeddedByPhysical<AdminDomainModule>( | ||||
|                     Path.Combine(hostingEnvironment.ContentRootPath, | ||||
|                         $"..{Path.DirectorySeparatorChar}KonSoft.Admin.Domain")); | ||||
|                 options.FileSets.ReplaceEmbeddedByPhysical<AdminApplicationContractsModule>( | ||||
|                     Path.Combine(hostingEnvironment.ContentRootPath, | ||||
|                         $"..{Path.DirectorySeparatorChar}KonSoft.Admin.Application.Contracts")); | ||||
|                 options.FileSets.ReplaceEmbeddedByPhysical<AdminApplicationModule>( | ||||
|                     Path.Combine(hostingEnvironment.ContentRootPath, | ||||
|                         $"..{Path.DirectorySeparatorChar}KonSoft.Admin.Application")); | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void ConfigureConventionalControllers() | ||||
|     { | ||||
|         Configure<AbpAspNetCoreMvcOptions>(options => | ||||
|         { | ||||
|             options.ConventionalControllers.Create(typeof(AdminApplicationModule).Assembly); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) | ||||
|     { | ||||
|         context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) | ||||
|             .AddAbpJwtBearer(options => | ||||
|             { | ||||
|                 options.Authority = configuration["AuthServer:Authority"]; | ||||
|                 options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata"); | ||||
|                 options.Audience = "Admin"; | ||||
|             }); | ||||
|  | ||||
|         context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options => | ||||
|         { | ||||
|             options.IsDynamicClaimsEnabled = true; | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration) | ||||
|     { | ||||
|         context.Services.AddAbpSwaggerGenWithOAuth( | ||||
|             configuration["AuthServer:Authority"]!, | ||||
|             new Dictionary<string, string> | ||||
|             { | ||||
|                     {"Admin", "Admin API"} | ||||
|             }, | ||||
|             options => | ||||
|             { | ||||
|                 options.SwaggerDoc("v1", new OpenApiInfo { Title = "Admin API", Version = "v1" }); | ||||
|                 options.DocInclusionPredicate((docName, description) => true); | ||||
|                 options.CustomSchemaIds(type => type.FullName); | ||||
|             }); | ||||
|     } | ||||
|  | ||||
|     private void ConfigureDataProtection( | ||||
|         ServiceConfigurationContext context, | ||||
|         IConfiguration configuration, | ||||
|         IWebHostEnvironment hostingEnvironment) | ||||
|     { | ||||
|         var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Admin"); | ||||
|         if (!hostingEnvironment.IsDevelopment()) | ||||
|         { | ||||
|             var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); | ||||
|             dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Admin-Protection-Keys"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void ConfigureDistributedLocking( | ||||
|         ServiceConfigurationContext context, | ||||
|         IConfiguration configuration) | ||||
|     { | ||||
|         context.Services.AddSingleton<IDistributedLockProvider>(sp => | ||||
|         { | ||||
|             var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); | ||||
|             return new RedisDistributedSynchronizationProvider(connection.GetDatabase()); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) | ||||
|     { | ||||
|         context.Services.AddCors(options => | ||||
|         { | ||||
|             options.AddDefaultPolicy(builder => | ||||
|             { | ||||
|                 builder | ||||
|                     .WithOrigins(configuration["App:CorsOrigins"]? | ||||
|                         .Split(",", StringSplitOptions.RemoveEmptyEntries) | ||||
|                         .Select(o => o.RemovePostFix("/")) | ||||
|                         .ToArray() ?? []) | ||||
|                     .WithAbpExposedHeaders() | ||||
|                     .SetIsOriginAllowedToAllowWildcardSubdomains() | ||||
|                     .AllowAnyHeader() | ||||
|                     .AllowAnyMethod() | ||||
|                     .AllowCredentials(); | ||||
|             }); | ||||
|         }); | ||||
|         // ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD> | ||||
|         Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false); | ||||
|     } | ||||
|  | ||||
|     public override void OnApplicationInitialization(ApplicationInitializationContext context) | ||||
| @ -193,7 +51,7 @@ public class AdminHttpApiHostModule : AbpModule | ||||
|         app.UseCors(); | ||||
|         app.UseAuthentication(); | ||||
|  | ||||
|         if (MultiTenancyConsts.IsEnabled) | ||||
|         if (KonSoftConsts.MultiTenancyEnabled) | ||||
|         { | ||||
|             app.UseMultiTenancy(); | ||||
|         } | ||||
|  | ||||
| @ -10,22 +10,6 @@ | ||||
|     <DockerfileContext>..\..</DockerfileContext> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" /> | ||||
|     <PackageReference Include="Serilog.AspNetCore" Version="8.0.0" /> | ||||
|     <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> | ||||
|     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" /> | ||||
|     <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" /> | ||||
|     <PackageReference Include="DistributedLock.Redis" Version="1.0.2" /> | ||||
|     <PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" /> | ||||
|     <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="8.3.4" /> | ||||
|     <PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" /> | ||||
|     <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" /> | ||||
|     <PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" /> | ||||
|     <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" /> | ||||
|     <PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <Compile Remove="Logs\**" /> | ||||
|     <Content Remove="Logs\**" /> | ||||
| @ -37,6 +21,7 @@ | ||||
|     <ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" /> | ||||
|     <ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" /> | ||||
|     <ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.HttpApi\KonSoft.Admin.HttpApi.csproj" /> | ||||
|     <ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| </Project> | ||||
|  | ||||
							
								
								
									
										1027
									
								
								microservices/KonSoft.Admin.HttpApi.Host/Logs/logs.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1027
									
								
								microservices/KonSoft.Admin.HttpApi.Host/Logs/logs.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,56 +1,28 @@ | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using KonSoft.Admin; | ||||
| using KonSoft.Shared.Hosting.AspNetCore; | ||||
| using Microsoft.AspNetCore.Builder; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Hosting; | ||||
| using Serilog; | ||||
| using Serilog.Events; | ||||
| using System; | ||||
|  | ||||
| namespace KonSoft.Admin; | ||||
| var assemblyName = typeof(Program).Assembly.GetName().Name!; | ||||
|  | ||||
| public class Program | ||||
| SerilogConfigurationHelper.Configure(assemblyName); | ||||
| try | ||||
| { | ||||
|     public async static Task<int> Main(string[] args) | ||||
|     { | ||||
|         Log.Logger = new LoggerConfiguration() | ||||
| #if DEBUG | ||||
|             .MinimumLevel.Debug() | ||||
| #else | ||||
|             .MinimumLevel.Information() | ||||
| #endif | ||||
|             .MinimumLevel.Override("Microsoft", LogEventLevel.Information) | ||||
|             .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) | ||||
|             .Enrich.FromLogContext() | ||||
|             .WriteTo.Async(c => c.File("Logs/logs.txt")) | ||||
|             .WriteTo.Async(c => c.Console()) | ||||
|             .CreateLogger(); | ||||
|     Log.Information($"Starting {assemblyName}."); | ||||
|     var app = await ApplicationBuilderHelper | ||||
|         .BuildApplicationAsync<AdminHttpApiHostModule>(args); | ||||
|     await app.InitializeApplicationAsync(); | ||||
|     await app.RunAsync(); | ||||
|  | ||||
|         try | ||||
|         { | ||||
|             Log.Information("Starting KonSoft.Admin.HttpApi.Host."); | ||||
|             var builder = WebApplication.CreateBuilder(args); | ||||
|             builder.Host.AddAppSettingsSecretsJson() | ||||
|                 .UseAutofac() | ||||
|                 .UseSerilog(); | ||||
|             await builder.AddApplicationAsync<AdminHttpApiHostModule>(); | ||||
|             var app = builder.Build(); | ||||
|             await app.InitializeApplicationAsync(); | ||||
|             await app.RunAsync(); | ||||
|             return 0; | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             if (ex is HostAbortedException) | ||||
|             { | ||||
|                 throw; | ||||
|             } | ||||
|  | ||||
|             Log.Fatal(ex, "Host terminated unexpectedly!"); | ||||
|             return 1; | ||||
|         } | ||||
|         finally | ||||
|         { | ||||
|             Log.CloseAndFlush(); | ||||
|         } | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| catch (Exception ex) | ||||
| { | ||||
|     Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!"); | ||||
|     return 1; | ||||
| } | ||||
| finally | ||||
| { | ||||
|     await Log.CloseAndFlushAsync(); | ||||
| } | ||||
| @ -1,12 +1,5 @@ | ||||
| { | ||||
|   "profiles": { | ||||
|     "IIS Express": { | ||||
|       "commandName": "IISExpress", | ||||
|       "launchBrowser": true, | ||||
|       "environmentVariables": { | ||||
|         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|       } | ||||
|     }, | ||||
|     "KonSoft.Admin.HttpApi.Host": { | ||||
|       "commandName": "Project", | ||||
|       "launchBrowser": true, | ||||
| @ -26,13 +19,5 @@ | ||||
|       "publishAllPorts": true, | ||||
|       "useSSL": true | ||||
|     } | ||||
|   }, | ||||
|   "iisSettings": { | ||||
|     "windowsAuthentication": false, | ||||
|     "anonymousAuthentication": true, | ||||
|     "iisExpress": { | ||||
|       "applicationUrl": "https://localhost:44354", | ||||
|       "sslPort": 44354 | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,12 +1,12 @@ | ||||
| { | ||||
|   "App": { | ||||
|     "CorsOrigins": "https://*.Admin.com,https://localhost:44357" | ||||
|     "CorsOrigins": "https://*.KonSoft.top" | ||||
|   }, | ||||
|   "ConnectionStrings": { | ||||
|     "Default": "Host=localhost;Port=5432;Database=Admin;User ID=root;Password=myPassword;" | ||||
|     "Default": "Host=1.94.99.47;Port=26666;Database=Clean;User ID=postgres;Password=zzx7845zzx;" | ||||
|   }, | ||||
|   "Redis": { | ||||
|     "Configuration": "127.0.0.1" | ||||
|     "Configuration": "1.94.99.47:26668" | ||||
|   }, | ||||
|   "AuthServer": { | ||||
|     "Authority": "https://localhost:44397", | ||||
| @ -15,5 +15,15 @@ | ||||
|   }, | ||||
|   "StringEncryption": { | ||||
|     "DefaultPassPhrase": "g3NdNOyDR9oYj0gK" | ||||
|   }, | ||||
|   "RabbitMQ": { | ||||
|     "Connections": { | ||||
|       "Default": { | ||||
|         "HostName": "1.94.99.47", | ||||
|         "Port": 26667, | ||||
|         "UserName": "admin", | ||||
|         "Password": "zzx7845zzx" | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -1,10 +0,0 @@ | ||||
| namespace KonSoft.Admin.MultiTenancy; | ||||
|  | ||||
| public static class MultiTenancyConsts | ||||
| { | ||||
|     /* Enable/disable multi-tenancy easily in a single point. | ||||
|      * If you will never need to multi-tenancy, you can remove | ||||
|      * related modules and code parts, including this file. | ||||
|      */ | ||||
|     public const bool IsEnabled = true; | ||||
| } | ||||
| @ -1,6 +1,5 @@ | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.DependencyInjection.Extensions; | ||||
| using KonSoft.Admin.MultiTenancy; | ||||
| using Volo.Abp.AuditLogging; | ||||
| using Volo.Abp.BackgroundJobs; | ||||
| using Volo.Abp.Emailing; | ||||
| @ -56,10 +55,6 @@ public class AdminDomainModule : AbpModule | ||||
|             options.Languages.Add(new LanguageInfo("es", "es", "Español")); | ||||
|         }); | ||||
|  | ||||
|         Configure<AbpMultiTenancyOptions>(options => | ||||
|         { | ||||
|             options.IsEnabled = MultiTenancyConsts.IsEnabled; | ||||
|         }); | ||||
|  | ||||
| #if DEBUG | ||||
|         context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>()); | ||||
|  | ||||
| @ -0,0 +1,27 @@ | ||||
| using System; | ||||
| using Microsoft.AspNetCore.Builder; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Swashbuckle.AspNetCore.SwaggerUI; | ||||
| using Volo.Abp.Swashbuckle; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore; | ||||
|  | ||||
| public static class AbpSwaggerUIBuilderExtensions | ||||
| { | ||||
|     public static IApplicationBuilder UseAbpSwaggerWithCustomScriptUI( | ||||
|         this IApplicationBuilder app, | ||||
|         Action<SwaggerUIOptions>? setupAction = null) | ||||
|     { | ||||
|         var resolver = app.ApplicationServices.GetService<ISwaggerHtmlResolver>(); | ||||
|  | ||||
|         return app.UseSwaggerUI(options => | ||||
|         { | ||||
|             options.InjectJavascript("ui/abp.js"); | ||||
|             options.InjectJavascript("ui/abp.swagger.js"); | ||||
|             options.InjectJavascript("ui/requestinterceptor.js"); | ||||
|             options.IndexStream = () => resolver?.Resolver(); | ||||
|  | ||||
|             setupAction?.Invoke(options); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,24 @@ | ||||
| using System.Threading.Tasks; | ||||
| using Microsoft.AspNetCore.Builder; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Hosting; | ||||
| using Serilog; | ||||
| using Volo.Abp.Modularity; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore; | ||||
|  | ||||
| public static class ApplicationBuilderHelper | ||||
| { | ||||
|     public static async Task<WebApplication> BuildApplicationAsync<TStartupModule>(string[] args) | ||||
|         where TStartupModule : IAbpModule | ||||
|     { | ||||
|         var builder = WebApplication.CreateBuilder(args); | ||||
|         builder.Host | ||||
|             .AddAppSettingsSecretsJson() | ||||
|             .UseAutofac() | ||||
|             .UseSerilog(); | ||||
|  | ||||
|         await builder.AddApplicationAsync<TStartupModule>(); | ||||
|         return builder.Build(); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,36 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>net8.0</TargetFramework> | ||||
| 		<RootNamespace>KonSoft.Shared.Hosting.AspNetCore</RootNamespace> | ||||
| 	  <Nullable>enable</Nullable> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\KonSoft.Shared.Hosting\KonSoft.Shared.Hosting.csproj" /> | ||||
|     <ProjectReference Include="..\KonSoft.Shared.Localization\KonSoft.Shared.Localization.csproj" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" /> | ||||
| 		<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.4" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<None Remove="wwwroot\swagger\ui\requestinterceptor.js" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<Content Include="wwwroot\swagger\ui\requestinterceptor.js"> | ||||
| 			<ExcludeFromSingleFile>true</ExcludeFromSingleFile> | ||||
| 			<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||||
| 		</Content> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<EmbeddedResource Include="wwwroot\swagger\ui\requestinterceptor.js" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| </Project> | ||||
| @ -0,0 +1,11 @@ | ||||
| using Volo.Abp.DependencyInjection; | ||||
| using Volo.Abp.Ui.Branding; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore | ||||
| { | ||||
|     [Dependency(ReplaceServices = true)] | ||||
|     public class KonSoftBrandingProvider : DefaultBrandingProvider | ||||
|     { | ||||
|         public override string AppName => "KonSoft"; | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,8 @@ | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore; | ||||
|  | ||||
| public static class KonSoftConsts | ||||
| { | ||||
|     public const string AuthServerAudience = "KonSoft"; | ||||
|     public const string AnonymousUserClaimName = "anonymous_id"; | ||||
|     public const bool MultiTenancyEnabled = true; | ||||
| } | ||||
| @ -0,0 +1,32 @@ | ||||
| using KonSoft.Shared.Localization; | ||||
| using Volo.Abp.AspNetCore.Serilog; | ||||
| using Volo.Abp.Modularity; | ||||
| using Volo.Abp.MultiTenancy; | ||||
| using Volo.Abp.Swashbuckle; | ||||
| using Volo.Abp.VirtualFileSystem; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore | ||||
| { | ||||
|     [DependsOn( | ||||
|         typeof(KonSoftSharedLocalizationModule), | ||||
|         typeof(KonSoftSharedHostingModule), | ||||
|         typeof(AbpAspNetCoreSerilogModule), | ||||
|         typeof(AbpSwashbuckleModule), | ||||
|         typeof(AbpMultiTenancyModule) | ||||
|     )] | ||||
|     public class KonSoftSharedHostingAspNetCoreModule : AbpModule | ||||
|     { | ||||
|         public override void ConfigureServices(ServiceConfigurationContext context) | ||||
|         { | ||||
|             Configure<AbpVirtualFileSystemOptions>(options => | ||||
|             { | ||||
|                 options.FileSets.AddEmbedded<KonSoftSharedHostingAspNetCoreModule>("KonSoft.Shared.Hosting.AspNetCore"); | ||||
|             }); | ||||
|  | ||||
|             Configure<AbpMultiTenancyOptions>(options => | ||||
|             { | ||||
|                 options.IsEnabled = KonSoftConsts.MultiTenancyEnabled; | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,24 @@ | ||||
| using Serilog; | ||||
| using Serilog.Events; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore; | ||||
|  | ||||
| public static class SerilogConfigurationHelper | ||||
| { | ||||
|     public static void Configure(string applicationName) | ||||
|     { | ||||
|         Log.Logger = new LoggerConfiguration() | ||||
| #if DEBUG | ||||
|             .MinimumLevel.Debug() | ||||
| #else | ||||
|                 .MinimumLevel.Information() | ||||
| #endif | ||||
|             .MinimumLevel.Override("Microsoft", LogEventLevel.Information) | ||||
|             .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) | ||||
|             .Enrich.FromLogContext() | ||||
|             .Enrich.WithProperty("Application", $"{applicationName}") | ||||
|             .WriteTo.Async(c => c.File("Logs/logs.txt")) | ||||
|             .WriteTo.Async(c => c.Console()) | ||||
|             .CreateLogger(); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,32 @@ | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.OpenApi.Models; | ||||
| using Volo.Abp.Modularity; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.AspNetCore; | ||||
|  | ||||
| public static class SwaggerConfigurationHelper | ||||
| { | ||||
|     public static void ConfigureWithOidc( | ||||
|         ServiceConfigurationContext context, | ||||
|         string authority, | ||||
|         string[] scopes, | ||||
|         string apiTitle, | ||||
|         string apiVersion = "v1", | ||||
|         string apiName = "v1", | ||||
|         string[]? flows = null, | ||||
|         string? discoveryEndpoint = null | ||||
|     ) | ||||
|     { | ||||
|         context.Services.AddAbpSwaggerGenWithOidc( | ||||
|             authority: authority, | ||||
|             scopes: scopes, | ||||
|             flows: flows, | ||||
|             discoveryEndpoint: discoveryEndpoint, | ||||
|             options => | ||||
|             { | ||||
|                 options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion }); | ||||
|                 options.DocInclusionPredicate((docName, description) => true); | ||||
|                 options.CustomSchemaIds(type => type.FullName); | ||||
|             }); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,9 @@ | ||||
| const originalFetch = window.fetch; | ||||
|  | ||||
| window.fetch = function (input, init) { | ||||
|     if (init !== undefined && init.headers['RequestVerificationToken'] !== undefined) { | ||||
|         delete init.headers['RequestVerificationToken']; | ||||
|     } | ||||
|  | ||||
|     return originalFetch.apply(this, arguments); | ||||
| }; | ||||
							
								
								
									
										7
									
								
								shared/KonSoft.Shared.Hosting.Gateways/Class1.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								shared/KonSoft.Shared.Hosting.Gateways/Class1.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| namespace KonSoft.Shared.Hosting.Gateways | ||||
| { | ||||
|     public class Class1 | ||||
|     { | ||||
|  | ||||
|     } | ||||
| } | ||||
| @ -2,8 +2,8 @@ | ||||
| 
 | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>net8.0</TargetFramework> | ||||
|     <ImplicitUsings>enable</ImplicitUsings> | ||||
|     <Nullable>enable</Nullable> | ||||
| 		<RootNamespace>KonSoft.Shared.Hosting.Gateways</RootNamespace> | ||||
| 	  <Nullable>enable</Nullable> | ||||
|   </PropertyGroup> | ||||
| 
 | ||||
| </Project> | ||||
| @ -0,0 +1,27 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>net8.0</TargetFramework> | ||||
| 		<RootNamespace>KonSoft.Shared.Hosting.Microservices</RootNamespace> | ||||
| 	  <Nullable>enable</Nullable> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\KonSoft.Shared.Hosting.AspNetCore\KonSoft.Shared.Hosting.AspNetCore.csproj" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.20" /> | ||||
| 		<PackageReference Include="DistributedLock.Redis" Version="1.1.0" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.BackgroundJobs.RabbitMQ" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.DistributedLocking" Version="8.3.4" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| </Project> | ||||
| @ -0,0 +1,100 @@ | ||||
| using KonSoft.Shared.Hosting.AspNetCore; | ||||
| using Medallion.Threading; | ||||
| using Medallion.Threading.Redis; | ||||
| using Microsoft.AspNetCore.Authentication.JwtBearer; | ||||
| using Microsoft.AspNetCore.DataProtection; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using StackExchange.Redis; | ||||
| using System; | ||||
| using System.Linq; | ||||
| using Microsoft.AspNetCore.Cors; | ||||
| using Volo.Abp.AspNetCore.Authentication.JwtBearer; | ||||
| using Volo.Abp.BackgroundJobs.RabbitMQ; | ||||
| using Volo.Abp.Caching; | ||||
| using Volo.Abp.Caching.StackExchangeRedis; | ||||
| using Volo.Abp.DistributedLocking; | ||||
| using Volo.Abp.EntityFrameworkCore; | ||||
| using Volo.Abp.EventBus.RabbitMq; | ||||
| using Volo.Abp.Modularity; | ||||
| using Volo.Abp.Security.Claims; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting.Microservices | ||||
| { | ||||
|     [DependsOn( | ||||
|         typeof(KonSoftSharedHostingAspNetCoreModule), | ||||
|         typeof(AbpBackgroundJobsRabbitMqModule), | ||||
|         typeof(AbpAspNetCoreAuthenticationJwtBearerModule), | ||||
|         typeof(AbpEventBusRabbitMqModule), | ||||
|         typeof(AbpCachingStackExchangeRedisModule), | ||||
|         typeof(AbpDistributedLockingModule), | ||||
|         typeof(AbpEntityFrameworkCoreModule) | ||||
|     )] | ||||
|     public class KonSoftSharedHostingMicroservicesModule : AbpModule | ||||
|     { | ||||
|         public override void ConfigureServices(ServiceConfigurationContext context) | ||||
|         { | ||||
|             var configuration = context.Services.GetConfiguration(); | ||||
|             var hostingEnvironment = context.Services.GetHostingEnvironment(); | ||||
|  | ||||
|             ConfigureCache(); | ||||
|             ConfigureDataProtection(context, configuration); | ||||
|             ConfigureAuthentication(context, configuration); | ||||
|             ConfigureCors(context, configuration); | ||||
|         } | ||||
|  | ||||
|         private void ConfigureCache() | ||||
|         { | ||||
|             Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "KonSoft:"; }); | ||||
|         } | ||||
|  | ||||
|         private void ConfigureDataProtection( | ||||
|             ServiceConfigurationContext context, | ||||
|             IConfiguration configuration) | ||||
|         { | ||||
|             context.Services.AddDataProtection().SetApplicationName("KonSoft") | ||||
|                 .PersistKeysToStackExchangeRedis(ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!), | ||||
|                     "KonSoft-Protection-Keys"); | ||||
|  | ||||
|             context.Services.AddSingleton<IDistributedLockProvider>(_ => | ||||
|                 new RedisDistributedSynchronizationProvider(ConnectionMultiplexer | ||||
|                     .Connect(configuration["Redis:Configuration"]!).GetDatabase())); | ||||
|         } | ||||
|  | ||||
|         private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) | ||||
|         { | ||||
|             context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) | ||||
|                 .AddAbpJwtBearer(options => | ||||
|                 { | ||||
|                     options.Authority = configuration["AuthServer:Authority"]; | ||||
|                     options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata"); | ||||
|                     options.Audience = KonSoftConsts.AuthServerAudience; | ||||
|                 }); | ||||
|  | ||||
|             context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options => | ||||
|             { | ||||
|                 options.IsDynamicClaimsEnabled = true; | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) | ||||
|         { | ||||
|             context.Services.AddCors(options => | ||||
|             { | ||||
|                 options.AddDefaultPolicy(builder => | ||||
|                 { | ||||
|                     builder | ||||
|                         .WithOrigins(configuration["App:CorsOrigins"]? | ||||
|                             .Split(",", StringSplitOptions.RemoveEmptyEntries) | ||||
|                             .Select(o => o.RemovePostFix("/")) | ||||
|                             .ToArray() ?? []) | ||||
|                         .WithAbpExposedHeaders() | ||||
|                         .SetIsOriginAllowedToAllowWildcardSubdomains() | ||||
|                         .AllowAnyHeader() | ||||
|                         .AllowAnyMethod() | ||||
|                         .AllowCredentials(); | ||||
|                 }); | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										21
									
								
								shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
| 	<PropertyGroup> | ||||
| 		<TargetFramework>net8.0</TargetFramework> | ||||
| 		<RootNamespace>KonSoft.Shared.Hosting</RootNamespace> | ||||
| 		<Nullable>enable</Nullable> | ||||
| 	</PropertyGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" /> | ||||
| 		<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> | ||||
| 		<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> | ||||
| 		<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.Data" Version="8.3.4" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| </Project> | ||||
							
								
								
									
										21
									
								
								shared/KonSoft.Shared.Hosting/KonSoftSharedHostingModule.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								shared/KonSoft.Shared.Hosting/KonSoftSharedHostingModule.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| using Volo.Abp.Autofac; | ||||
| using Volo.Abp.Data; | ||||
| using Volo.Abp.Modularity; | ||||
|  | ||||
| namespace KonSoft.Shared.Hosting | ||||
| { | ||||
|     [DependsOn( | ||||
|         typeof(AbpAutofacModule), | ||||
|         typeof(AbpDataModule) | ||||
|     )] | ||||
|     public class KonSoftSharedHostingModule : AbpModule | ||||
|     { | ||||
|         public override void ConfigureServices(ServiceConfigurationContext context) | ||||
|         { | ||||
|             Configure<AbpDbConnectionOptions>(options => | ||||
|             { | ||||
|                 // TODO Mapping DbConnections | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,24 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>net8.0</TargetFramework> | ||||
| 		<RootNamespace>KonSoft.Shared.Localization</RootNamespace> | ||||
| 	  <Nullable>enable</Nullable> | ||||
|   </PropertyGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.4" /> | ||||
| 		<PackageReference Include="Volo.Abp.Validation" Version="8.3.4" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<EmbeddedResource Include="Localization\EShopOnAbp\*.json" /> | ||||
| 		<Content Remove="Localization\EShopOnAbp\*.json" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 	  <EmbeddedResource Include="Localization\KonSoft\en.json" /> | ||||
| 	  <EmbeddedResource Include="Localization\KonSoft\zh-Hans.json" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| </Project> | ||||
| @ -0,0 +1,35 @@ | ||||
| using KonSoft.Shared.Localization.Localization; | ||||
| using Volo.Abp.Localization; | ||||
| using Volo.Abp.Modularity; | ||||
| using Volo.Abp.Validation; | ||||
| using Volo.Abp.Validation.Localization; | ||||
| using Volo.Abp.VirtualFileSystem; | ||||
|  | ||||
| namespace KonSoft.Shared.Localization | ||||
| { | ||||
|  | ||||
|     [DependsOn( | ||||
|         typeof(AbpValidationModule) | ||||
|     )] | ||||
|     public class KonSoftSharedLocalizationModule : AbpModule | ||||
|     { | ||||
|         public override void ConfigureServices(ServiceConfigurationContext context) | ||||
|         { | ||||
|             Configure<AbpVirtualFileSystemOptions>(options => | ||||
|             { | ||||
|                 options.FileSets.AddEmbedded<KonSoftSharedLocalizationModule>(); | ||||
|             }); | ||||
|  | ||||
|             Configure<AbpLocalizationOptions>(options => | ||||
|             { | ||||
|                 options.Resources | ||||
|                     .Add<KonSoftResource>("en") | ||||
|                     .AddBaseTypes( | ||||
|                         typeof(AbpValidationResource) | ||||
|                     ).AddVirtualJson("/Localization/KonSoft"); | ||||
|  | ||||
|                 options.DefaultResourceType = typeof(KonSoftResource); | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,9 @@ | ||||
| { | ||||
|   "culture": "en", | ||||
|   "texts": { | ||||
|     "AppName": "Admin", | ||||
|     "Menu:Home": "Home", | ||||
|     "Welcome": "Welcome", | ||||
|     "LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io." | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,9 @@ | ||||
| { | ||||
|   "culture": "zh-Hans", | ||||
|   "texts": { | ||||
|     "AppName": "Admin", | ||||
|     "Menu:Home": "首页", | ||||
|     "Welcome": "欢迎", | ||||
|     "LongWelcomeMessage": "欢迎使用本应用程序。这是一个基于 ABP 框架的启动项目。更多信息,请访问 abp.io。" | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,9 @@ | ||||
| using Volo.Abp.Localization; | ||||
|  | ||||
| namespace KonSoft.Shared.Localization.Localization | ||||
| { | ||||
|     [LocalizationResourceName("KonSoft")] | ||||
|     public class KonSoftResource | ||||
|     { | ||||
|     } | ||||
| } | ||||
| @ -1,7 +0,0 @@ | ||||
| namespace KonSoft.Shared | ||||
| { | ||||
|     public class Class1 | ||||
|     { | ||||
|  | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user