From f434855e93194bc8ab170adf754b0963bad9900b Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 19 Oct 2020 15:09:44 +0800 Subject: [PATCH 1/5] Add summary to AbpApplicationCreationOptions' Configuration property. Resolve #5794 --- .../Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs index e4d7744ae8..f2e201d0aa 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs @@ -13,6 +13,9 @@ namespace Volo.Abp [NotNull] public PlugInSourceList PlugInSources { get; } + /// + /// The options in this property only take effect when IConfiguration not registered. + /// [NotNull] public AbpConfigurationBuilderOptions Configuration {get; } @@ -23,4 +26,4 @@ namespace Volo.Abp Configuration = new AbpConfigurationBuilderOptions(); } } -} \ No newline at end of file +} From 9c42a719994be7656b07ab63f0347e23cef251ef Mon Sep 17 00:00:00 2001 From: Peter Western Date: Mon, 19 Oct 2020 16:41:16 +0100 Subject: [PATCH 2/5] [5860] Dispose IHost in AbpAspNetCoreIntegratedTestBase at end of test run --- .../AbpAspNetCoreIntegratedTestBase.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs index d1881b0cbd..a3ed8798d3 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Net.Http; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; @@ -11,7 +10,7 @@ using Microsoft.Extensions.Hosting; namespace Volo.Abp.AspNetCore.TestBase { - public abstract class AbpAspNetCoreIntegratedTestBase : AbpTestBaseWithServiceProvider + public abstract class AbpAspNetCoreIntegratedTestBase : AbpTestBaseWithServiceProvider, IDisposable where TStartup : class { protected TestServer Server { get; } @@ -20,15 +19,17 @@ namespace Volo.Abp.AspNetCore.TestBase protected override IServiceProvider ServiceProvider { get; } + private readonly IHost _host; + protected AbpAspNetCoreIntegratedTestBase() { var builder = CreateHostBuilder(); - var host = builder.Build(); - host.Start(); + _host = builder.Build(); + _host.Start(); - Server = host.GetTestServer(); - Client = host.GetTestClient(); + Server = _host.GetTestServer(); + Client = _host.GetTestClient(); ServiceProvider = Server.Services; @@ -49,7 +50,7 @@ namespace Volo.Abp.AspNetCore.TestBase protected virtual void ConfigureServices(HostBuilderContext context, IServiceCollection services) { - + } #region GetUrl @@ -90,5 +91,10 @@ namespace Volo.Abp.AspNetCore.TestBase } #endregion + + public void Dispose() + { + _host?.Dispose(); + } } } From 8c172d4f1cf0ee3d2904bc85cf533698085f01d3 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 20 Oct 2020 12:52:49 +0300 Subject: [PATCH 3/5] app template & account module: added login links to toolbar related https://github.com/volosoft/volo/issues/3579 --- .../AccountModuleToolbarContributor.cs | 9 +++---- .../Toolbar/UserLoginLink/Default.cshtml | 2 +- .../Toolbar/LoginLink/Default.cshtml | 4 +++ .../LoginLink/LoginLinkViewComponent.cs | 13 ++++++++++ .../Menus/MyProjectNameToolbarContributor.cs | 26 +++++++++++++++++++ .../MyProjectNameWebModule.cs | 6 +++++ 6 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/Default.cshtml create mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs create mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs diff --git a/modules/account/src/Volo.Abp.Account.Web/AccountModuleToolbarContributor.cs b/modules/account/src/Volo.Abp.Account.Web/AccountModuleToolbarContributor.cs index 1bade3f661..042e843c94 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AccountModuleToolbarContributor.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AccountModuleToolbarContributor.cs @@ -15,11 +15,10 @@ namespace Volo.Abp.Account.Web return Task.CompletedTask; } - //TODO: Currently disabled! - //if (!context.ServiceProvider.GetRequiredService().IsAuthenticated) - //{ - // context.Toolbar.Items.Add(new ToolbarItem(typeof(UserLoginLinkViewComponent))); - //} + if (!context.ServiceProvider.GetRequiredService().IsAuthenticated) + { + context.Toolbar.Items.Add(new ToolbarItem(typeof(UserLoginLinkViewComponent))); + } return Task.CompletedTask; } diff --git a/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml b/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml index 2331409857..dbe3362c87 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml @@ -1,4 +1,4 @@ @using Localization.Resources.AbpUi @using Microsoft.AspNetCore.Mvc.Localization @inject IHtmlLocalizer L -@L["Login"] +@L["Login"] diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/Default.cshtml b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/Default.cshtml new file mode 100644 index 0000000000..2d6f11c816 --- /dev/null +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/Default.cshtml @@ -0,0 +1,4 @@ +@using Microsoft.AspNetCore.Mvc.Localization +@using MyCompanyName.MyProjectName.Localization +@inject IHtmlLocalizer L +@L["Login"] diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs new file mode 100644 index 0000000000..9e6aedb5fc --- /dev/null +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; + +namespace Volo.Abp.Account.Web.Modules.Account.Components.Toolbar.UserLoginLink +{ + public class LoginLinkViewComponent : AbpViewComponent + { + public virtual IViewComponentResult Invoke() + { + return View("~/Components/Toolbar/LoginLink/Default.cshtml"); + } + } +} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs new file mode 100644 index 0000000000..a6d24b9ee7 --- /dev/null +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Account.Web.Modules.Account.Components.Toolbar.UserLoginLink; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars; +using Volo.Abp.Users; + +namespace MyCompanyName.MyProjectName.Web.Menus +{ + public class MyProjectNameToolbarContributor : IToolbarContributor + { + public virtual Task ConfigureToolbarAsync(IToolbarConfigurationContext context) + { + if (context.Toolbar.Name != StandardToolbars.Main) + { + return Task.CompletedTask; + } + + if (!context.ServiceProvider.GetRequiredService().IsAuthenticated) + { + context.Toolbar.Items.Add(new ToolbarItem(typeof(LoginLinkViewComponent))); + } + + return Task.CompletedTask; + } + } +} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs index 23423673e0..45cf23f20c 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs @@ -28,6 +28,7 @@ using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; @@ -182,6 +183,11 @@ namespace MyCompanyName.MyProjectName.Web { options.MenuContributors.Add(new MyProjectNameMenuContributor(configuration)); }); + + Configure(options => + { + options.Contributors.Add(new MyProjectNameToolbarContributor()); + }); } private void ConfigureSwaggerServices(IServiceCollection services) From e82d505568b51111756b5ad8eccb8bdedd2f0026 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 20 Oct 2020 16:19:43 +0300 Subject: [PATCH 4/5] namespace update LoginLink in app template --- .../Components/Toolbar/LoginLink/LoginLinkViewComponent.cs | 4 ++-- .../Menus/MyProjectNameToolbarContributor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs index 9e6aedb5fc..b93104a565 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; -namespace Volo.Abp.Account.Web.Modules.Account.Components.Toolbar.UserLoginLink +namespace MyCompanyName.MyProjectName.Web.Components.Toolbar.LoginLink { public class LoginLinkViewComponent : AbpViewComponent { diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs index a6d24b9ee7..6769279081 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Account.Web.Modules.Account.Components.Toolbar.UserLoginLink; +using MyCompanyName.MyProjectName.Web.Components.Toolbar.LoginLink; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars; using Volo.Abp.Users; From e33e9062ccadfb684ed7bf3222d62185cd35fbeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 21 Oct 2020 16:44:49 +0300 Subject: [PATCH 5/5] Update Abp-4_0.md --- docs/en/Migration-Guides/Abp-4_0.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/en/Migration-Guides/Abp-4_0.md b/docs/en/Migration-Guides/Abp-4_0.md index a94b3027a6..6b4b1d5096 100644 --- a/docs/en/Migration-Guides/Abp-4_0.md +++ b/docs/en/Migration-Guides/Abp-4_0.md @@ -32,10 +32,6 @@ Also, added `Enabled(string)` and `Description(bool,true)` properties. * Added `AllowedAccessTokenSigningAlgorithms (string)` and `Description (string)` and `ConsumedTime (DateTime?)` properties -#### ApiScope - -* Before it was a property of `ApiResource`, now it becomes an independent aggregate root. - ## Migrating the Database > Attention: **Please backup your database** before the migration! @@ -51,4 +47,4 @@ If you've customize your IdentityServer configuration in the database or in the ### Related Resources * https://leastprivilege.com/2020/06/19/announcing-identityserver4-v4-0/ -* https://github.com/IdentityServer/IdentityServer4/issues/4592 \ No newline at end of file +* https://github.com/IdentityServer/IdentityServer4/issues/4592