@ -0,0 +1,380 @@ |
|||
# ABP.IO Platform 6.0 RC Has Been Released |
|||
|
|||
Today, we are happy to release the [ABP Framework](https://abp.io/) and [ABP Commercial](https://commercial.abp.io/) version **6.0 RC** (release candidate). This blog post introduces the new features and important changes in this new version. |
|||
|
|||
> **The planned release date for the [6.0.0 Stable](https://github.com/abpframework/abp/milestone/71) version is September 06, 2022**. |
|||
|
|||
Try this version and provide feedback for the stable ABP v6.0! Thank you to all. |
|||
|
|||
## Get Started with the 6.0 RC |
|||
|
|||
Follow the steps below to try version 6.0.0 RC today: |
|||
|
|||
1) **Upgrade** the ABP CLI to version `6.0.0-rc.1` using a command line terminal: |
|||
|
|||
````bash |
|||
dotnet tool update Volo.Abp.Cli -g --version 6.0.0-rc.1 |
|||
```` |
|||
|
|||
**or install** it if you haven't before: |
|||
|
|||
````bash |
|||
dotnet tool install Volo.Abp.Cli -g --version 6.0.0-rc.1 |
|||
```` |
|||
|
|||
2) Create a **new application** with the `--preview` option: |
|||
|
|||
````bash |
|||
abp new BookStore --preview |
|||
```` |
|||
|
|||
See the [ABP CLI documentation](https://docs.abp.io/en/abp/latest/CLI) for all the available options. |
|||
|
|||
> You can also use the *Direct Download* tab on the [Get Started](https://abp.io/get-started) page by selecting the **Preview checkbox**. |
|||
|
|||
You can use any IDE that supports .NET 6.x, like **[Visual Studio 2022](https://visualstudio.microsoft.com/downloads/)**. |
|||
|
|||
## Migration Guides |
|||
|
|||
There are breaking changes in this version that may affect your application. |
|||
Please see the following migration documents, if you are upgrading from v5.3.0: |
|||
|
|||
* [ABP Framework 5.3 to 6.0 Migration Guide](https://docs.abp.io/en/abp/6.0/Migration-Guides/Abp-6_0) |
|||
* [ABP Commercial 5.3 to 6.0 Migration Guide](https://docs.abp.io/en/commercial/6.0/migration-guides/v6_0) |
|||
|
|||
## What's New with ABP Framework 6.0? |
|||
|
|||
In this section, I will introduce some major features released in this version. Here is a brief list of titles explained in the next sections: |
|||
|
|||
* **LeptonX Lite** is now the **default theme** for startup templates. |
|||
* Optional PWA support is added to [*Get Started*](https://abp.io/get-started) page. |
|||
* Introducing the **OpenIddict Module** and switching to OpenIddict for the startup templates. |
|||
* New **.NET MAUI** Startup Template. |
|||
* Introducing the `ITransientCachedServiceProvider` interface. |
|||
* Introducing the dynamic components for Blazor UI. |
|||
* Improvements on ABP CLI. |
|||
* Introducing the `Volo.Abp.RemoteServices` package. |
|||
* Create/Update user accounts for external logins. |
|||
* Sending test email in the setting page for MVC and Blazor user interfaces. |
|||
* Improvements on the **eShopOnAbp** project. |
|||
* Other news... |
|||
|
|||
### LeptonX Lite Theme on Startup Templates |
|||
|
|||
 |
|||
|
|||
With this version, startup templates (`app` and `app-nolayers` templates) use the **LeptonX Lite** as the default theme. However, it's still possible to create a project with **Basic Theme** either using the **ABP CLI** or downloading the project via [*Get Started*](https://abp.io/get-started) page on the [abp.io](https://abp.io/) website. |
|||
|
|||
#### via ABP CLI |
|||
|
|||
To create a new project with **Basic Theme**, you can use the `--theme` option as below: |
|||
|
|||
```bash |
|||
abp new Acme.BookStore --theme basic --preview |
|||
``` |
|||
|
|||
#### via Get Started page |
|||
|
|||
Also, you can create a new project with **LeptonX Lite** or **Basic Theme** on *Get Started* page. |
|||
|
|||
 |
|||
|
|||
> The "Preview" checkbox should be checked to be able to see the theme selection section on the *Get Started* page. |
|||
|
|||
|
|||
|
|||
### Optional PWA Support is Added to the Get Started Page |
|||
|
|||
We've introduced the PWA (Progressive Web Application) support for the startup templates for Angular & Blazor WASM UIs in **v5.3**. In this version, we also added this PWA support to the [*Get Started*](https://abp.io/get-started) page on the [abp.io](https://abp.io/) website. |
|||
|
|||
 |
|||
|
|||
If you check the "Progressive Web Application" checkbox while creating an application, the all required configurations will be done for you and you will get the benefit of PWA features in your application. |
|||
|
|||
|
|||
|
|||
### Introducing the **OpenIddict Module** and Switching to OpenIddict in the Startup Templates |
|||
|
|||
We already [announced the plan of replacing the IdentityServer with OpenIddict](https://github.com/abpframework/abp/issues/11989). |
|||
|
|||
Therefore, we have created the `OpenIddict` module in this version and switched to **OpenIddict** in the startup templates. The ABP Framework uses this module to add **OAuth** features to the applications. We created documentation for the **OpenIddict Module**. |
|||
|
|||
- You can see the following document to **learn about the OpenIddict Module**: |
|||
[https://docs.abp.io/en/abp/6.0/Modules/OpenIddict](https://docs.abp.io/en/abp/6.0/Modules/OpenIddict) |
|||
- You can check out the following migration guide to learn **how to migrate to OpenIddict**: |
|||
[https://docs.abp.io/en/abp/6.0/Migration-Guides/IdentityServer_To_OpenIddict](https://docs.abp.io/en/abp/6.0/Migration-Guides/IdentityServer_To_OpenIddict) |
|||
|
|||
|
|||
|
|||
> We will continue to ship Identity Server packages for a while but in the long term, you may need to replace it, because Identity Server support ends at the end of 2022. Please see the [announcement]((https://github.com/abpframework/abp/issues/11989)) for more info. |
|||
|
|||
|
|||
|
|||
### New .NET MAUI Startup Template |
|||
|
|||
 |
|||
|
|||
ABP Framework provides .NET MAUI startup templates with **v6.0.0**. You can create a new .NET MAUI project with the command below: |
|||
|
|||
```bash |
|||
abp new Acme.BookStore -t maui |
|||
``` |
|||
|
|||
|
|||
|
|||
### Introducing the `ITransientCachedServiceProvider` |
|||
|
|||
`ICachedServiceProvider` interface is used to resolve the cached services within a new scope. We created a new interface to resolve cached services **without creating scopes**. It's called `ITransientCachedServiceProvider`. The difference between `ICachedServiceProvider` and `ITransientCachedServiceProvider` is; `ITransientCachedServiceProvider` is transient. Check out [this issue](https://github.com/abpframework/abp/issues/12918) for more information. |
|||
|
|||
|
|||
|
|||
### Introducing the dynamic layout components for Blazor UI |
|||
|
|||
ABP Framework provides different ways of customizing the UI and one of them is to use [Layout Hooks](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Layout-Hooks) in MVC. The **Layout Hook System** allows you to add code to some specific parts of the layout and all layouts of the themes provided by the ABP Framework implement these hooks. |
|||
|
|||
However, Blazor UI doesn't have such a system yet and we are planning to implement [Layout Hooks for the Blazor UI](https://github.com/abpframework/abp/issues/6261) in version 7.0. |
|||
|
|||
We are introducing the dynamic layout components for the Blazor UI to be able to add components to the Blazor layouts. |
|||
|
|||
You can configure the `AbpDynamicLayoutComponentOptions` to render your components in the layout, as below: |
|||
|
|||
```csharp |
|||
Configure<AbpDynamicLayoutComponentOptions>(options => |
|||
{ |
|||
options.Components.Add(typeof(MyBlazorComponent), null); |
|||
}); |
|||
``` |
|||
|
|||
|
|||
|
|||
### Improvements in ABP CLI |
|||
|
|||
There are some enhancements in [ABP CLI](https://docs.abp.io/en/abp/6.0/CLI). You can see the brief list of some of these improvements below: |
|||
|
|||
* You can list all available templates by using the `abp list-templates` command with v6.0. See [#13083](https://github.com/abpframework/abp/pull/13083). |
|||
* You can select the theme when creating a new project by specifying the `--theme` option. You can see the *LeptonX Lite Theme on the Startup Templates* section above for an example. |
|||
* `abp update` command has been updating the version of the main application until now. With v6.0.0, this command updates all package versions **inside all solutions in the sub-folders**. Checkout the issue [#12735](https://github.com/abpframework/abp/pull/12738) for more information. |
|||
|
|||
|
|||
|
|||
### Introducing the `Volo.Abp.RemoteService` Package |
|||
|
|||
A new `Volo.Abp.RemoteService` package has been added to the framework. Some of the classes that are related to the remote service configurations such as `AbpRemoteServiceOptions` class moved from `Volo.Abp.Http.Client` to this package. In this way, it became more reusable for further usages. |
|||
|
|||
|
|||
|
|||
### Create/Update User Accounts For External Logins |
|||
|
|||
If a user authenticates from an external provider like `Keycloak`, the user is being redirected to this external provider, and comes back to the main application. In this process, the user's data is not being saved in the main application's database. With this version, ABP saves the user information and lists in the users page. And this fixes permission management, user information mismatches and other issues. For more info, see [the related issue](https://github.com/abpframework/abp/issues/12203). |
|||
|
|||
|
|||
|
|||
### Sending test email in the setting page for MVC and Blazor UIs |
|||
|
|||
"Sending Test Email" feature is added to the [Setting Management](https://docs.abp.io/en/abp/6.0/Modules/Setting-Management) module, which allows checking the email settings are configured properly and sending emails successfully to the target email address. |
|||
|
|||
 |
|||
|
|||
After configuring the email settings such as the target email address, you can click the "Send" button to send a test email to see if everything went well. |
|||
|
|||
> Note that this feature will be implemented for the Angular UI in the stable v6.0. |
|||
|
|||
|
|||
|
|||
### Improvements on eShopOnAbp Project |
|||
|
|||
The following improvements have been made on [eShopOnAbp project](https://github.com/abpframework/eShopOnAbp) with this version: |
|||
|
|||
* Some improvements have been made on the Admin Application for Order Management for Angular UI. See [#110](https://github.com/abpframework/eShopOnAbp/pull/110). |
|||
* `SignalR` error on Kubernetes & Docker Compose has been fixed. See [#113](https://github.com/abpframework/eShopOnAbp/pull/113). |
|||
* eShopOnAbp project has been deployed to Azure Kubernetes Service. See [#114](https://github.com/abpframework/eShopOnAbp/pull/114). The live demo can be seen from [eshoponabp.com](https://eshoponabp.com/). |
|||
* Configurations have been made for some services on the `docker-compose.yml` file. See [#112](https://github.com/abpframework/eShopOnAbp/pull/112). |
|||
* Gateway Redirect Loop problem on Kubernetes has been fixed. See [the commit](https://github.com/abpframework/eShopOnAbp/commit/6413ef15c91cd8a5309050b63bb4dbca23587607). |
|||
|
|||
|
|||
|
|||
### Other News |
|||
|
|||
* Autofac library has been upgraded to **v6.4.0**. Please see [#12816](https://github.com/abpframework/abp/pull/12816) for more info. |
|||
* Performance Improvements have been made in the **Settings Module** and tabs on the *Settings* page are lazy loading now. |
|||
* Some improvements have been made in the CMS Kit Module. You can see the improvements from [here](https://github.com/abpframework/abp/issues/11965). |
|||
|
|||
If you want to see more details, you can check [the release on GitHub](https://github.com/abpframework/abp/releases/tag/6.0.0-rc.1), which contains a list of all the issues and pull requests closed in this version. |
|||
|
|||
|
|||
|
|||
## What's New with ABP Commercial 6.0? |
|||
|
|||
|
|||
|
|||
### LeptonX Theme is the Default Theme |
|||
|
|||
With this version, the startup templates (`app-pro`, `app-nolayers-pro` and `microservice-pro` templates) use the **LeptonX Theme** as the default theme. However, it's still possible to create a new project with **Lepton Theme** or **Basic Theme**, either using the **ABP CLI** or **ABP Suite**. |
|||
|
|||
#### via ABP CLI |
|||
|
|||
To create a new project with **Lepton Theme** or **Basic Theme**, you can use the `--theme` option as below. For "Basic Theme" specify the theme name as `--theme basic`. |
|||
|
|||
```bash |
|||
abp new Acme.BookStore --theme lepton --preview |
|||
``` |
|||
|
|||
|
|||
|
|||
#### via ABP Suite |
|||
|
|||
Also, you can create a new project with **Lepton Theme** or **Basic Theme** from ABP Suite. |
|||
|
|||
 |
|||
|
|||
### Switching to OpenIddict in the Startup Templates |
|||
|
|||
We have also switched to the **OpenIddict** for the startup templates for ABP Commercial as explained above. |
|||
|
|||
|
|||
|
|||
### New .NET MAUI Mobile |
|||
|
|||
 |
|||
|
|||
ABP Commercial has been providing a [React Native](https://docs.abp.io/en/commercial/latest/getting-started-react-native) mobile app since with the very early versions. Alternative to this application, we created a new .NET MAUI mobile app. To create a new `app-pro` ABP project with the .NET MAUI mobile app, you can use the command below: |
|||
|
|||
```bash |
|||
abp new Acme.BookStore -t app-pro --mobile maui |
|||
``` |
|||
|
|||
> Note that, when Microsoft supports `WebAuthenticator` on Windows, we'll also support it to work on Windows OS. |
|||
|
|||
|
|||
|
|||
### GDPR: Cookie Consent |
|||
|
|||
 |
|||
|
|||
With this version, the **Cookie Consent** feature has been added to the **GDPR** module. It's enabled by default for the new startup templates. There are two pages in the templates: "Cookie Policy" page and "Privacy Policy" page. |
|||
|
|||
If you want to disable/hide the "Cookie Consent", you can simply open the startup project module class and set the `IsEnabled` property as **false** for the **AddAbpCookieConsent** method as below: |
|||
|
|||
```csharp |
|||
context.Services.AddAbpCookieConsent(options => |
|||
{ |
|||
options.IsEnabled = false; //disabled |
|||
options.CookiePolicyUrl = "/CookiePolicy"; |
|||
options.PrivacyPolicyUrl = "/PrivacyPolicy"; |
|||
}); |
|||
``` |
|||
|
|||
> These pages are used to build up the cookie consent text and you can change the content or url of these pages by your needs. |
|||
|
|||
If you want to use the Cookie Consent feature of the GDPR module in your existing project, please see the [GDPR Module](https://docs.abp.io/en/commercial/6.0/modules/gdpr) documentation for configurations. |
|||
|
|||
### Improvements/Developments on CMS Kit Poll |
|||
|
|||
Some improvements have been made on the Poll System of CMS Kit module as listed below: |
|||
|
|||
* The Widget rendering and Admin side for the Blazor UI improvements. |
|||
* A Widget can be picked from the editor as seen in the image below. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
### Blazor UI for the Chat Module |
|||
|
|||
Chat Module is now also available for the Blazor UI after the MVC and Angular UIs. You can read the [Chat Module](https://docs.abp.io/en/commercial/6.0/modules/chat) documentation to get the overall knowledge about the module and add to your application. |
|||
|
|||
 |
|||
 |
|||
|
|||
|
|||
|
|||
### Blazor Admin UI for CMS Kit Module |
|||
|
|||
All admin side **CMS Kit** and **CMS Kit Pro** features have been implemented for the Blazor UI. Blazor UI will only be available to ABP Commercial customers. |
|||
|
|||
 |
|||
|
|||
 |
|||
|
|||
|
|||
### Suite: Excel Export |
|||
|
|||
With v6.0, now it's possible to export the records as Excel for Blazor & MVC UIs. Angular UI is still in-progress, and we will implement it with the stable v6.0 release. Check the "Excel export" checkbox to add this feature. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
A new Excel Export button is being located at the top of the generated page as seen below: |
|||
|
|||
 |
|||
|
|||
Then, you can download the records as `.xlsx` format by clicking the "Excel Export" button. Note that the exported Excel list is the filtered list. |
|||
|
|||
|
|||
|
|||
### ABP Suite: Optional PWA Support |
|||
|
|||
With this version, it's possible to add the [PWA (Progressive Web App)](https://web.dev/progressive-web-apps/?gclid=Cj0KCQjwxIOXBhCrARIsAL1QFCY0IB-W5k-lsXmRCbm00sl4nyBIYynAX3IdJkjyizyNUjuCE8zeu24aApxtEALw_wcB) support for Blazor & Angular UIs while creating the application via Suite. |
|||
|
|||
 |
|||
|
|||
You just need to check the "Progressive web application" checkbox, when creating a new application. Then, ABP Suite will add the PWA support to your application. When you publish your application, you get the full benefits of PWA features such as offline support. |
|||
|
|||
|
|||
|
|||
### Other News |
|||
|
|||
#### Explainer Videos |
|||
|
|||
We are creating explainer videos for the ABP Commercial Modules to provide an overview. Within this milestone, we've created four new explainer videos: |
|||
|
|||
* [Audit Logging Module](https://www.youtube.com/watch?v=NzSuFBpqfsc) |
|||
* [Identity Module](https://www.youtube.com/watch?v=W87jA_GBE54) |
|||
* [SaaS Module](https://www.youtube.com/watch?v=xXlaaXP6qqQ) |
|||
* [Forms Module](https://www.youtube.com/watch?v=MousWEPfrA8) |
|||
|
|||
You can subscribe to [Volosoft's YouTube channel](https://www.youtube.com/channel/UCO3XKlpvq8CA5MQNVS6b3dQ) to be informed about the future ABP events and videos. |
|||
|
|||
|
|||
|
|||
### Trial License is now available! |
|||
|
|||
 |
|||
|
|||
If you are considering purchasing a new ABP Commercial license, and you want to see ABP in action then, check out https://commercial.abp.io/pricing and click FREE TRIAL button. |
|||
|
|||
|
|||
|
|||
## Community News |
|||
|
|||
### New ABP Community Posts |
|||
|
|||
* [Alper Ebicoglu](https://twitter.com/alperebicoglu) has created a new community article to give a full overview of .NET MAUI. You can read it [here](https://community.abp.io/posts/all-about-.net-maui-gb4gkdg5). |
|||
* [Anto Subash](https://twitter.com/antosubash) has created a new video content to show "State Management in Blazor with Fluxor". You can read it [here](https://community.abp.io/posts/blazor-state-management-with-fluxor-raskpv19). |
|||
* [Learn ABP Framework](https://community.abp.io/members/learnabp) has also created a new video content to show "How to install LeptonX Lite Theme for ABP Framework 5.3 MVC UI". You can read it [here](https://community.abp.io/posts/how-to-install-leptonx-lite-theme-on-abp-framework-5.3-mvc-ui-epzng137). |
|||
* [Kirti Kulkarni](https://twitter.com/kirtimkulkarni) has created three new community articles. You can use the links below to read the articles: |
|||
* [Integrating the file management module with ABP Commercial application](https://community.abp.io/posts/integrating-the-file-management-module-with-abp-commercial-application-qd6v4dsr) |
|||
* [Work with PDF's in ABP Commercial Project using PDFTron](https://community.abp.io/posts/work-with-pdfs-in-abp-commercial-project-using-pdftron-tjw0hlgu) |
|||
* [Create a custom login page in ABP Commercial Angular app](https://community.abp.io/posts/create-a-custom-login-page-in-abp-commercial-angular-app-r2huidx7) |
|||
* [Don Boutwell](https://community.abp.io/members/dboutwell) has created his first ABP Community article. You can read it from [here](https://community.abp.io/posts/password-required-redis-with-abp-framework-and-docker-94old5rm). |
|||
|
|||
|
|||
|
|||
### Volosoft Has Attended the DNF Summit 2022 |
|||
|
|||
 |
|||
|
|||
Core team members of ABP Framework, [Halil Ibrahim Kalkan](https://twitter.com/hibrahimkalkan) and [Alper Ebicoglu](https://twitter.com/alperebicoglu) have attended the [DNF Summit](https://t.co/ngWnBLiAn5) on the 20th of July. Halil Ibrahim Kalkan talked about the creation of the ABP Framework and Alper Ebicoglu showed how easy to create a project with ABP Framework within 15 minutes. |
|||
|
|||
Watch DNF Summit session 👉 https://www.youtube.com/embed/VL0ewZ-0ruo |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## Conclusion |
|||
|
|||
This version comes with some features and enhancements to the existing features. You can see the [Road Map](https://docs.abp.io/en/abp/6.0/Road-Map) documentation to learn about the release schedule and planned features for the next releases. The planned release date for the [6.0.0 Stable](https://github.com/abpframework/abp/milestone/71) version is September 06, 2022. Please try the ABP v6.0 RC and provide feedback to us. |
|||
|
|||
Thanks for being a part of this community! |
|||
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 345 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 37 KiB |
@ -0,0 +1,29 @@ |
|||
# ABP Version 6.0 Migration Guide |
|||
|
|||
This document is a guide for upgrading ABP v5.3 solutions to ABP v6.0. There is a change in this version that may affect your applications, please read it carefully and apply the necessary changes to your application. |
|||
|
|||
## Added IsActive property |
|||
|
|||
`IsActive` property is added to `IUserData`. This property is set to **true** by default. **Cmskit** and **Blog** modules are affected by this change. You need to add new migration to your existing application if you are using any of these modules. Please see [#11417](https://github.com/abpframework/abp/pull/11417) for more info. |
|||
|
|||
## Default behavior change in MultiTenancyMiddlewareErrorPageBuilder |
|||
|
|||
If you have customized the `MultiTenancyMiddlewareErrorPageBuilder` of `AbpMultiTenancyOptions`, the pipeline now returns **true** to stop the pipeline as the default behavior. See [AbpMultiTenancyOptions: Handle inactive and non-existent tenants](https://github.com/abpframework/abp/blob/dev/docs/en/Multi-Tenancy.md#abpmultitenancyoptions-handle-inactive-and-non-existent-tenants) for more info. |
|||
|
|||
## Migrating to LeptonX Lite |
|||
|
|||
LeptonX Lite is now being introduced and you can follow the guides below to migrate your existing applications: |
|||
|
|||
- [Migrating to LeptonX MVC UI](../themes/LeptonXLite/AspNetCore.md) |
|||
- [Migrating to LeptonX Angular UI](../themes/LeptonXLite/angular.md) |
|||
- [Migrating to LeptonX Blazor UI](../themes/LeptonXLite/blazor.md) |
|||
|
|||
## Migrating to OpenIddict |
|||
|
|||
After the [announcement of plan to replace the IdentityServer](https://github.com/abpframework/abp/issues/11989), we have successfully implemented [Openiddict](https://github.com/openiddict/openiddict-core) as a replacement for IdentityServer4 as an OpenID-Provider. |
|||
|
|||
You can follow the [IdentityServer to OpenIddict Step by Step Guide](OpenIddict-Step-by-Step.md) for migrating your existing application in detail with a sample projects. |
|||
|
|||
## See Also |
|||
|
|||
* [Official blog post for the 6.0 release](https://blog.abp.io/abp/ABP.IO-Platform-6.0-RC-Has-Been-Published) |
|||
@ -0,0 +1,78 @@ |
|||
# Migration Identity Server to OpenIddict Guide |
|||
|
|||
This document explains how to migrate to [OpenIddict](https://github.com/openiddict/openiddict-core) from Identity Server. From now on the ABP startup templates uses `OpenIddict` as the auth server by default since version v6.0.0. |
|||
|
|||
## History |
|||
We are not removing Identity Server packages and we will continue to release new versions of Identity Server related NuGet/NPM packages. That means you won't have an issue while upgrading to v6.0 when the stable version releases. We will continue to fix bugs in our packages for a while. ABP 7.0 will be based on .NET 7. If Identity Server continues to work with .NET 7, we will also continue to ship NuGet packages for our IDS integration. |
|||
|
|||
On the other hand, Identity Server ends support for the open-source Identity Server in the end of 2022. The Identity Server team has decided to move to Duende IDS and ABP will not be migrated to the commercial Duende IDS. You can see the Duende Identity Server announcement from [this link](https://blog.duendesoftware.com/posts/20220111_fair_trade). |
|||
|
|||
## OpenIddict Migration Steps |
|||
|
|||
* Update all `Volo's` packages to `6.x`. |
|||
* Replace all `Volo's` `IdentityServer.*` packages with corresponding `OpenIddict.*` packages. eg `Volo.Abp.IdentityServer.Domain` to `Volo.Abp.OpenIddict.Domain`, `Volo.Abp.Account.Web.IdentityServer` to `Volo.Abp.Account.Web.OpenIddict`. |
|||
* Replace all `IdentityServer` modules with corresponding `OpenIddict` modules. eg `AbpIdentityServerDomainModule` to `AbpOpenIddictDomainModule`, `AbpAccountWebIdentityServerModule` to `AbpAccountWebOpenIddictModule`. |
|||
* Rename the `ConfigureIdentityServer` to `ConfigureOpenIddict` in your `ProjectNameDbContext` class. |
|||
* Remove the `UseIdentityServer` and add `UseAbpOpenIddictValidation` after `UseAuthentication`. |
|||
* Add follow code to your startup module. |
|||
|
|||
```cs |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("ProjectName"); // Change ProjectName to your project name. |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
* If your project is not separate AuthServer please also add `ForwardIdentityAuthenticationForBearer` |
|||
|
|||
```cs |
|||
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
``` |
|||
|
|||
* Remove the `IdentityServerDataSeedContributor` from the `Domain` project. |
|||
* Create a new version of the project, with the same name as your existing project. |
|||
* Copy the `ProjectName.Domain\OpenIddict\OpenIddictDataSeedContributor.cs` of new project into your project and update `appsettings.json` base on `ProjectName.DbMigrator\appsettings.json`, Be careful to change the port number. |
|||
* Copy the `Index.cshtml.cs` and `Index.cs` of new project to your project if you're using `IClientRepository` in `IndexModel`. |
|||
* Update the scope name from `role` to `roles` in `AddAbpOpenIdConnect` method. |
|||
* Remove `options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` from `HttpApi.Host` project. |
|||
* AuthServer no longer requires `JWT bearer authentication`. Please remove it. eg `AddJwtBearer` and `UseJwtTokenMiddleware`. |
|||
* Try compiling the project in the IDE and following the errors to remove and reference the code and namespaces. |
|||
* Add migrations and update the database if you are using EF Core as the database provider. |
|||
|
|||
## Module packages |
|||
### Open source side |
|||
* Volo.Abp.OpenIddict.Domain (`AbpOpenIddictDomainModule`) |
|||
* Volo.Abp.OpenIddict.Domain.Shared (`AbpOpenIddictDomainSharedModule`) |
|||
* Volo.Abp.OpenIddict.EntityFrameworkCore (`AbpOpenIddictEntityFrameworkCoreModule`) |
|||
* Volo.Abp.OpenIddict.AspNetCore (`AbpOpenIddictAspNetCoreModule`) |
|||
* Volo.Abp.OpenIddict.MongoDB (`AbpOpenIddictMongoDbModule`) |
|||
* Volo.Abp.Account.Web.OpenIddict (`AbpAccountWebOpenIddictModule`) |
|||
* Volo.Abp.PermissionManagement.Domain.OpenIddict (`AbpPermissionManagementDomainOpenIddictModule`) |
|||
|
|||
### Commercial side |
|||
* Volo.Abp.OpenIddict.Pro.Application.Contracts (`AbpOpenIddictProApplicationContractsModule`) |
|||
* Volo.Abp.OpenIddict.Pro.Application (`AbpOpenIddictProApplicationModule`) |
|||
* Volo.Abp.OpenIddict.Pro.HttpApi.Client (`AbpOpenIddictProHttpApiClientModule`) |
|||
* Volo.Abp.OpenIddict.Pro.HttpApi (`AbpOpenIddictProHttpApiModule`) |
|||
* Volo.Abp.OpenIddict.Pro.Blazor(`AbpOpenIddictProBlazorModule`) |
|||
* Volo.Abp.OpenIddict.Pro.Blazor.Server (`AbpOpenIddictProBlazorServerModule`) |
|||
* Volo.Abp.OpenIddict.Pro.Blazor.WebAssembly (`AbpOpenIddictProBlazorWebAssemblyModule`) |
|||
* Volo.Abp.OpenIddict.Pro.Web (`AbpOpenIddictProWebModule`) |
|||
|
|||
## Source code of samples and module |
|||
|
|||
* [Open source tiered & separate auth server application migrate Identity Server to OpenIddct](https://github.com/abpframework/abp-samples/tree/master/Ids2OpenId) |
|||
* [Commercial tiered & separate auth server application migrate Identity Server to OpenIddct](https://abp.io/Account/Login?returnUrl=/api/download/samples/Ids2OpenId) |
|||
* [OpenIddict module document](https://docs.abp.io/en/abp/6.0/Modules/OpenIddict) |
|||
* [OpenIddict module source code](https://github.com/abpframework/abp/tree/rel-6.0/modules/openiddict) |
|||
@ -0,0 +1,170 @@ |
|||
# OpenIddict Angular UI Migration Guide |
|||
|
|||
## Angular Project |
|||
|
|||
- In `environment.ts` and `environment.prod.ts` **add a trailing slash at the end of the issuer**: |
|||
|
|||
```typescript |
|||
oAuthConfig: { |
|||
issuer: 'https://localhost:44377/', |
|||
... |
|||
}, |
|||
``` |
|||
|
|||
## Http.Api.Host (Non-Separated IdentityServer) |
|||
|
|||
- In **MyApplication.HttpApi.Host.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="6.0.0-rc.1" /> |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
|||
... |
|||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using OpenIddict.Validation.AspNetCore; |
|||
... |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `ConfigureServices` method, **replace the method call**: |
|||
|
|||
From `ConfigureAuthentication(context, configuration);` to `ConfigureAuthentication(context);` and update the method as: |
|||
|
|||
```csharp |
|||
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `OnApplicationInitialization` method, **replace the midware**: |
|||
|
|||
```csharp |
|||
app.UseJwtTokenMiddleware(); |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
app.UseAbpOpenIddictValidation(); |
|||
``` |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `OnApplicationInitialization` method, delete `c.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` in `app.UseAbpSwaggerUI` options configurations which is no longer needed. |
|||
|
|||
- In `appsettings.json` delete **SwaggerClientSecret** from the *AuthServer* section like below: |
|||
|
|||
```json |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44345", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "MyApplication_Swagger" |
|||
}, |
|||
``` |
|||
|
|||
## Http.Api.Host (Separated IdentityServer) |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `OnApplicationInitialization` method, delete `c.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` in `app.UseAbpSwaggerUI` options configurations which is no longer needed. |
|||
|
|||
- In `appsettings.json` delete **SwaggerClientSecret** from the *AuthServer* section like below: |
|||
|
|||
```json |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44345", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "MyApplication_Swagger" |
|||
}, |
|||
``` |
|||
|
|||
## IdentityServer |
|||
|
|||
This project is renamed to **AuthServer** after v6.0.0-rc1. You can also refactor and rename your project to *AuthServer* for easier updates in the future. |
|||
|
|||
- In **MyApplication.IdentityServer.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** `OnApplicationInitialization` method, **remove the midware**: |
|||
|
|||
```csharp |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
- To use the new AuthServer page, replace **Index.cshtml.cs** with [AuthServer Index.cshtml.cs](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml) and **Index.cshtml** file with [AuthServer Index.cshtml](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml.cs) and rename **Ids2OpenId** with your application namespace. |
|||
|
|||
> Note: It can be found under the *Pages* folder. |
|||
|
|||
## See Also |
|||
|
|||
* [OpenIddict Step-by-Step Guide](OpenIddict-Step-by-Step.md) |
|||
@ -0,0 +1,175 @@ |
|||
# OpenIddict Blazor-Server UI Migration Guide |
|||
|
|||
## Blazor Project (Non-Tiered Solution) |
|||
|
|||
- In the **MyApplication.Blazor.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="6.0.0-rc.1" /> |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using System; |
|||
using System.Net.Http; |
|||
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
|||
... |
|||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using OpenIddict.Validation.AspNetCore; |
|||
... |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** `ConfigureServices` method, **replace the method call**: |
|||
|
|||
From `ConfigureAuthentication(context, configuration);` to `ConfigureAuthentication(context);` and update the method as: |
|||
|
|||
```csharp |
|||
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** `OnApplicationInitialization` method, **replace the midware**: |
|||
|
|||
```csharp |
|||
app.UseJwtTokenMiddleware(); |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
app.UseAbpOpenIddictValidation(); |
|||
``` |
|||
|
|||
## Blazor Project (Tiered Solution) |
|||
|
|||
- In the **MyApplicationWebModule.cs** update the `AddAbpOpenIdConnect` configurations: |
|||
|
|||
```csharp |
|||
.AddAbpOpenIdConnect("oidc", options => |
|||
{ |
|||
options.Authority = configuration["AuthServer:Authority"]; |
|||
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]); |
|||
options.ResponseType = OpenIdConnectResponseType.CodeIdToken; |
|||
|
|||
options.ClientId = configuration["AuthServer:ClientId"]; |
|||
options.ClientSecret = configuration["AuthServer:ClientSecret"]; |
|||
|
|||
options.SaveTokens = true; |
|||
options.GetClaimsFromUserInfoEndpoint = true; |
|||
|
|||
options.Scope.Add("roles"); // Replace "role" with "roles" |
|||
options.Scope.Add("email"); |
|||
options.Scope.Add("phone"); |
|||
options.Scope.Add("MyApplication"); |
|||
}); |
|||
``` |
|||
|
|||
Replace **role** scope with **roles**. |
|||
|
|||
## IdentityServer |
|||
|
|||
This project is renamed to **AuthServer** after v6.0.0-rc1. You can also refactor and rename your project to *AuthServer* for easier updates in the future. |
|||
|
|||
- In **MyApplication.IdentityServer.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationIdentityServerModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In **MyApplicationIdentityServerModule.cs** `OnApplicationInitialization` method **remove IdentityServer midware**: |
|||
|
|||
```csharp |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
## Http.Api.Host |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `OnApplicationInitialization` method, delete `c.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` in `app.UseAbpSwaggerUI` options configurations which is no longer needed. |
|||
|
|||
- In `appsettings.json` delete **SwaggerClientSecret** from the *AuthServer* section like below: |
|||
|
|||
```json |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44345", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "MyApplication_Swagger" |
|||
}, |
|||
``` |
|||
|
|||
- To use the new AuthServer page, replace **Index.cshtml.cs** with [AuthServer Index.cshtml.cs](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml) and **Index.cshtml** file with [AuthServer Index.cshtml](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml.cs) and rename **Ids2OpenId** with your application namespace. |
|||
|
|||
> Note: It can be found under the *Pages* folder. |
|||
|
|||
## See Also |
|||
|
|||
* [OpenIddict Step-by-Step Guide](OpenIddict-Step-by-Step.md) |
|||
@ -0,0 +1,189 @@ |
|||
# OpenIddict Blazor Wasm UI Migration Guide |
|||
|
|||
## Blazor Project |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** update the `ConfigureAuthentication` method: |
|||
|
|||
```csharp |
|||
builder.Services.AddOidcAuthentication(options => |
|||
{ |
|||
... |
|||
options.UserOptions.RoleClaim = JwtClaimTypes.Role; |
|||
|
|||
options.ProviderOptions.DefaultScopes.Add("role"); |
|||
... |
|||
}); |
|||
``` |
|||
|
|||
Update **UserOptions** and **role scope** as below |
|||
|
|||
```csharp |
|||
builder.Services.AddOidcAuthentication(options => |
|||
{ |
|||
... |
|||
options.UserOptions.NameClaim = OpenIddictConstants.Claims.Name; |
|||
options.UserOptions.RoleClaim = OpenIddictConstants.Claims.Role; |
|||
|
|||
options.ProviderOptions.DefaultScopes.Add("roles"); |
|||
... |
|||
}); |
|||
``` |
|||
|
|||
## Http.Api.Host (Non-Separated IdentityServer) |
|||
|
|||
- In the **MyApplication.HttpApi.Host.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="6.0.0-rc.1" /> |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using System.Net.Http; |
|||
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
|||
... |
|||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using OpenIddict.Validation.AspNetCore; |
|||
... |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** `ConfigureServices` method, **replace the method call**: |
|||
|
|||
From `ConfigureAuthentication(context, configuration);` to `ConfigureAuthentication(context);` and update the method as: |
|||
|
|||
```csharp |
|||
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationBlazorModule.cs** `OnApplicationInitialization` method, **replace the midware**: |
|||
|
|||
```csharp |
|||
app.UseJwtTokenMiddleware(); |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
app.UseAbpOpenIddictValidation(); |
|||
``` |
|||
|
|||
- Delete `c.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` in `app.UseAbpSwaggerUI` options configurations which is no longer needed. |
|||
|
|||
- In `appsettings.json` delete **SwaggerClientSecret** from the *AuthServer* section like below: |
|||
|
|||
```json |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44345", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "MyApplication_Swagger" |
|||
}, |
|||
``` |
|||
|
|||
## Http.Api.Host (Separated IdentityServer) |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `OnApplicationInitialization` method, delete `c.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` in `app.UseAbpSwaggerUI` options configurations which is no longer needed. |
|||
|
|||
- In `appsettings.json` delete **SwaggerClientSecret** from the *AuthServer* section like below: |
|||
|
|||
```json |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44345", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "MyApplication_Swagger" |
|||
}, |
|||
``` |
|||
|
|||
## IdentityServer |
|||
|
|||
This project is renamed to **AuthServer** after v6.0.0-rc1. You can also refactor and rename your project to *AuthServer* for easier updates in the future. |
|||
|
|||
- In **MyApplication.IdentityServer.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** `OnApplicationInitialization` method, **remove the midware**: |
|||
|
|||
```csharp |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
- To use the new AuthServer page, replace **Index.cshtml.cs** with [AuthServer Index.cshtml.cs](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml) and **Index.cshtml** file with [AuthServer Index.cshtml](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml.cs) and rename **Ids2OpenId** with your application namespace. |
|||
|
|||
> Note: It can be found under the *Pages* folder. |
|||
|
|||
## See Also |
|||
|
|||
* [OpenIddict Step-by-Step Guide](OpenIddict-Step-by-Step.md) |
|||
@ -0,0 +1,166 @@ |
|||
# OpenIddict MVC/Razor UI Migration Guide |
|||
|
|||
## Web Project (Non-Tiered Solution) |
|||
|
|||
- In **MyApplication.Web.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="6.0.0-rc.1" /> |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationWebModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
|||
... |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebModule), |
|||
``` |
|||
|
|||
- In **MyApplicationWebModule.cs** `ConfigureServices` method **update authentication configuration**: |
|||
|
|||
```csharp |
|||
ConfigureAuthentication(context, configuration); |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
ConfigureAuthentication(context); |
|||
``` |
|||
|
|||
and update the `ConfigureAuthentication` private method to: |
|||
|
|||
```csharp |
|||
private void ConfigureAuthentication(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
``` |
|||
|
|||
- In **MyApplicationWebModule.cs** `OnApplicationInitialization` method **replace IdentityServer and JwtToken midwares**: |
|||
|
|||
```csharp |
|||
app.UseJwtTokenMiddleware(); |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
app.UseAbpOpenIddictValidation(); |
|||
``` |
|||
|
|||
|
|||
## Web Project (Tiered Solution) |
|||
|
|||
- In the **MyApplicationWebModule.cs** update the `AddAbpOpenIdConnect` configurations: |
|||
|
|||
```csharp |
|||
.AddAbpOpenIdConnect("oidc", options => |
|||
{ |
|||
options.Authority = configuration["AuthServer:Authority"]; |
|||
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]); |
|||
options.ResponseType = OpenIdConnectResponseType.CodeIdToken; |
|||
|
|||
options.ClientId = configuration["AuthServer:ClientId"]; |
|||
options.ClientSecret = configuration["AuthServer:ClientSecret"]; |
|||
|
|||
options.UsePkce = true; // Add this line |
|||
options.SaveTokens = true; |
|||
options.GetClaimsFromUserInfoEndpoint = true |
|||
|
|||
options.Scope.Add("roles"); // Replace "role" with "roles" |
|||
options.Scope.Add("email"); |
|||
options.Scope.Add("phone"); |
|||
options.Scope.Add("MyApplication"); |
|||
}); |
|||
``` |
|||
|
|||
Replace role scope to **roles** and add **UsePkce** and **SignoutScheme** options. |
|||
|
|||
## IdentityServer |
|||
|
|||
This project is renamed to **AuthServer** after v6.0.0-rc1. You can also refactor and rename your project to *AuthServer* for easier updates in the future. |
|||
|
|||
- In **MyApplication.IdentityServer.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.Account.Web.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationIdentityServerModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
typeof(AbpAccountWebOpenIddictModule), |
|||
``` |
|||
|
|||
- In the **MyApplicationIdentityServerModule.cs** add `PreConfigureServices` like below with your application name as the audience: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictBuilder>(builder => |
|||
{ |
|||
builder.AddValidation(options => |
|||
{ |
|||
options.AddAudiences("MyApplication"); // Replace with your application name |
|||
options.UseLocalServer(); |
|||
options.UseAspNetCore(); |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
- In **MyApplicationIdentityServerModule.cs** `OnApplicationInitialization` method **remove IdentityServer midware**: |
|||
|
|||
```csharp |
|||
app.UseIdentityServer(); |
|||
``` |
|||
|
|||
- To use the new AuthServer page, replace **Index.cshtml.cs** with [AuthServer Index.cshtml.cs](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml) and **Index.cshtml** file with [AuthServer Index.cshtml](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.IdentityServer/Pages/Index.cshtml.cs) and rename **Ids2OpenId** with your application namespace. |
|||
|
|||
> Note: It can be found under the *Pages* folder. |
|||
|
|||
## Http.Api.Host |
|||
|
|||
- In the **MyApplicationHttpApiHostModule.cs** `OnApplicationInitialization` method, delete `c.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);` in `app.UseAbpSwaggerUI` options configurations which is no longer needed. |
|||
|
|||
- In `appsettings.json` delete **SwaggerClientSecret** from the *AuthServer* section like below: |
|||
|
|||
```json |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44345", |
|||
"RequireHttpsMetadata": "false", |
|||
"SwaggerClientId": "MyApplication_Swagger" |
|||
}, |
|||
``` |
|||
|
|||
## See Also |
|||
|
|||
* [OpenIddict Step-by-Step Guide](OpenIddict-Step-by-Step.md) |
|||
@ -0,0 +1,229 @@ |
|||
# Migrating from IdentityServer to OpenIddict Step by Step Guide |
|||
|
|||
This guide provides layer-by-layer guidance for migrating your existing application to [OpenIddict](https://github.com/openiddict/openiddict-core) from IdentityServer. ABP startup templates use `OpenIddict` OpenId provider from v6.0.0-rc1 by default and `IdentityServer` projects are renamed to `AuthServer` in tiered/separated solutions. Since OpenIddict is only available with ABP v6.0, you will need to update your existing application in order to apply OpenIddict changes. |
|||
|
|||
## History |
|||
We are not removing Identity Server packages and we will continue to release new versions of IdentityServer-related NuGet/NPM packages. That means you won't have an issue while upgrading to v6.0 when the stable version releases. We will continue to fix bugs in our packages for a while. ABP 7.0 will be based on .NET 7. If Identity Server continues to work with .NET 7, we will also continue to ship NuGet packages for our IDS integration. |
|||
|
|||
On the other hand, Identity Server ends support for the open-source Identity Server at the end of 2022. The Identity Server team has decided to move to Duende IDS and ABP will not be migrated to the commercial Duende IDS. You can see the Duende Identity Server announcement from [this link](https://blog.duendesoftware.com/posts/20220111_fair_trade). |
|||
|
|||
## OpenIddict Migration Steps |
|||
|
|||
Use the `abp update` command to update your existing application. See [Upgrading docs](../Upgrading.md) for more info. Apply required migrations by following the [Migration Guides](Index.md) based on your application version. |
|||
|
|||
### Domain.Shared Layer |
|||
|
|||
- In **MyApplication.Domain.Shared.csproj** replace **project reference**: |
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="6.0.0-rc.1" /> |
|||
``` |
|||
with |
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.OpenIddict.Domain.Shared" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationDomainSharedModule.cs** replace usings and **module dependencies:** |
|||
|
|||
```csharp |
|||
using Volo.Abp.IdentityServer; |
|||
... |
|||
typeof(AbpIdentityServerDomainSharedModule) |
|||
``` |
|||
with |
|||
```csharp |
|||
using Volo.Abp.OpenIddict; |
|||
... |
|||
typeof(AbpOpenIddictDomainSharedModule) |
|||
|
|||
### Domain Layer |
|||
|
|||
- In **MyApplication.Domain.csproj** replace **project references**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="6.0.0-rc.1" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.OpenIddict.Domain" Version="6.0.0-rc.1" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.OpenIddict" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationDomainModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.PermissionManagement.IdentityServer; |
|||
... |
|||
typeof(AbpIdentityServerDomainModule), |
|||
typeof(AbpPermissionManagementDomainIdentityServerModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using Volo.Abp.OpenIddict; |
|||
using Volo.Abp.PermissionManagement.OpenIddict; |
|||
... |
|||
typeof(AbpOpenIddictDomainModule), |
|||
typeof(AbpPermissionManagementDomainOpenIddictModule), |
|||
``` |
|||
|
|||
#### OpenIddictDataSeedContributor |
|||
|
|||
- Create a folder named *OpenIddict* under the Domain project and copy the [OpenIddictDataSeedContributor.cs](https://github.com/abpframework/abp-samples/blob/master/Ids2OpenId/src/Ids2OpenId.Domain/OpenIddict/OpenIddictDataSeedContributor.cs) under this folder. Rename all the `Ids2OpenId` with your project name. |
|||
- Delete *IdentityServer* folder that contains `IdentityServerDataSeedContributor.cs` which is no longer needed. |
|||
|
|||
### EntityFrameworkCore Layer |
|||
|
|||
If you are using MongoDB, skip this step and check the *MongoDB* layer section. |
|||
|
|||
- In **MyApplication.EntityFrameworkCore.csproj** replace **project reference**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationEntityFrameworkCoreModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using Volo.Abp.IdentityServer.EntityFrameworkCore; |
|||
... |
|||
typeof(AbpIdentityServerEntityFrameworkCoreModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using Volo.Abp.OpenIddict.EntityFrameworkCore; |
|||
... |
|||
typeof(AbpOpenIddictEntityFrameworkCoreModule), |
|||
``` |
|||
|
|||
- In **MyApplicationDbContext.cs** replace usings and **fluent api configurations**: |
|||
|
|||
```csharp |
|||
using Volo.Abp.IdentityServer.EntityFrameworkCore; |
|||
... |
|||
using Volo.Abp.OpenIddict.EntityFrameworkCore; |
|||
... |
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Include modules to your migration db context */ |
|||
|
|||
... |
|||
builder.ConfigureIdentityServer(); |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using Volo.Abp.OpenIddict.EntityFrameworkCore; |
|||
... |
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Include modules to your migration db context */ |
|||
|
|||
... |
|||
builder.ConfigureOpenIddict(); |
|||
``` |
|||
|
|||
### MongoDB Layer |
|||
|
|||
If you are using EntityFrameworkCore, skip this step and check the *EntityFrameworkCore* layer section. |
|||
|
|||
- In **MyApplication.MongoDB.csproj** replace **project reference**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.IdentityServer.MongoDB" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
<PackageReference Include="Volo.Abp.OpenIddict.MongoDB" Version="6.0.0-rc.1" /> |
|||
``` |
|||
|
|||
- In **MyApplicationMongoDbModule.cs** replace usings and **module dependencies**: |
|||
|
|||
```csharp |
|||
using Volo.Abp.IdentityServer.MongoDB; |
|||
... |
|||
typeof(AbpIdentityServerMongoDbModule), |
|||
``` |
|||
|
|||
with |
|||
|
|||
```csharp |
|||
using Volo.Abp.OpenIddict.MongoDB; |
|||
... |
|||
typeof(AbpOpenIddictMongoDbModule), |
|||
``` |
|||
|
|||
### DbMigrator Project |
|||
|
|||
- In **MyApplication.DbMigrator.csproj** **add project reference**: |
|||
|
|||
```csharp |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" /> |
|||
``` |
|||
|
|||
for creating the host builder. |
|||
|
|||
- In `appsettings.json` **replace IdentityServer section with OpenIddict:** |
|||
|
|||
```json |
|||
"OpenIddict": { |
|||
"Applications": { |
|||
"MyApplication_Web": { |
|||
"ClientId": "MyApplication_Web", |
|||
"ClientSecret": "1q2w3e*", |
|||
"RootUrl": "https://localhost:44384" |
|||
}, |
|||
"MyApplication_App": { |
|||
"ClientId": "MyApplication_App", |
|||
"RootUrl": "http://localhost:4200" |
|||
}, |
|||
"MyApplication_BlazorServerTiered": { |
|||
"ClientId": "MyApplication_BlazorServerTiered", |
|||
"ClientSecret": "1q2w3e*", |
|||
"RootUrl": "https://localhost:44346" |
|||
}, |
|||
"MyApplication_Swagger": { |
|||
"ClientId": "MyApplication_Swagger", |
|||
"RootUrl": "https://localhost:44391" |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
Replace **MyApplication** with your application name. |
|||
|
|||
### UI Layer |
|||
|
|||
- [Angular UI Migration](OpenIddict-Angular.md) |
|||
- [MVC/Razor UI Migration](OpenIddict-Mvc.md) |
|||
- [Blazor-Server UI Migration](OpenIddict-Blazor-Server.md) |
|||
- [Blazor-Wasm UI Migration](OpenIddict-Blazor.md) |
|||
|
|||
## Source code of samples and module |
|||
|
|||
* [Open source tiered & separate auth server application migrate Identity Server to OpenIddct](https://github.com/abpframework/abp-samples/tree/master/Ids2OpenId) |
|||
* [OpenIddict module document](https://docs.abp.io/en/abp/6.0/Modules/OpenIddict) |
|||
* [OpenIddict module source code](https://github.com/abpframework/abp/tree/rel-6.0/modules/openiddict) |
|||
|
|||
## See Also |
|||
|
|||
* [ABP Version 6.0 Migration Guide](Abp-6_0.md) |
|||
@ -0,0 +1,137 @@ |
|||
# Dynamic Widget |
|||
|
|||
CMS kit provides a dynamic [widget](https://docs.abp.io/en/abp/latest/UI/AspNetCore/Widgets) used to render the components previously developed by the software in the content of the pages and blog posts. Its means, that in static content you can use dynamic content. We will mention how you can do it. You have two choices to define the widget in the system: Writing and UI. |
|||
|
|||
### Adding the widget |
|||
Firstly we will show how to use the widget system via writing manually in the page and blogpost contents. |
|||
|
|||
Let's define the view component |
|||
|
|||
```csharp |
|||
[Widget] |
|||
[ViewComponent(Name = "CmsToday")] |
|||
public class TodayViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("~/ViewComponents/Today.cshtml", |
|||
new TodayViewComponent()); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
```html |
|||
@model Volo.CmsKit.ViewComponents.TodayViewComponent |
|||
|
|||
<p>Welcome Today Component</p> |
|||
<p>@DateTime.Now.ToString()</p> |
|||
|
|||
``` |
|||
|
|||
Now configuration time on YourModule.cs |
|||
```csharp |
|||
Configure<CmsKitContentWidgetOptions>(options => |
|||
{ |
|||
options.AddWidget("Today","CmsToday"); |
|||
}); |
|||
``` |
|||
|
|||
Now you're ready to add your widget by writing. |
|||
[Widget Type="Today"] |
|||
|
|||
After completing the above steps, you can see the output at the right of the below screenshot. |
|||
 |
|||
|
|||
### Adding by using UI |
|||
Now we will mention the second option, using UI. |
|||
Once writing these definitions can make some mistakes hence we added a new feature to use the widget system easily. To the right of the editor, you will see the customized `W` button to add a dynamic widget like the below image. Don't forget please this is design mode and you need to view your page in view mode after saving. Also `Preview` tab on the editor will be ready to check your output easily for widget configurations in the next features. |
|||
|
|||
 |
|||
|
|||
### Adding by using UI with parameters |
|||
Let's improve the above example by adding a new parameter named format. Via this feature, we can use the widget system with many different scenarios but not prolong the document. Also, these examples can be expandable with dependency injection and getting values from the database, but we will use a basic example. We will add the format parameter to customize the date. |
|||
|
|||
```csharp |
|||
[Widget] |
|||
[ViewComponent(Name = "CmsToday")] |
|||
public class TodayViewComponent : AbpViewComponent |
|||
{ |
|||
public string Format { get; set; } |
|||
|
|||
public IViewComponentResult Invoke(string format) |
|||
{ |
|||
return View("~/ViewComponents/Today.cshtml", |
|||
new TodayViewComponent() { Format = format }); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
```html |
|||
@model Volo.CmsKit.ViewComponents.TodayViewComponent |
|||
|
|||
<p>Welcome Today Component</p> |
|||
<p>@DateTime.Now.ToString(Format)</p> |
|||
|
|||
``` |
|||
|
|||
Let's define the format component. |
|||
```csharp |
|||
[Widget] |
|||
[ViewComponent(Name = "Format")] |
|||
public class FormatViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("~/ViewComponents/Format.cshtml", |
|||
new FormatViewModel()); |
|||
} |
|||
} |
|||
|
|||
public class FormatViewModel |
|||
{ |
|||
[DisplayName("Format your date in the component")] |
|||
public string Format { get; set; } |
|||
} |
|||
``` |
|||
> Important Note: To get properties properly you should set the `name` property on the razor page or you may use the ABP component. ABP handles that automatically. |
|||
|
|||
```html |
|||
@using Volo.CmsKit.ViewComponents |
|||
@model FormatViewModel |
|||
|
|||
<div> |
|||
<abp-input asp-for="Format" /> |
|||
</div> |
|||
``` |
|||
|
|||
```csharp |
|||
Configure<CmsKitContentWidgetOptions>(options => |
|||
{ |
|||
options.AddWidget("Today", "CmsToday", "Format"); |
|||
}); |
|||
``` |
|||
|
|||
 |
|||
|
|||
In this image, after choosing your widget (on the other case, it changes automatically up to your configuration, mine is `Today`. Its parameter name `parameterWidgetName` and its value is `Format`) you will see the next widget. Enter input values or choose them and click `Add`. You will see the underlined output in the editor. Right of the image, also you can see its previewed output. |
|||
|
|||
You can edit this output manually if do any wrong coding for that (wrong value or typo) you won't see the widget, even so, your page will be viewed successfully. |
|||
|
|||
## Options |
|||
To configure the widget, you should define the below code in YourModule.cs |
|||
|
|||
```csharp |
|||
Configure<CmsKitContentWidgetOptions>(options => |
|||
{ |
|||
options.AddWidget(widgetType: "Today", widgetName: "CmsToday", parameterWidgetName: "Format"); |
|||
}); |
|||
``` |
|||
|
|||
Let's look at these parameters in detail |
|||
* `widgetType` is used for end-user and more readable names. The following bold word represents widgetType. |
|||
[Widget Type="**Today**" Format="yyyy-dd-mm HH:mm:ss"]. |
|||
|
|||
* `widgetName` is used for your widget name used in code for the name of the `ViewComponent`. |
|||
|
|||
* `parameterWidgetName` is used the for editor component side to see on the `Add Widget` modal. |
|||
After choosing the widget type from listbox (now just defined `Format`) and renders this widget automatically. It's required only to see UI once using parameters |
|||
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 45 KiB |
@ -0,0 +1,140 @@ |
|||
# Empezando con ABP y una Aplicacion AspNet Core MVC Web |
|||
|
|||
Este tutorial explica como empezar una aplicacion ABP desde cero usando las dependencias minimas. Uno generalmente desea |
|||
empezar con la **[plantilla de inicio](Getting-Started-AspNetCore-MVC-Template.md)**. |
|||
|
|||
## Crea un Proyecto Nuevo |
|||
|
|||
1. Crea una Aplicacion Web AspNet Core nueva usando Visual Studio 2022 (17.0.0+): |
|||
|
|||
 |
|||
|
|||
2. Configura el nuevo proyecto: |
|||
|
|||
 |
|||
|
|||
3. Presione el boton Create: |
|||
|
|||
 |
|||
|
|||
## Instale el paquete Volo.Abp.AspNetCore.Mvc |
|||
|
|||
Volo.Abp.AspNetCore.Mvc es el paquete de integracion con AspNet Core MVC para ABP. Siendo asi, instalalo en su proyecto: |
|||
|
|||
```` |
|||
Install-Package Volo.Abp.AspNetCore.Mvc |
|||
```` |
|||
|
|||
## Crea el primer modulo ABP |
|||
|
|||
ABP es un marco de referencia modular y require una clase de **inicio (raíz) tipo modulo** derivada de ``AbpModule``: |
|||
|
|||
````C# |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace BasicAspNetCoreApplication |
|||
{ |
|||
[DependsOn(typeof(AbpAspNetCoreMvcModule))] |
|||
public class AppModule : AbpModule |
|||
{ |
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
var env = context.GetEnvironment(); |
|||
|
|||
// Configura la canalización de peticiones HTTP. |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseExceptionHandler("/Error"); |
|||
// El valor por defecto de HSTS es 30 dias. Debes cambiar esto en ambientes productivos. Referencia https://aka.ms/aspnetcore-hsts. |
|||
app.UseHsts(); |
|||
} |
|||
|
|||
app.UseHttpsRedirection(); |
|||
app.UseStaticFiles(); |
|||
app.UseRouting(); |
|||
app.UseConfiguredEndpoints(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
``AppModule`` es un buen nombre para el modulo de inicio de una aplicacion. |
|||
|
|||
Los paquetes de ABP definen clases de tipo modulo y cada modulo puede depender de otro. |
|||
En el codigo anterior, el ``AppModule`` depende de el modulo ``AbpAspNetCoreMvcModule`` (definido por el paquete [Volo.Abp.AspNetCore.Mvc](https://www.nuget.org/packages/Volo.Abp.AspNetCore.Mvc)). Es comun agregar el atributo ``DependsOn`` despues de instalar un paquete ABP nuevo. |
|||
|
|||
En vez de la clase de inicion Startup, estamos configurando una canalizacion de ASP.NET Core en este modulo. |
|||
|
|||
## La clase Program |
|||
|
|||
El proximo paso es modificar la clase Program para integrate el sistema de modulos ABP: |
|||
|
|||
````C# |
|||
using BasicAspNetCoreApplication; |
|||
|
|||
var builder = WebApplication.CreateBuilder(args); |
|||
|
|||
await builder.Services.AddApplicationAsync<AppModule>(); |
|||
|
|||
var app = builder.Build(); |
|||
|
|||
await app.InitializeApplicationAsync(); |
|||
await app.RunAsync(); |
|||
```` |
|||
|
|||
``builder.Services.AddApplicationAsync<AppModule>();`` Agrega todos los servicios definidos en todos los modulos empezando desde ``AppModule``. |
|||
|
|||
``app.InitializeApplicationAsync()`` inicializa y empieza la aplicacion. |
|||
|
|||
## Ejecutar la Aplicación |
|||
|
|||
Es todo! Ejecuta la aplicación, debe funcionar como esperado. |
|||
|
|||
## Uso de Autofac como Marco de Inyección de Dependencia |
|||
|
|||
Mientras el sistema de Inyección de Dependencia de ASP.NET Core es suficiente para requerimientos basico, [Autofac](https://autofac.org/) proporciona características avanzadas como Inyección de Propiedades e Intercepcion de Metodos, los cuales son necesarios para que ABP pueda llevar a cabo funciones avanzadas. |
|||
|
|||
El acto de remplazar el sistema DI de ASP.NET Core por Autofac e integrarlo con ABP es facil. |
|||
|
|||
1. Instala el paquete [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) |
|||
|
|||
```` |
|||
Install-Package Volo.Abp.Autofac |
|||
```` |
|||
|
|||
2. Agrega la dependencia sobre el modulo ``AbpAutofacModule`` |
|||
|
|||
````C# |
|||
[DependsOn(typeof(AbpAspNetCoreMvcModule))] |
|||
[DependsOn(typeof(AbpAutofacModule))] //Agrega la dependencia sobre el modulo ABP Autofac |
|||
public class AppModule : AbpModule |
|||
{ |
|||
... |
|||
} |
|||
```` |
|||
|
|||
3. Actualiza `Program.cs` para que use Autofac: |
|||
|
|||
````C# |
|||
using BasicAspNetCoreApplication; |
|||
|
|||
var builder = WebApplication.CreateBuilder(args); |
|||
|
|||
builder.Host.UseAutofac(); //Agrega esta linea |
|||
|
|||
await builder.Services.AddApplicationAsync<AppModule>(); |
|||
|
|||
var app = builder.Build(); |
|||
|
|||
await app.InitializeApplicationAsync(); |
|||
await app.RunAsync(); |
|||
```` |
|||
|
|||
## Codigo fuente |
|||
|
|||
Obten el codigo fuente del ejemplo creado en este tutorial de [aqui](https://github.com/abpframework/abp-samples/tree/master/BasicAspNetCoreApplication). |
|||
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,47 @@ |
|||
# 动态部件 |
|||
|
|||
CMS kit提供了组件系统在页面和博客文章和生成动态部件. 这是一个在 `Page` 端的示例投票部件截图 |
|||
|
|||
> 重要提示: 投票部件是ABP Commercial实现的唯一部件 |
|||
 |
|||
|
|||
> 你也可以对其他小部件执行相同的操作.这只是一个例子. |
|||
要添加部件,你应该去页面或博客创建或更新, 然后单击 `W` 按钮添加一个动态部件, 如下图所示. 不要忘了这是设计模态框,你需要在保存后查看你的页面. 此外 `预览` 选项卡可以轻松的查看部件配置的部件输出. |
|||
|
|||
 |
|||
|
|||
在这张图中, 选择投票后(在其他情况下,它根据你的配置自动改变, 这里是投票组件,它的参数名是 `editorWidgetName`),你看到下一个部件, 输入值或选择值或选择并单击 `添加`. 你将看到以下输出 |
|||
|
|||
> [Widget Type="Poll" Code="SelectedValue"] |
|||
如果编码有任何错误(错误的值或拼写错误)你可以手动修改输出. |
|||
|
|||
## 选项 |
|||
|
|||
使添加的部件工作,你必须在模块类中进行配置: |
|||
|
|||
```csharp |
|||
Configure<CmsKitContentWidgetOptions>(options => |
|||
{ |
|||
options.AddWidget("widgetKey", "widgetName", "editorWidgetName"); |
|||
}); |
|||
``` |
|||
|
|||
* `widgetKey` 用于最终用户更具有可读性的名称. |
|||
[Widget Type="**Poll**" Code="SelectedValue"] |
|||
* `widgetName` 用于代码中通过 `[widget]` Attribute使用的小部件名称 |
|||
|
|||
```csharp |
|||
[Widget] |
|||
public class WidgetNameViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
|
|||
``` |
|||
|
|||
* `editorWidgetName` 用于编辑器组件端,在 `添加部件` 模态框中查看. |
|||
|
|||
另请参阅[部件](https://docs.abp.io/zh-Hans/abp/latest/UI/AspNetCore/Widgets). |
|||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 66 KiB |
@ -1,52 +0,0 @@ |
|||
using System; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.AspNetCore.DependencyInjection; |
|||
|
|||
[ExposeServices( |
|||
typeof(IHybridServiceScopeFactory), |
|||
typeof(HttpContextServiceScopeFactory) |
|||
)] |
|||
[Dependency(ReplaceServices = true)] |
|||
public class HttpContextServiceScopeFactory : IHybridServiceScopeFactory, ITransientDependency |
|||
{ |
|||
protected IHttpContextAccessor HttpContextAccessor { get; } |
|||
|
|||
protected IServiceScopeFactory ServiceScopeFactory { get; } |
|||
|
|||
public HttpContextServiceScopeFactory( |
|||
IHttpContextAccessor httpContextAccessor, |
|||
IServiceScopeFactory serviceScopeFactory) |
|||
{ |
|||
HttpContextAccessor = httpContextAccessor; |
|||
ServiceScopeFactory = serviceScopeFactory; |
|||
} |
|||
|
|||
public virtual IServiceScope CreateScope() |
|||
{ |
|||
var httpContext = HttpContextAccessor.HttpContext; |
|||
if (httpContext == null) |
|||
{ |
|||
return ServiceScopeFactory.CreateScope(); |
|||
} |
|||
|
|||
return new NonDisposedHttpContextServiceScope(httpContext.RequestServices); |
|||
} |
|||
|
|||
protected class NonDisposedHttpContextServiceScope : IServiceScope |
|||
{ |
|||
public IServiceProvider ServiceProvider { get; } |
|||
|
|||
public NonDisposedHttpContextServiceScope(IServiceProvider serviceProvider) |
|||
{ |
|||
ServiceProvider = serviceProvider; |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||