From 2a7ee83a50446c1e6e8dbe98b62d46b8a050943c Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 12 Aug 2022 10:43:12 +0800 Subject: [PATCH 1/6] Introduce `AddIdentityServerCookieAuthentication` to `AbpIdentityServerBuilderOptions`. --- .../AbpIdentityServerBuilderOptions.cs | 6 +++ .../AbpIdentityServerDomainModule.cs | 40 +++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderOptions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderOptions.cs index 1927c21746..66a15fd051 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderOptions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerBuilderOptions.cs @@ -27,4 +27,10 @@ public class AbpIdentityServerBuilderOptions /// Set false to suppress AddDeveloperSigningCredential() call on the IIdentityServerBuilder. /// public bool AddDeveloperSigningCredential { get; set; } = true; + + /// + /// Adds the default cookie handlers and corresponding configuration + /// Default: true, Set false to suppress AddCookieAuthentication() call on the IIdentityServerBuilder. + /// + public bool AddIdentityServerCookieAuthentication { get; set; } = true; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index 96ab4abd89..9b9dde5c96 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using IdentityServer4.Configuration; using IdentityServer4.Services; using IdentityServer4.Stores; using Microsoft.Extensions.DependencyInjection; @@ -71,13 +72,7 @@ public class AbpIdentityServerDomainModule : AbpModule var configuration = services.GetConfiguration(); var builderOptions = services.ExecutePreConfiguredActions(); - var identityServerBuilder = services.AddIdentityServer(options => - { - options.Events.RaiseErrorEvents = true; - options.Events.RaiseInformationEvents = true; - options.Events.RaiseFailureEvents = true; - options.Events.RaiseSuccessEvents = true; - }); + var identityServerBuilder = AddIdentityServer(services, builderOptions); if (builderOptions.AddDeveloperSigningCredential) { @@ -110,6 +105,37 @@ public class AbpIdentityServerDomainModule : AbpModule } } + private static IIdentityServerBuilder AddIdentityServer(IServiceCollection services, AbpIdentityServerBuilderOptions abpIdentityServerBuilderOptions) + { + services.Configure(options => + { + options.Events.RaiseErrorEvents = true; + options.Events.RaiseInformationEvents = true; + options.Events.RaiseFailureEvents = true; + options.Events.RaiseSuccessEvents = true; + }); + + var identityServerBuilder = services.AddIdentityServerBuilder() + .AddRequiredPlatformServices() + .AddCoreServices() + .AddDefaultEndpoints() + .AddPluggableServices() + .AddValidators() + .AddResponseGenerators() + .AddDefaultSecretParsers() + .AddDefaultSecretValidators(); + + if (abpIdentityServerBuilderOptions.AddIdentityServerCookieAuthentication) + { + identityServerBuilder.AddCookieAuthentication(); + } + + // provide default in-memory implementation, not suitable for most production scenarios + identityServerBuilder.AddInMemoryPersistedGrants(); + + return identityServerBuilder; + } + public override void PostConfigureServices(ServiceConfigurationContext context) { OneTimeRunner.Run(() => From 1067bdd48fd6036d170125aa0507909f1c70ecd2 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Fri, 12 Aug 2022 09:11:24 +0300 Subject: [PATCH 2/6] Add MAUI doc to navigation bar and update CLI.md --- docs/en/CLI.md | 17 ++++++++++++++--- docs/en/docs-nav.json | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index b5db5fbe2a..65408fff12 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -120,6 +120,7 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample * `--pwa`: Specifies the project as Progressive Web Application. * `blazor-server`: Blazor Server UI. There are some additional options for this template: * `--tiered`: The Identity Server and the API Host project comes as separate projects and run at different endpoints. It has 3 startup projects: *HttpApi.Host*, *AuthServer* and *Blazor* and and each runs on different endpoints. If not specified, you will have a single endpoint for your web project. + * `maui`: .NET MAUI. A minimalist .NET MAUI application will be created if you specify this option. * `none`: Without UI. No front-end layer will be created. There are some additional options for this template: * `--separate-auth-server`: The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server from the API Host application. If not specified, you will have a single endpoint in the server side. * `--mobile` or `-m`: Specifies the mobile application framework. If not specified, no mobile application will be created. Available options: @@ -245,7 +246,7 @@ It can also create a new module for your solution and add it to your solution. S > A business module generally consists of several packages (because of layering, different database provider options or other reasons). Using `add-module` command dramatically simplifies adding a module to a solution. However, each module may require some additional configurations which is generally indicated in the documentation of the related module. -Usage +Usage: ````bash abp add-module [options] @@ -279,7 +280,7 @@ abp add-module ProductManagement --new --add-to-solution-file Lists names of open-source application modules. -Usage +Usage: ````bash abp list-modules [options] @@ -295,11 +296,21 @@ abp list-modules * `--include-pro-modules`: Includes commercial (pro) modules in the output. +### list-templates + +Lists all available templates to create a solution. + +Usage: + +```bash +abp list-templates +``` + ### get-source Downloads the source code of a module to your computer. -Usage +Usage: ````bash abp get-source [options] diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index db63a7136b..f764ca0bf2 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -43,6 +43,10 @@ "text": "WPF Application", "path": "Startup-Templates/WPF.md" }, + { + "text": "MAUI", + "path": "Startup-Templates/MAUI.md" + }, { "text": "Empty Web Project", "path": "Getting-Started-AspNetCore-Application.md" From f0a5ff03bbafda5c26240441cf4e3dc7082430b8 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 12 Aug 2022 15:25:51 +0800 Subject: [PATCH 3/6] update document --- docs/zh-Hans/CLI.md | 1 + docs/zh-Hans/docs-nav.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/zh-Hans/CLI.md b/docs/zh-Hans/CLI.md index f890534795..f108bbcfec 100644 --- a/docs/zh-Hans/CLI.md +++ b/docs/zh-Hans/CLI.md @@ -123,6 +123,7 @@ abp new Acme.BookStore * `module`: [Module template](Startup-Templates/Module.md). 其他选项: * `--no-ui`: 不包含UI.仅创建服务模块(也称为微服务 - 没有UI). * **`console`**: [Console template](Startup-Templates/Console.md). + * **`maui`**: [Maui template](Startup-Templates/MAUI.md). * **`app-nolayers`**: 应用程序单层模板 * `--ui` 或者 `-u`: 指定ui框架.默认`mvc`框架.其他选项: * `mvc`: ASP.NET Core MVC. diff --git a/docs/zh-Hans/docs-nav.json b/docs/zh-Hans/docs-nav.json index 203000c6c6..be30753fb3 100644 --- a/docs/zh-Hans/docs-nav.json +++ b/docs/zh-Hans/docs-nav.json @@ -61,6 +61,10 @@ { "text": "WPF", "path": "Startup-Templates/WPF.md" + }, + { + "text": "MAUI", + "path": "Startup-Templates/MAUI.md" } ] }, From b9ff3dc84b74ad14cc0d67b9b73bedabefdc3a2e Mon Sep 17 00:00:00 2001 From: Engincan VESKE <43685404+EngincanV@users.noreply.github.com> Date: Fri, 12 Aug 2022 10:26:25 +0300 Subject: [PATCH 4/6] Update CLI.md --- docs/en/CLI.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index 65408fff12..c53fb222c3 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -120,7 +120,6 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample * `--pwa`: Specifies the project as Progressive Web Application. * `blazor-server`: Blazor Server UI. There are some additional options for this template: * `--tiered`: The Identity Server and the API Host project comes as separate projects and run at different endpoints. It has 3 startup projects: *HttpApi.Host*, *AuthServer* and *Blazor* and and each runs on different endpoints. If not specified, you will have a single endpoint for your web project. - * `maui`: .NET MAUI. A minimalist .NET MAUI application will be created if you specify this option. * `none`: Without UI. No front-end layer will be created. There are some additional options for this template: * `--separate-auth-server`: The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server from the API Host application. If not specified, you will have a single endpoint in the server side. * `--mobile` or `-m`: Specifies the mobile application framework. If not specified, no mobile application will be created. Available options: @@ -146,7 +145,8 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample * `mongodb`: MongoDB. * `--theme`: Specifes the theme. Default theme is `leptonx-lite`. Available themes: * `leptonx-lite`: [LeptonX Lite Theme](/Themes/LeptonXLite/mvc.md). - * `basic`: [Basic Theme](/UI/AspNetCore/Basic-Theme.md). + * `basic`: [Basic Theme](/UI/AspNetCore/Basic-Theme.md). + * `maui`: .NET MAUI. A minimalist .NET MAUI application will be created if you specify this option. * `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. * `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version. * `--preview`: Use latest preview version. From 3ed8d1b22e6d2968b89c7b6c80cc726f499d7f5f Mon Sep 17 00:00:00 2001 From: Engincan VESKE <43685404+EngincanV@users.noreply.github.com> Date: Fri, 12 Aug 2022 10:27:16 +0300 Subject: [PATCH 5/6] Update CLI.md --- docs/en/CLI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index c53fb222c3..ad5c6d2ab5 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -146,7 +146,7 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample * `--theme`: Specifes the theme. Default theme is `leptonx-lite`. Available themes: * `leptonx-lite`: [LeptonX Lite Theme](/Themes/LeptonXLite/mvc.md). * `basic`: [Basic Theme](/UI/AspNetCore/Basic-Theme.md). - * `maui`: .NET MAUI. A minimalist .NET MAUI application will be created if you specify this option. + * **`maui`**: .NET MAUI. A minimalist .NET MAUI application will be created if you specify this option. * `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. * `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version. * `--preview`: Use latest preview version. From e0b1cb4b2f52603f60261f70f27ffddecbd1f3b0 Mon Sep 17 00:00:00 2001 From: Engincan VESKE <43685404+EngincanV@users.noreply.github.com> Date: Fri, 12 Aug 2022 11:50:38 +0300 Subject: [PATCH 6/6] Update CLI.md --- docs/en/CLI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index ad5c6d2ab5..7a5e59a62a 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -124,7 +124,7 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample * `--separate-auth-server`: The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server from the API Host application. If not specified, you will have a single endpoint in the server side. * `--mobile` or `-m`: Specifies the mobile application framework. If not specified, no mobile application will be created. Available options: * `react-native`: React Native. - * `maui`: MAUI. + * `maui`: MAUI. This mobile option is only available for ABP Commercial. * `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers: * `ef`: Entity Framework Core. * `mongodb`: MongoDB.