Compare commits
	
		
			15 Commits
		
	
	
		
			e4629b1771
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ea3a825825 | |||
| 90f0040f63 | |||
| d4e54f5709 | |||
| 8d9e7658d7 | |||
| d340be4e2c | |||
| 4afd7924b7 | |||
| 30e5e6a4dc | |||
| df78f842f3 | |||
| 5138daebea | |||
| bbead3a651 | |||
| 802624e7ea | |||
| b2bccc34f5 | |||
| f060641e97 | |||
| e7aaacc410 | |||
| 75cd096b60 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -265,3 +265,4 @@ src/KonSoft.Admin.Blazor.Server.Tiered/Logs/* | |||||||
| **/wwwroot/libs/* | **/wwwroot/libs/* | ||||||
|  |  | ||||||
| **/Logs/* | **/Logs/* | ||||||
|  | **/logs.txt | ||||||
| @ -26,6 +26,7 @@ using Volo.Abp.Localization; | |||||||
| using Volo.Abp.Modularity; | using Volo.Abp.Modularity; | ||||||
| using Volo.Abp.OpenIddict; | using Volo.Abp.OpenIddict; | ||||||
| using Volo.Abp.Security.Claims; | using Volo.Abp.Security.Claims; | ||||||
|  | using Volo.Abp.UI.Navigation.Urls; | ||||||
| using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork; | using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork; | ||||||
|  |  | ||||||
| namespace KonSoft; | namespace KonSoft; | ||||||
| @ -50,15 +51,20 @@ public class KonSoftAuthServerModule : AbpModule | |||||||
|         { |         { | ||||||
|             builder.AddValidation(options => |             builder.AddValidation(options => | ||||||
|             { |             { | ||||||
|                 options.AddAudiences("KonSoft"); |                 options.AddAudiences(KonSoftConsts.AuthServerAudience); | ||||||
|                 options.UseLocalServer(); |                 options.UseLocalServer(); | ||||||
|                 options.UseAspNetCore(); |                 options.UseAspNetCore(); | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         context.Services.Configure<ForwardedHeadersOptions>(options => |         PreConfigure<ForwardedHeadersOptions>(options => | ||||||
|         { |         { | ||||||
|             options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; |             options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | | ||||||
|  |                                        ForwardedHeaders.XForwardedProto | | ||||||
|  |                                        ForwardedHeaders.XForwardedHost; | ||||||
|  |  | ||||||
|  |             options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("::ffff:127.0.0.1"), 104)); | ||||||
|  |             options.KnownProxies.Add(IPAddress.Parse("::ffff:127.0.0.1")); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         if (!hostingEnvironment.IsDevelopment()) |         if (!hostingEnvironment.IsDevelopment()) | ||||||
| @ -105,6 +111,16 @@ public class KonSoftAuthServerModule : AbpModule | |||||||
|             options.ApplicationName = "AuthServer"; |             options.ApplicationName = "AuthServer"; | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  |         Configure<AppUrlOptions>(options => | ||||||
|  |         { | ||||||
|  |             options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; | ||||||
|  |             options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"]?.Split(',') ?? | ||||||
|  |                                                  Array.Empty<string>()); | ||||||
|  |  | ||||||
|  |             options.Applications["Angular"].RootUrl = configuration["App:ClientUrl"]; | ||||||
|  |             options.Applications["Angular"].Urls[AccountUrlNames.PasswordReset] = "account/reset-password"; | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; }); |         Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; }); | ||||||
|  |  | ||||||
|         context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options => |         context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options => | ||||||
| @ -137,17 +153,16 @@ public class KonSoftAuthServerModule : AbpModule | |||||||
|         var app = context.GetApplicationBuilder(); |         var app = context.GetApplicationBuilder(); | ||||||
|         var env = context.GetEnvironment(); |         var env = context.GetEnvironment(); | ||||||
|  |  | ||||||
|         if (env.IsDevelopment()) |         app.UseForwardedHeaders(); | ||||||
|  |         app.Use(async (ctx, next) => | ||||||
|         { |         { | ||||||
|             app.UseDeveloperExceptionPage(); |             ctx.Request.Scheme = "https"; | ||||||
|             app.UseForwardedHeaders(); |             await next(); | ||||||
|         } |         }); | ||||||
|         else |  | ||||||
|         { |         app.UseDeveloperExceptionPage(); | ||||||
|             app.UseErrorPage(); |         app.UseAbpRequestLocalization(); | ||||||
|             app.UseForwardedHeaders(); |         app.UseErrorPage(); | ||||||
|             app.UseHsts(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         app.UseAbpRequestLocalization(); |         app.UseAbpRequestLocalization(); | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| using Yarp.ReverseProxy.Configuration; | using Microsoft.AspNetCore.Builder; | ||||||
|  | using Yarp.ReverseProxy.Configuration; | ||||||
| namespace KonSoft.InternalGateway.Extensions | namespace KonSoft.InternalGateway.Extensions | ||||||
| { | { | ||||||
|     public static class YarpSwaggerUIBuilderExtensions |     public static class YarpSwaggerUIBuilderExtensions | ||||||
| @ -24,7 +25,10 @@ namespace KonSoft.InternalGateway.Extensions | |||||||
|                     .Select(t => t.First()) |                     .Select(t => t.First()) | ||||||
|                     .Distinct() |                     .Distinct() | ||||||
|                     .ToList(); |                     .ToList(); | ||||||
|  |                 var gatewayUrl = configuration["GatewayUrl"]; | ||||||
|  |  | ||||||
|  |                 options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); | ||||||
|  |                 options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); | ||||||
|                 foreach (var clusterGroup in groupedClusters) |                 foreach (var clusterGroup in groupedClusters) | ||||||
|                 { |                 { | ||||||
|                     var routeConfig = yarpConfig.Routes.FirstOrDefault(q => |                     var routeConfig = yarpConfig.Routes.FirstOrDefault(q => | ||||||
| @ -35,9 +39,8 @@ namespace KonSoft.InternalGateway.Extensions | |||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
|                      |                      | ||||||
|                     options.SwaggerEndpoint($"{clusterGroup.Value.Address}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API"); |                    // options.SwaggerEndpoint($"{clusterGroup.Value.Address}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API"); | ||||||
|                     options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); |                     options.SwaggerEndpoint(new Uri(new Uri(!string.IsNullOrWhiteSpace(gatewayUrl)? gatewayUrl: clusterGroup.Value.Address), $"{routeConfig.RouteId.Split("-")[0]}/swagger/v1/swagger.json").AbsoluteUri, $"{routeConfig.RouteId} API"); | ||||||
|                     options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); |  | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,6 +1,9 @@ | |||||||
| using KonSoft.InternalGateway; | using KonSoft.InternalGateway; | ||||||
| using KonSoft.InternalGateway.Extensions; | using KonSoft.InternalGateway.Extensions; | ||||||
| using KonSoft.Shared.Hosting.AspNetCore; | using KonSoft.Shared.Hosting.AspNetCore; | ||||||
|  | using Microsoft.AspNetCore.Rewrite; | ||||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||||
|  | using Microsoft.OpenApi.Models; | ||||||
| using Serilog; | using Serilog; | ||||||
|  |  | ||||||
| var assemblyName = typeof(Program).Assembly.GetName().Name!; | var assemblyName = typeof(Program).Assembly.GetName().Name!; | ||||||
| @ -18,14 +21,28 @@ try | |||||||
|         .AddAppSettingsSecretsJson() |         .AddAppSettingsSecretsJson() | ||||||
|         .UseAutofac() |         .UseAutofac() | ||||||
|         .UseSerilog(); |         .UseSerilog(); | ||||||
|  |  | ||||||
|  |     builder.Services.AddAbpSwaggerGenWithOidc(builder.Configuration["AuthServer:Authority"]!, setupAction: options => | ||||||
|  |     { | ||||||
|  |         options.SwaggerDoc("v1", new OpenApiInfo | ||||||
|  |         { | ||||||
|  |             Title = "Gateway", | ||||||
|  |             Version = "v1" | ||||||
|  |         }); | ||||||
|  |         options.DocInclusionPredicate((docName, description) => true); | ||||||
|  |         options.CustomSchemaIds(type => type.FullName); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |  | ||||||
|     builder.Services.AddReverseProxy() |     builder.Services.AddReverseProxy() | ||||||
|         .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); |         .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); | ||||||
|  |     builder.Services.AddControllers(); | ||||||
|     await builder.AddApplicationAsync<InternalGatewayModule>(); |     await builder.AddApplicationAsync<InternalGatewayModule>(); | ||||||
|     var app = builder.Build(); |     var app = builder.Build(); | ||||||
|     await app.InitializeApplicationAsync(); |     await app.InitializeApplicationAsync(); | ||||||
|  |     app.UseSwaggerUIWithYarp(); | ||||||
|     app.MapReverseProxy(); |     app.MapReverseProxy(); | ||||||
|     app.MapGet("/heath", () => "Online"); |     app.MapGet("/heath", () => "Online"); | ||||||
|     app.UseSwaggerUIWithYarp(); |  | ||||||
|     await app.RunAsync(); |     await app.RunAsync(); | ||||||
|  |  | ||||||
|     return 0; |     return 0; | ||||||
|  | |||||||
| @ -4,5 +4,10 @@ | |||||||
|     "name": "KonSoft.InternalGateway", |     "name": "KonSoft.InternalGateway", | ||||||
|     "nodes": "https://config.konsoft.top/", |     "nodes": "https://config.konsoft.top/", | ||||||
|     "secret": "DBE31703-14F9-4B01-893D-900B8380CE04" |     "secret": "DBE31703-14F9-4B01-893D-900B8380CE04" | ||||||
|  |   }, | ||||||
|  |   "AuthServer": { | ||||||
|  |     "Authority": "https://devauth.konsoft.top", | ||||||
|  |     "RequireHttpsMetadata": true, | ||||||
|  |     "SwaggerClientId": "Gateway_Swagger" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ public class AdminHttpApiHostModule : AbpModule | |||||||
|         SwaggerConfigurationHelper.ConfigureWithOidc( |         SwaggerConfigurationHelper.ConfigureWithOidc( | ||||||
|             context, |             context, | ||||||
|             configuration["AuthServer:Authority"]!, |             configuration["AuthServer:Authority"]!, | ||||||
|             ["AdministrationService"], |             ["Admin", "Dispatch", "Payment", "Report", "TenantManagement"], | ||||||
|             discoveryEndpoint: configuration["AuthServer:MetadataAddress"], |             discoveryEndpoint: configuration["AuthServer:MetadataAddress"], | ||||||
|             apiTitle: "Administration Service API" |             apiTitle: "Administration Service API" | ||||||
|         ); |         ); | ||||||
|  | |||||||
| @ -6,18 +6,7 @@ | |||||||
|       "environmentVariables": { |       "environmentVariables": { | ||||||
|         "ASPNETCORE_ENVIRONMENT": "Development" |         "ASPNETCORE_ENVIRONMENT": "Development" | ||||||
|       }, |       }, | ||||||
|       "applicationUrl": "https://localhost:44354" |       "applicationUrl": "http://localhost:44354" | ||||||
|     }, |  | ||||||
|     "Container (Dockerfile)": { |  | ||||||
|       "commandName": "Docker", |  | ||||||
|       "launchBrowser": true, |  | ||||||
|       "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", |  | ||||||
|       "environmentVariables": { |  | ||||||
|         "ASPNETCORE_HTTPS_PORTS": "8081", |  | ||||||
|         "ASPNETCORE_HTTP_PORTS": "8080" |  | ||||||
|       }, |  | ||||||
|       "publishAllPorts": true, |  | ||||||
|       "useSSL": true |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "$schema": "http://json.schemastore.org/launchsettings.json" |   "$schema": "http://json.schemastore.org/launchsettings.json" | ||||||
|  | |||||||
| @ -6,8 +6,9 @@ | |||||||
|     "secret": "DBE31703-14F9-4B01-893D-900B8380CE04" |     "secret": "DBE31703-14F9-4B01-893D-900B8380CE04" | ||||||
|   }, |   }, | ||||||
|   "AuthServer": { |   "AuthServer": { | ||||||
|     "Authority": "https://localhost:44322", |     "Authority": "https://devauth.konsoft.top", | ||||||
|     "RequireHttpsMetadata": true, |     "RequireHttpsMetadata": false, | ||||||
|     "SwaggerClientId": "Admin_Swagger" |     "SwaggerClientId": "Dev_Admin_Swagger", | ||||||
|  |     "MetadataAddress": "https://devauth.konsoft.top" | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user
	