diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs index 3f1ebc6b..b0edc47a 100644 --- a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs @@ -221,17 +221,13 @@ public class EShopOnAbpAuthServerModule : AbpModule private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) { - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( + 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" - }, - }, + authority: configuration["AuthServer:Authority"]!, + scopes: ["AccountService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Account Service API" ); } diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs index 91b26fba..ecbf9529 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Hosting; using System.Collections.Generic; using Volo.Abp; using Volo.Abp.Modularity; +using Volo.Abp.Swashbuckle; namespace EShopOnAbp.WebPublicGateway; @@ -21,25 +22,19 @@ public class EShopOnAbpWebPublicGatewayModule : AbpModule var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( 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" + authority: configuration["AuthServer:Authority"]!, + scopes: + [ + /* Requested scopes for authorization code request and descriptions for swagger UI only */ + "IdentityService", "AdministrationService", "CatalogService", "BasketService", "PaymentService", + "OrderingService", "CmskitService" + ], + flows: [AbpSwaggerOidcFlows.AuthorizationCode], + apiTitle: "Web Gateway API", + discoveryEndpoint: configuration["AuthServer:MetadataAddress"] ); - - // context.Services.AddReverseProxy() - // .LoadFromConfig(configuration.GetSection("ReverseProxy")); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json index c36665c8..d1afa842 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json @@ -19,8 +19,5 @@ "AllowedHosts": "*", "Redis": { "Configuration": "localhost:6379" - }, - "ElasticSearch": { - "Url": "http://localhost:9200" - } + } } diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/yarp.json b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/yarp.json index ea1b357f..78456fdf 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/yarp.json +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/yarp.json @@ -1,29 +1,68 @@ { "ReverseProxy": { "Routes": { - "Account Service": { - "ClusterId": "accountCluster", + "AbpApi": { + "ClusterId": "administrationCluster", "Match": { - "Path": "/api/account/{**everything}" + "Path": "/api/abp/{**catch-all}" } }, - "Administration Service": { - "ClusterId": "administrationCluster", + "Identity Service": { + "ClusterId": "identityCluster", + "Match": { + "Path": "/api/identity/{**everything}" + } + }, + "Identity Service Swagger": { + "ClusterId": "identityCluster", + "Match": { + "Path": "/swagger-json/Identity/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Identity" } + ] + }, + "FeatureManagement": { + "ClusterId": "feature-management-cluster", + "Match": { + "Path": "/api/feature-management/{**everything}" + } + }, + "PermissionManagement": { + "ClusterId": "permission-management-cluster", "Match": { - "Path": "/api/abp/{**everything}" + "Path": "/api/permission-management/{**everything}" } }, + "SettingManagement": { + "ClusterId": "setting-management-cluster", + "Match": { + "Path": "/api/setting-management/{**everything}" + } + }, + "Administration Service Swagger": { + "ClusterId": "administrationCluster", + "Match": { + "Path": "/swagger-json/Administration/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Administration" } + ] + }, "Catalog Service": { "ClusterId": "catalogCluster", "Match": { "Path": "/api/catalog/{**everything}" } }, - "Basket Service": { - "ClusterId": "basketCluster", + "Catalog Service Swagger": { + "ClusterId": "catalogCluster", "Match": { - "Path": "/api/basket/{**everything}" - } + "Path": "/swagger-json/Catalog/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Catalog" } + ] }, "Ordering Service": { "ClusterId": "orderingCluster", @@ -31,11 +70,14 @@ "Path": "/api/ordering/{**everything}" } }, - "Payment Service": { - "ClusterId": "paymentCluster", + "Ordering Service Swagger": { + "ClusterId": "orderingCluster", "Match": { - "Path": "/api/payment/{**everything}" - } + "Path": "/swagger-json/Ordering/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Ordering" } + ] }, "Cmskit Service": { "ClusterId": "cmskitCluster", @@ -43,31 +85,21 @@ "Path": "/api/cmskit/{**everything}" } }, - "Cmskit Public Service": { + "Cmskit Service Swagger": { "ClusterId": "cmskitCluster", "Match": { - "Path": "/api/cms-kit-public/{**everything}" - } - }, - "Cmskit Admin Service": { - "ClusterId": "cmskitCluster", - "Match": { - "Path": "/api/cms-kit-admin/{**everything}" - } - }, - "product-picture-route": { - "ClusterId": "productPictureCluster", - "Match": { - "Path": "/product-images/{**everything}", - "Methods": [ "GET" ] - } + "Path": "/swagger-json/Cmskit/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Cmskit" } + ] } }, "Clusters": { - "accountCluster": { + "identityCluster": { "Destinations": { "destination1": { - "Address": "https://localhost:44330" + "Address": "https://localhost:44351" } } }, @@ -78,31 +110,31 @@ } } }, - "catalogCluster": { + "permission-management-cluster": { "Destinations": { "destination1": { - "Address": "https://localhost:44354" + "Address": "https://localhost:44353" } } }, - "basketCluster": { + "setting-management-cluster": { "Destinations": { "destination1": { - "Address": "https://localhost:44355" + "Address": "https://localhost:44353" } } - }, - "orderingCluster": { + }, + "catalogCluster": { "Destinations": { "destination1": { - "Address": "https://localhost:44356" + "Address": "https://localhost:44354" } } }, - "paymentCluster": { + "orderingCluster": { "Destinations": { "destination1": { - "Address": "https://localhost:44357" + "Address": "https://localhost:44356" } } }, @@ -112,14 +144,7 @@ "Address": "https://localhost:44358" } } - }, - "productPictureCluster": { - "Destinations": { - "destination1": { - "Address": "https://localhost:44354" - } - } } } } -} +} \ No newline at end of file diff --git a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs index 221d2295..6f467f03 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs +++ b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs @@ -10,6 +10,8 @@ using System.Collections.Generic; using System.Linq; using Volo.Abp; using Volo.Abp.Modularity; +using Volo.Abp.Swashbuckle; +using Yarp.ReverseProxy.Configuration; namespace EShopOnAbp.WebGateway; @@ -23,22 +25,18 @@ public class EShopOnAbpWebGatewayModule : AbpModule var configuration = context.Services.GetConfiguration(); var hostingEnvironment = context.Services.GetHostingEnvironment(); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( 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: "Web Gateway" + authority: configuration["AuthServer:Authority"]!, + scopes: + [ + /* Requested scopes for authorization code request and descriptions for swagger UI only */ + "IdentityService", "AdministrationService", "CatalogService", "BasketService", "PaymentService", + "OrderingService", "CmskitService" + ], + flows: ["authorization_code"], + apiTitle: "Web Gateway API", + discoveryEndpoint: configuration["AuthServer:MetadataAddress"] ); context.Services.AddCors(options => @@ -70,6 +68,7 @@ public class EShopOnAbpWebGatewayModule : AbpModule { app.UseDeveloperExceptionPage(); } + app.UseCorrelationId(); app.UseAbpSerilogEnrichers(); app.UseCors(); @@ -80,9 +79,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 diff --git a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json index f9543eef..20a13351 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json +++ b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "true", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "Logging": { "LogLevel": { @@ -20,8 +20,5 @@ "Redis": { "Configuration": "localhost:6379" - }, - "ElasticSearch": { - "Url": "http://localhost:9200" } } diff --git a/gateways/web/src/EShopOnAbp.WebGateway/yarp.json b/gateways/web/src/EShopOnAbp.WebGateway/yarp.json index 14e6e5a8..78456fdf 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/yarp.json +++ b/gateways/web/src/EShopOnAbp.WebGateway/yarp.json @@ -1,10 +1,10 @@ { "ReverseProxy": { "Routes": { - "Account Service": { - "ClusterId": "accountCluster", + "AbpApi": { + "ClusterId": "administrationCluster", "Match": { - "Path": "/api/account/{**everything}" + "Path": "/api/abp/{**catch-all}" } }, "Identity Service": { @@ -13,57 +13,89 @@ "Path": "/api/identity/{**everything}" } }, - "Administration Service": { - "ClusterId": "administrationCluster", + "Identity Service Swagger": { + "ClusterId": "identityCluster", "Match": { - "Path": "/api/abp/{**everything}" - } + "Path": "/swagger-json/Identity/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Identity" } + ] }, - "feature-management-route": { + "FeatureManagement": { "ClusterId": "feature-management-cluster", "Match": { "Path": "/api/feature-management/{**everything}" } }, - "permission-management-route": { + "PermissionManagement": { "ClusterId": "permission-management-cluster", "Match": { "Path": "/api/permission-management/{**everything}" } }, - "setting-management-route": { + "SettingManagement": { "ClusterId": "setting-management-cluster", "Match": { "Path": "/api/setting-management/{**everything}" } }, + "Administration Service Swagger": { + "ClusterId": "administrationCluster", + "Match": { + "Path": "/swagger-json/Administration/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Administration" } + ] + }, "Catalog Service": { "ClusterId": "catalogCluster", "Match": { "Path": "/api/catalog/{**everything}" } }, + "Catalog Service Swagger": { + "ClusterId": "catalogCluster", + "Match": { + "Path": "/swagger-json/Catalog/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Catalog" } + ] + }, "Ordering Service": { "ClusterId": "orderingCluster", "Match": { "Path": "/api/ordering/{**everything}" } }, + "Ordering Service Swagger": { + "ClusterId": "orderingCluster", + "Match": { + "Path": "/swagger-json/Ordering/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Ordering" } + ] + }, "Cmskit Service": { "ClusterId": "cmskitCluster", "Match": { "Path": "/api/cmskit/{**everything}" } + }, + "Cmskit Service Swagger": { + "ClusterId": "cmskitCluster", + "Match": { + "Path": "/swagger-json/Cmskit/swagger/v1/swagger.json" + }, + "Transforms": [ + { "PathRemovePrefix": "/swagger-json/Cmskit" } + ] } }, "Clusters": { - "accountCluster": { - "Destinations": { - "destination1": { - "Address": "https://localhost:44330" - } - } - }, "identityCluster": { "Destinations": { "destination1": { @@ -78,13 +110,6 @@ } } }, - "feature-management-cluster": { - "Destinations": { - "destination1": { - "Address": "https://localhost:44353" - } - } - }, "permission-management-cluster": { "Destinations": { "destination1": { diff --git a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs index 9c5af167..066dd01e 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs +++ b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs @@ -1,24 +1,22 @@ using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; -using EShopOnAbp.CatalogService; -using EShopOnAbp.OrderingService; -using EShopOnAbp.CmskitService; + +// using EShopOnAbp.CatalogService; +// using EShopOnAbp.OrderingService; +// using EShopOnAbp.CmskitService; namespace EShopOnAbp.AdministrationService { [DependsOn( - typeof(CatalogServiceApplicationContractsModule), typeof(AdministrationServiceDomainSharedModule), typeof(AbpPermissionManagementApplicationContractsModule), - typeof(AbpSettingManagementApplicationContractsModule), - typeof(OrderingServiceApplicationContractsModule), - typeof(CmskitServiceApplicationContractsModule) + typeof(AbpSettingManagementApplicationContractsModule) + // typeof(CatalogServiceApplicationContractsModule), + // typeof(OrderingServiceApplicationContractsModule), + // typeof(CmskitServiceApplicationContractsModule) )] public class AdministrationServiceApplicationContractsModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - } } -} +} \ No newline at end of file diff --git a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj index 90b91d4a..117ca9e2 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj +++ b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/services/administration/src/EShopOnAbp.AdministrationService.Domain/AdministrationServiceDomainModule.cs b/services/administration/src/EShopOnAbp.AdministrationService.Domain/AdministrationServiceDomainModule.cs index b71b1d25..03a7f602 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.Domain/AdministrationServiceDomainModule.cs +++ b/services/administration/src/EShopOnAbp.AdministrationService.Domain/AdministrationServiceDomainModule.cs @@ -2,7 +2,6 @@ using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.Identity; -using Volo.Abp.PermissionManagement.IdentityServer; using Volo.Abp.SettingManagement; namespace EShopOnAbp.AdministrationService @@ -11,8 +10,7 @@ namespace EShopOnAbp.AdministrationService typeof(AdministrationServiceDomainSharedModule), typeof(AbpSettingManagementDomainModule), typeof(AbpAuditLoggingDomainModule), - typeof(AbpPermissionManagementDomainIdentityModule), - typeof(AbpPermissionManagementDomainIdentityServerModule) + typeof(AbpPermissionManagementDomainIdentityModule) )] public class AdministrationServiceDomainModule : AbpModule { diff --git a/services/administration/src/EShopOnAbp.AdministrationService.Domain/EShopOnAbp.AdministrationService.Domain.csproj b/services/administration/src/EShopOnAbp.AdministrationService.Domain/EShopOnAbp.AdministrationService.Domain.csproj index 780d6925..dbaf7306 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.Domain/EShopOnAbp.AdministrationService.Domain.csproj +++ b/services/administration/src/EShopOnAbp.AdministrationService.Domain/EShopOnAbp.AdministrationService.Domain.csproj @@ -12,7 +12,6 @@ - diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs index 7ecb1575..37838b82 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs +++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs @@ -12,10 +12,12 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Identity; using Volo.Abp.Modularity; +using Volo.Abp.PermissionManagement; +using Volo.Abp.Security.Claims; +using Volo.Abp.SettingManagement; namespace EShopOnAbp.AdministrationService; @@ -25,7 +27,6 @@ namespace EShopOnAbp.AdministrationService; typeof(AdministrationServiceEntityFrameworkCoreModule), typeof(EShopOnAbpSharedHostingMicroservicesModule), typeof(AbpHttpClientIdentityModelWebModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpIdentityHttpApiClientModule) )] public class AdministrationServiceHttpApiHostModule : AbpModule @@ -36,16 +37,19 @@ public class AdministrationServiceHttpApiHostModule : AbpModule JwtBearerConfigurationHelper.Configure(context, "AdministrationService"); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - {"AdministrationService", "Administration Service API"} - }, + authority: configuration["AuthServer:Authority"]!, + scopes: ["AdministrationService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Administration Service API" ); + + context.Services.Configure(options => + { + options.IsDynamicClaimsEnabled = true; + }); context.Services.AddCors(options => { @@ -53,7 +57,7 @@ public class AdministrationServiceHttpApiHostModule : AbpModule { builder .WithOrigins( - configuration["App:CorsOrigins"] + configuration["App:CorsOrigins"]! .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() @@ -65,6 +69,16 @@ public class AdministrationServiceHttpApiHostModule : AbpModule .AllowCredentials(); }); }); + + Configure(options => + { + options.IsDynamicPermissionStoreEnabled = true; + }); + + Configure(options => + { + options.IsDynamicSettingStoreEnabled = true; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) @@ -91,7 +105,6 @@ public class AdministrationServiceHttpApiHostModule : AbpModule var configuration = context.ServiceProvider.GetRequiredService(); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Administration Service API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - // options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); }); app.UseAbpSerilogEnrichers(); app.UseAuditing(); diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/DbMigrations/AdministrationServiceDataSeedContributor.cs b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/DbMigrations/AdministrationServiceDataSeedContributor.cs index b8b60132..1e0abf84 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/DbMigrations/AdministrationServiceDataSeedContributor.cs +++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/DbMigrations/AdministrationServiceDataSeedContributor.cs @@ -25,8 +25,8 @@ public class AdministrationServiceDataSeedContributor : IDataSeedContributor, IT private async Task SeedClientCredentialPermissionsAsync() { - await _permissionManager.SetAsync(IdentityUsersDefaultPermission, "C", "EShopOnAbp_AdministrationService", true); - await _permissionManager.SetAsync(IdentityUsersDefaultPermission, "C", "EShopOnAbp_CmskitService", true); - await _permissionManager.SetAsync(IdentityUsersLookupPermission, "C", "EShopOnAbp_CmskitService", true); + // await _permissionManager.SetAsync(IdentityUsersDefaultPermission, "C", "EShopOnAbp_AdministrationService", true); + // await _permissionManager.SetAsync(IdentityUsersDefaultPermission, "C", "EShopOnAbp_CmskitService", true); + // await _permissionManager.SetAsync(IdentityUsersLookupPermission, "C", "EShopOnAbp_CmskitService", true); } } \ No newline at end of file diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/EShopOnAbp.AdministrationService.HttpApi.Host.csproj b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/EShopOnAbp.AdministrationService.HttpApi.Host.csproj index 93acdd53..b4319e90 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/EShopOnAbp.AdministrationService.HttpApi.Host.csproj +++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/EShopOnAbp.AdministrationService.HttpApi.Host.csproj @@ -15,7 +15,6 @@ - diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json index a9f4e973..d98cb9cd 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json +++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json @@ -6,6 +6,7 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", + "MetadataAddress": "http://localhost:8080/realms/master", "SwaggerClientId": "SwaggerClient" }, "RemoteServices": { diff --git a/services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs b/services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs index c1516769..75f0b0ce 100644 --- a/services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs +++ b/services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs @@ -110,14 +110,12 @@ public class BasketServiceModule : AbpModule private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) { - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - {"BasketService", "Basket Service API"} - }, + authority: configuration["AuthServer:Authority"]!, + scopes: ["BasketService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Basket Service API" ); } diff --git a/services/basket/src/EShopOnAbp.BasketService/appsettings.json b/services/basket/src/EShopOnAbp.BasketService/appsettings.json index 7ef6ff5f..848af7b7 100644 --- a/services/basket/src/EShopOnAbp.BasketService/appsettings.json +++ b/services/basket/src/EShopOnAbp.BasketService/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "RemoteServices": { "Catalog": { diff --git a/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/CatalogServiceHttpApiHostModule.cs b/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/CatalogServiceHttpApiHostModule.cs index f443513a..6413e5ae 100644 --- a/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/CatalogServiceHttpApiHostModule.cs +++ b/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/CatalogServiceHttpApiHostModule.cs @@ -34,16 +34,14 @@ public class CatalogServiceHttpApiHostModule : AbpModule JwtBearerConfigurationHelper.Configure(context, "CatalogService"); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - { "CatalogService", "Catalog Service API" } - }, - apiTitle: "Catalog Service API" - ); + authority: configuration["AuthServer:Authority"]!, + scopes: ["CatalogService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], + apiTitle: "Catalog Service API" + ); context.Services.AddCors(options => { @@ -51,7 +49,7 @@ public class CatalogServiceHttpApiHostModule : AbpModule { builder .WithOrigins( - configuration["App:CorsOrigins"] + configuration["App:CorsOrigins"]! .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() @@ -110,7 +108,6 @@ public class CatalogServiceHttpApiHostModule : AbpModule var configuration = context.ServiceProvider.GetRequiredService(); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Catalog Service API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); }); app.UseAbpSerilogEnrichers(); app.UseAuditing(); diff --git a/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/appsettings.json b/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/appsettings.json index 7a8b88c1..a36a8c76 100644 --- a/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/appsettings.json +++ b/services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "Logging": { "LogLevel": { diff --git a/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/CmskitServiceHttpApiHostModule.cs b/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/CmskitServiceHttpApiHostModule.cs index 67078939..faf107de 100644 --- a/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/CmskitServiceHttpApiHostModule.cs +++ b/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/CmskitServiceHttpApiHostModule.cs @@ -42,16 +42,14 @@ public class CmskitServiceHttpApiHostModule : AbpModule var configuration = context.Services.GetConfiguration(); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary - { - { "CmskitService", "Cmskit Service API" } - }, - apiTitle: "Cmskit Service API" - ); + authority: configuration["AuthServer:Authority"]!, + scopes: ["CmskitService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], + apiTitle: "Cmskit Service API" + ); context.Services.AddCors(options => { @@ -59,7 +57,7 @@ public class CmskitServiceHttpApiHostModule : AbpModule { builder .WithOrigins( - configuration["App:CorsOrigins"] + configuration["App:CorsOrigins"]! .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() @@ -122,7 +120,6 @@ public class CmskitServiceHttpApiHostModule : AbpModule var configuration = context.ServiceProvider.GetRequiredService(); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Cmskit Service API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); }); app.UseAbpSerilogEnrichers(); app.UseAuditing(); diff --git a/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/appsettings.json b/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/appsettings.json index 000d8f79..da78f400 100644 --- a/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/appsettings.json +++ b/services/cmskit/src/EShopOnAbp.CmskitService.HttpApi.Host/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "Logging": { "LogLevel": { diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs index c979c499..50a6b0e4 100644 --- a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs +++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs @@ -33,16 +33,14 @@ public class IdentityServiceHttpApiHostModule : AbpModule JwtBearerConfigurationHelper.Configure(context, "IdentityService"); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - { "IdentityService", "Identity Service API" } - }, - apiTitle: "IdentityService API" - ); + authority: configuration["AuthServer:Authority"]!, + scopes: ["IdentityService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], + apiTitle: "Identity Service API" + ); context.Services.AddCors(options => { @@ -50,7 +48,7 @@ public class IdentityServiceHttpApiHostModule : AbpModule { builder .WithOrigins( - configuration["App:CorsOrigins"] + configuration["App:CorsOrigins"]! .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() @@ -94,7 +92,6 @@ public class IdentityServiceHttpApiHostModule : AbpModule var configuration = context.ServiceProvider.GetRequiredService(); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Identity Service API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); }); app.UseAbpSerilogEnrichers(); app.UseAuditing(); diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json index f37922ad..5518e83b 100644 --- a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json +++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "Keycloak": { "url": "http://localhost:8080", diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/OrderingServiceHttpApiHostModule.cs b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/OrderingServiceHttpApiHostModule.cs index 04057038..1592a687 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/OrderingServiceHttpApiHostModule.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/OrderingServiceHttpApiHostModule.cs @@ -32,16 +32,14 @@ public class OrderingServiceHttpApiHostModule : AbpModule JwtBearerConfigurationHelper.Configure(context, "OrderingService"); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - { "OrderingService", "Ordering Service API" } - }, + authority: configuration["AuthServer:Authority"]!, + scopes: ["OrderingService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Ordering Service API" - ); + ); context.Services.AddCors(options => { @@ -49,7 +47,7 @@ public class OrderingServiceHttpApiHostModule : AbpModule { builder .WithOrigins( - configuration["App:CorsOrigins"] + configuration["App:CorsOrigins"]! .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() @@ -97,7 +95,6 @@ public class OrderingServiceHttpApiHostModule : AbpModule var configuration = context.ServiceProvider.GetRequiredService(); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Ordering Service API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); }); app.UseAbpSerilogEnrichers(); app.UseAuditing(); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json index 865a6130..aa730d23 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "Logging": { "LogLevel": { diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj index 659bf642..aafc6180 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj @@ -3,7 +3,7 @@ - netstandard2.0 + netstandard2.1 EShopOnAbp.PaymentService diff --git a/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/PaymentServiceHttpApiHostModule.cs b/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/PaymentServiceHttpApiHostModule.cs index f9af9d45..5f147d17 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/PaymentServiceHttpApiHostModule.cs +++ b/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/PaymentServiceHttpApiHostModule.cs @@ -33,16 +33,14 @@ public class PaymentServiceHttpApiHostModule : AbpModule JwtBearerConfigurationHelper.Configure(context, "PaymentService"); - SwaggerConfigurationHelper.ConfigureWithAuth( + SwaggerConfigurationHelper.ConfigureWithOidc( context: context, - authority: configuration["AuthServer:Authority"], - scopes: new - Dictionary /* Requested scopes for authorization code request and descriptions for swagger UI only */ - { - {"PaymentService", "Payment Service API"} - }, + authority: configuration["AuthServer:Authority"]!, + scopes: ["PaymentService"], + flows: ["authorization_code"], + discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Payment Service API" - ); + ); context.Services.AddCors(options => { @@ -50,7 +48,7 @@ public class PaymentServiceHttpApiHostModule : AbpModule { builder .WithOrigins( - configuration["App:CorsOrigins"] + configuration["App:CorsOrigins"]! .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() @@ -88,7 +86,6 @@ public class PaymentServiceHttpApiHostModule : AbpModule var configuration = context.ServiceProvider.GetRequiredService(); options.SwaggerEndpoint("/swagger/v1/swagger.json", "Payment Service API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); }); app.UseAbpSerilogEnrichers(); app.UseAuditing(); diff --git a/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/appsettings.json b/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/appsettings.json index 93582be1..0962ca7e 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/appsettings.json +++ b/services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/appsettings.json @@ -6,8 +6,8 @@ "AuthServer": { "Authority": "http://localhost:8080/realms/master", "RequireHttpsMetadata": "false", - "SwaggerClientId": "WebGateway_Swagger", - "SwaggerClientSecret": "1q2w3e*" + "MetadataAddress": "http://localhost:8080/realms/master", + "SwaggerClientId": "WebGateway_Swagger" }, "Logging": { "LogLevel": { diff --git a/shared/EShopOnAbp.Keycloak.DbMigrator/EShopOnAbp.Keycloak.DbMigrator.csproj b/shared/EShopOnAbp.Keycloak.DbMigrator/EShopOnAbp.Keycloak.DbMigrator.csproj index f7739615..fd279ba6 100644 --- a/shared/EShopOnAbp.Keycloak.DbMigrator/EShopOnAbp.Keycloak.DbMigrator.csproj +++ b/shared/EShopOnAbp.Keycloak.DbMigrator/EShopOnAbp.Keycloak.DbMigrator.csproj @@ -3,6 +3,7 @@ Exe net8.0 + enable EShopOnAbp.DbMigrator diff --git a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj index 433eb956..edcf7009 100644 --- a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj +++ b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj @@ -2,6 +2,7 @@ net8.0 + enable EShopOnAbp.Shared.Hosting.AspNetCore diff --git a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs index 9b1ec2f0..416e502b 100644 --- a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs +++ b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs @@ -7,13 +7,6 @@ public static class SerilogConfigurationHelper { public static void Configure(string applicationName) { - // TODO: Uncomment following lines for ElasticSearch configuration - // var configuration = new ConfigurationBuilder() - // .SetBasePath(Directory.GetCurrentDirectory()) - // .AddJsonFile("appsettings.json") - // .AddEnvironmentVariables() - // .Build(); - Log.Logger = new LoggerConfiguration() #if DEBUG .MinimumLevel.Debug() @@ -25,14 +18,6 @@ public static class SerilogConfigurationHelper .Enrich.FromLogContext() .Enrich.WithProperty("Application", $"{applicationName}") .WriteTo.Async(c => c.File("Logs/logs.txt")) - // TODO: Uncomment following lines for ElasticSearch configuration - // .WriteTo.Elasticsearch( - // new ElasticsearchSinkOptions(new Uri(configuration["ElasticSearch:Url"])) - // { - // AutoRegisterTemplate = true, - // AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6, - // IndexFormat = "MyProjectName-log-{0:yyyy.MM}" - // }) .WriteTo.Async(c => c.Console()) .CreateLogger(); } diff --git a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs index 6e79b550..541feb5f 100644 --- a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs +++ b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.OpenApi.Models; using Volo.Abp.Modularity; @@ -19,18 +18,22 @@ public static class SwaggerConfigurationHelper options.CustomSchemaIds(type => type.FullName); }); } - public static void ConfigureWithAuth( + public static void ConfigureWithOidc( ServiceConfigurationContext context, string authority, - Dictionary scopes, + string[] scopes, string apiTitle, string apiVersion = "v1", - string apiName = "v1" + string apiName = "v1", + string[]? flows = null, + string? discoveryEndpoint = null ) { - context.Services.AddAbpSwaggerGenWithOAuth( + context.Services.AddAbpSwaggerGenWithOidc( authority: authority, scopes: scopes, + flows: flows, + discoveryEndpoint: discoveryEndpoint, options => { options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion }); diff --git a/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj b/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj index 1f503224..2dca4833 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj +++ b/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj @@ -2,6 +2,8 @@ net8.0 + enable + EShopOnAbp.Shared.Hosting.Gateways diff --git a/shared/EShopOnAbp.Shared.Hosting.Gateways/YarpSwaggerUIBuilderExtensions.cs b/shared/EShopOnAbp.Shared.Hosting.Gateways/YarpSwaggerUIBuilderExtensions.cs index 508884a6..fb0c92f5 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Gateways/YarpSwaggerUIBuilderExtensions.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Gateways/YarpSwaggerUIBuilderExtensions.cs @@ -43,7 +43,6 @@ public static class YarpSwaggerUIBuilderExtensions options.SwaggerEndpoint($"{clusterGroup.Value.Address}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); } }); diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj index 42fd8da9..bffa4f9d 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj @@ -2,6 +2,8 @@ net8.0 + enable + EShopOnAbp.Shared.Hosting.Microservices diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs index ae232453..6402f175 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.Extensions.DependencyInjection; using StackExchange.Redis; using Volo.Abp.AspNetCore.Authentication.JwtBearer; +using Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims; using Volo.Abp.BackgroundJobs.RabbitMQ; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; @@ -26,6 +27,14 @@ namespace EShopOnAbp.Shared.Hosting.Microservices; )] public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(options => + { + options.IsEnabled = true; + }); + } + public override void ConfigureServices(ServiceConfigurationContext context) { Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true; @@ -36,15 +45,17 @@ public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule options.KeyPrefix = "EShopOnAbp:"; }); - var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); + var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); context.Services .AddDataProtection() .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys"); context.Services.AddSingleton(sp => { - var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); + var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); return new RedisDistributedSynchronizationProvider(connection.GetDatabase()); }); + + context.Services.AddHttpClient(); } } \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj index ae21a9dc..62582e61 100644 --- a/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj +++ b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj @@ -1,7 +1,8 @@  - netstandard2.0 + netstandard2.1 + enable EShopOnAbp.Shared.Hosting diff --git a/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs index c516d61d..c30bcfad 100644 --- a/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs +++ b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs @@ -23,7 +23,6 @@ namespace EShopOnAbp.Shared.Hosting database.MappedConnections.Add("AbpAuditLogging"); database.MappedConnections.Add("AbpPermissionManagement"); database.MappedConnections.Add("AbpSettingManagement"); - database.MappedConnections.Add("AbpFeatureManagement"); database.MappedConnections.Add("AbpBlobStoring"); }); diff --git a/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj b/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj index 4d52096c..baa038c1 100644 --- a/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj +++ b/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj @@ -2,6 +2,7 @@ net8.0 + enable true EShopOnAbp