Compare commits
7 Commits
802624e7ea
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d9e7658d7 | |||
| d340be4e2c | |||
| 4afd7924b7 | |||
| 30e5e6a4dc | |||
| df78f842f3 | |||
| 5138daebea | |||
| bbead3a651 |
@ -58,6 +58,8 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
|
|
||||||
context.Services.Configure<ForwardedHeadersOptions>(options =>
|
context.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
{
|
{
|
||||||
|
options.KnownNetworks.Clear();
|
||||||
|
options.KnownProxies.Clear();
|
||||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -137,18 +139,19 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
var app = context.GetApplicationBuilder();
|
var app = context.GetApplicationBuilder();
|
||||||
var env = context.GetEnvironment();
|
var env = context.GetEnvironment();
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (!env.IsDevelopment())
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
app.UseForwardedHeaders();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
app.UseErrorPage();
|
app.UseErrorPage();
|
||||||
app.UseForwardedHeaders();
|
app.UseForwardedHeaders();
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
app.UseForwardedHeaders();
|
||||||
|
}
|
||||||
|
|
||||||
app.UseAbpRequestLocalization();
|
app.UseAbpRequestLocalization();
|
||||||
|
|
||||||
app.UseCorrelationId();
|
app.UseCorrelationId();
|
||||||
|
|||||||
@ -27,6 +27,8 @@ namespace KonSoft.InternalGateway.Extensions
|
|||||||
.ToList();
|
.ToList();
|
||||||
var gatewayUrl = configuration["GatewayUrl"];
|
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 =>
|
||||||
@ -38,9 +40,7 @@ namespace KonSoft.InternalGateway.Extensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.SwaggerEndpoint(new Uri(new Uri(!string.IsNullOrWhiteSpace(gatewayUrl)? gatewayUrl: clusterGroup.Value.Address), "/swagger/v1/swagger.json").AbsoluteUri, $"{routeConfig.RouteId} API");
|
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.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
|
|
||||||
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,7 @@ try
|
|||||||
.UseAutofac()
|
.UseAutofac()
|
||||||
.UseSerilog();
|
.UseSerilog();
|
||||||
|
|
||||||
builder.Services.AddAbpSwaggerGenWithOAuth(builder.Configuration["AuthServer:Authority"]!,
|
builder.Services.AddAbpSwaggerGenWithOidc(builder.Configuration["AuthServer:Authority"]!, setupAction: options =>
|
||||||
new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "Clean", "Clean API" }
|
|
||||||
}, options =>
|
|
||||||
{
|
{
|
||||||
options.SwaggerDoc("v1", new OpenApiInfo
|
options.SwaggerDoc("v1", new OpenApiInfo
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
"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": true,
|
||||||
"SwaggerClientId": "Gateway_Swagger"
|
"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