From 0b95234ccd9573e836059b84a78c514e05693608 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Oct 2019 18:11:11 +0800 Subject: [PATCH 1/4] Upgrade Ocelot to support net core 3.0 Resolve #1764 --- .../BackendAdminAppGateway.Host.csproj | 2 +- .../gateways/InternalGateway.Host/InternalGateway.Host.csproj | 2 +- .../PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj index 35f2d6318b..3a944bec65 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj index ea060feff3..4ce9e7f630 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj index d27c3bfbeb..313fda2630 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj @@ -16,7 +16,7 @@ - + From 5ba8367b17cc555a69822271df84cba16013a0d0 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 29 Oct 2019 10:22:44 +0800 Subject: [PATCH 2/4] Calling UseRouting before UseMvcWithDefaultRouteAndArea. Resolve #2028 --- .../BackendAdminAppGatewayHostModule.cs | 6 +++++- .../InternalGateway.Host/InternalGatewayHostModule.cs | 6 +++++- .../PublicWebSiteGatewayHostModule.cs | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs index 45fe70e03f..d30dc8e4fb 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs @@ -103,7 +103,11 @@ namespace BackendAdminAppGateway.Host app.MapWhen( ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/") || ctx.Request.Path.ToString().StartsWith("/Abp/"), - app2 => { app2.UseMvcWithDefaultRouteAndArea(); } + app2 => + { + app2.UseRouting(); + app2.UseMvcWithDefaultRouteAndArea(); + } ); app.UseOcelot().Wait(); diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs index 1232852126..8b470f826f 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs @@ -94,7 +94,11 @@ namespace InternalGateway.Host ctx.Request.Path.ToString().StartsWith("/api/abp/") || ctx.Request.Path.ToString().StartsWith("/Abp/") || ctx.Request.Path.ToString().StartsWith("/Test/"), - app2 => { app2.UseMvcWithDefaultRouteAndArea(); } + app2 => + { + app2.UseRouting(); + app2.UseMvcWithDefaultRouteAndArea(); + } ); app.UseOcelot().Wait(); diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs index 2513c16c00..2add48443a 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs @@ -90,7 +90,11 @@ namespace PublicWebSiteGateway.Host app.MapWhen( ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/") || ctx.Request.Path.ToString().StartsWith("/Abp/"), - app2 => { app2.UseMvcWithDefaultRouteAndArea(); } + app2 => + { + app2.UseRouting(); + app2.UseMvcWithDefaultRouteAndArea(); + } ); app.UseOcelot().Wait(); From 0ffbb514497f85ac7a6d8855544a6d0fd0dbface Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 29 Oct 2019 13:11:42 +0800 Subject: [PATCH 3/4] Use ExpireTimeSpan instead of Cookie.Expiration. --- .../BackendAdminApp.Host/BackendAdminAppHostModule.cs | 1 - .../applications/PublicWebSite.Host/PublicWebSiteHostModule.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index 13c4577cc0..cd7cd24231 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -54,7 +54,6 @@ namespace BackendAdminApp.Host }) .AddCookie("Cookies", options => { - options.Cookie.Expiration = TimeSpan.FromDays(365); options.ExpireTimeSpan = TimeSpan.FromDays(365); }) .AddOpenIdConnect("oidc", options => diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs index 0843eae579..66ea6d174c 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs @@ -52,7 +52,6 @@ namespace PublicWebSite.Host }) .AddCookie("Cookies", options => { - options.Cookie.Expiration = TimeSpan.FromDays(365); options.ExpireTimeSpan = TimeSpan.FromDays(365); }) .AddOpenIdConnect("oidc", options => From e37deb8ddc5607622bbb44b3119e36c5d86ec619 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 31 Oct 2019 17:06:57 +0800 Subject: [PATCH 4/4] Grant permissions to backend-admin-app-client --- .../applications/AuthServer.Host/AuthServerDataSeeder.cs | 1 + .../BackendAdminApp.Host/BackendAdminAppHostModule.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs index b10c5d626c..03850e6d4f 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs @@ -117,6 +117,7 @@ namespace AuthServer.Host commonScopes.Union(new[] { "BackendAdminAppGateway", "IdentityService", "ProductService" }), new[] { "hybrid" }, commonSecret, + permissions: new[] { IdentityPermissions.Users.Default, "ProductManagement.Product" }, redirectUri: "http://localhost:51954/signin-oidc", postLogoutRedirectUri: "http://localhost:51954/signout-callback-oidc" ); diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index cd7cd24231..d04fc1e656 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -99,6 +99,7 @@ namespace BackendAdminApp.Host app.UseVirtualFiles(); app.UseRouting(); app.UseAuthentication(); + app.UseAuthorization(); app.UseAbpRequestLocalization(); app.UseSwagger(); app.UseSwaggerUI(options =>