diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs index 91b26fba..08c677f1 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs @@ -21,25 +21,19 @@ public class EShopOnAbpWebPublicGatewayModule : AbpModule var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); - SwaggerConfigurationHelper.ConfigureWithAuth( - context: context, - authority: configuration["AuthServer:Authority"], - scopes: new Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - { "AccountService", "Account Service API" }, - { "IdentityService", "Identity Service API" }, - { "AdministrationService", "Administration Service API" }, - { "CatalogService", "Catalog Service API" }, - { "BasketService", "Basket Service API" }, - { "PaymentService", "Payment Service API" }, - { "OrderingService", "Ordering Service API" }, - { "CmskitService", "Cmskit Service API" }, - }, - apiTitle: "WebPublic Gateway" - ); - - // context.Services.AddReverseProxy() - // .LoadFromConfig(configuration.GetSection("ReverseProxy")); + SwaggerConfigurationHelper + .ConfigureWithOidc( + context: context, + authority: configuration["AuthServer:Authority"]!, + /* Requested scopes for authorization code request and descriptions for swagger UI only */ + scopes: new[] + { + "AccountService", "IdentityService", "AdministrationService", "CatalogService", "BasketService", + "OrderingService", "CmskitService" + }, + apiTitle: "Public Web Gateway API", + discoveryEndpoint: configuration["AuthServer:MetadataAddress"] + ); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs index 221d2295..6410fe7a 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs +++ b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs @@ -23,23 +23,19 @@ public class EShopOnAbpWebGatewayModule : AbpModule var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); - SwaggerConfigurationHelper.ConfigureWithAuth( - context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ + SwaggerConfigurationHelper + .ConfigureWithOidc( + context: context, + authority: configuration["AuthServer:Authority"]!, + /* Requested scopes for authorization code request and descriptions for swagger UI only */ + scopes: new[] { - {"AccountService", "Account Service API"}, - {"IdentityService", "Identity Service API"}, - {"AdministrationService", "Administration Service API"}, - {"CatalogService", "Catalog Service API"}, - {"BasketService", "Basket Service API"}, - {"PaymentService", "Payment Service API"}, - {"OrderingService", "Ordering Service API"}, - {"CmskitService", "Cmskit Service API"}, + "AccountService", "IdentityService", "AdministrationService", "CatalogService", "BasketService", + "PaymentService", "OrderingService", "CmskitService" }, - apiTitle: "Web Gateway" - ); + apiTitle: "Web Gateway", + discoveryEndpoint: configuration["AuthServer:MetadataAddress"] + ); context.Services.AddCors(options => { @@ -70,6 +66,7 @@ public class EShopOnAbpWebGatewayModule : AbpModule { app.UseDeveloperExceptionPage(); } + app.UseCorrelationId(); app.UseAbpSerilogEnrichers(); app.UseCors(); @@ -80,9 +77,6 @@ public class EShopOnAbpWebGatewayModule : AbpModule .AddRedirect("^(|\\|\\s+)$", "/swagger")); app.UseRouting(); - app.UseEndpoints(endpoints => - { - endpoints.MapReverseProxy(); - }); + app.UseEndpoints(endpoints => { endpoints.MapReverseProxy(); }); } } \ No newline at end of file