diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
index f8d5de9688..4283e64533 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
@@ -536,7 +536,7 @@
"Pricing_Page_Testimonial_3": "We love ABP. We don't have to write everything from scratch. We start from out-of-the-box features and just focus on what we really need to write. Also, ABP is well-architected and the code is high quality with fewer bugs. If we would have to write everything we needed on our own, we might have to spend years. Once more things we like is that the new version, or issue fixing, or improvement come out very soon every other week. We don't wait too long.",
"Pricing_Page_Testimonial_4": "ABP Commercial is a fantastic product would recommend. Commercial products to market for our customers in a single configurable platform. The jump start that the framework and tooling provide any team is worth every cent. ABP Commercial was the best fit for our needs.",
"AbpBookDownloadArea_ClaimYourEBook": "Claim your Mastering ABP Framework E-Book",
- "AddMemberModal_Warning_1": "If the username you are trying to add doesn't exist in the system, please ask your team member to register on {0} and share the username of his/her account with you.",
+ "AddMemberModal_Warning_1": "If the username you are trying to add doesn't exist in the system, please ask your team member to register on {0} and share the username of his/her account with you.",
"MyOrganizations_Detail_WelcomeMessage": "Welcome to your organization, {0}",
"MyOrganizations_Detail_OrganizationManagement": "Organization Management",
"OrganizationDisplayName": "Organization Display Name",
@@ -562,7 +562,7 @@
"MyOrganizations_Detail_PaymentProviderInfo": "If you have purchased your license through {0} gateway, it sends the PDF invoice to your email address, see {0} invoicing.",
"MyOrganizations_Detail_PayUInfo": "If you have purchased through the PayU gateway, click the \"Request Invoice\" button and fill in the billing information.",
"MyOrganizations_Detail_ConclusionInfo": "Your invoice request will be concluded within {0} business days.",
- "ExtendYourLicense": "Extend Your {0} License",
+ "ExtendYourLicense": "Extend your {0} license",
"Continue": "Continue",
"PurchaseLicense": "Purchase {0} license",
"DownloadInvoiceModal_DownloadInvoice": "Download Invoice",
@@ -628,7 +628,7 @@
"Tools_Page_Description": "ABP Commercial provides rapid application development tooling to increase developer productivity. ABP Suite allows you to create CRUD pages easily.",
"DeveloperPrice": "Developer Price",
"AdditionalDeveloperPaymentInfoSection_AdditionalDevelopers": "{0} developers",
- "AdditionalDeveloperPaymentInfoSection_RemainingYear": "for {1} years",
+ "LicenseRemainingDays": "for {0} days",
"ExtendPaymentInfoSection_Description": "By extending/renewing your license, you will continue to get premium support. You will also be able to get major updates for modules and themes. You will be able to continue creating new projects. And you will still be able to use ABP Suite which speeds up your development.",
"LicenseRenewalPrice": "License renewal price",
"LicensePrice": "License Price",
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json
index 3698916679..e516395aef 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json
@@ -131,7 +131,7 @@
"YourFullName": "你的全名",
"EmailField": "E-mail地址",
"YourEmailAddress": "你的e-mail地址",
- "HowMayWeHelpYou": "我们如何帮助你",
+ "HowMayWeHelpYou": "需要获得购买帮助?(提供中文服务)",
"SendMessage": "发送消息",
"Success": "成功",
"WeWillReplyYou": "你的消息已经发送! 我们会在短时间内给你答复.",
diff --git a/docs/en/CLI.md b/docs/en/CLI.md
index a4e0ba9818..f2da02d889 100644
--- a/docs/en/CLI.md
+++ b/docs/en/CLI.md
@@ -109,7 +109,7 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample
* **`module`**: [Module template](Startup-Templates/Module.md). Additional options:
* `--no-ui`: Specifies to not include the UI. This makes possible to create service-only modules (a.k.a. microservices - without UI).
* **`console`**: [Console template](Startup-Templates/Console.md).
- * **`app-nolayers`**: Application single layer template.
+ * **`app-nolayers`**: [Single-layer application template](Startup-Templates/Application-Single-Layer.md). Additional options:
* `--ui` or `-u`: Specifies the UI framework. Default framework is `mvc`. Available frameworks:
* `mvc`: ASP.NET Core MVC.
* `angular`: Angular UI.
diff --git a/docs/en/Index.md b/docs/en/Index.md
index 0a33c0e5a4..c4b876fabb 100644
--- a/docs/en/Index.md
+++ b/docs/en/Index.md
@@ -4,7 +4,7 @@ ABP Framework offers an **opinionated architecture** to build enterprise softwar
## Getting Started
-* [Quick Start](Tutorials/Todo/Index.md) is a single-part, quick-start tutorial to build a simple application with the ABP Framework. Start with this tutorial if you want to quickly understand how ABP works.
+* [Quick Start](Tutorials/Todo/Overall.md) is a single-part, quick-start tutorial to build a simple application with the ABP Framework. Start with this tutorial if you want to quickly understand how ABP works.
* [Getting Started](Getting-Started.md) guide can be used to create and run ABP based solutions with different options and details.
* [Web Application Development Tutorial](Tutorials/Part-1.md) is a complete tutorial to develop a full stack web application with all aspects of a real-life solution.
diff --git a/docs/en/Modules/OpenIddict.md b/docs/en/Modules/OpenIddict.md
index 7d7e898eee..ed25147be2 100644
--- a/docs/en/Modules/OpenIddict.md
+++ b/docs/en/Modules/OpenIddict.md
@@ -150,42 +150,22 @@ https://documentation.openiddict.com
https://github.com/openiddict/openiddict-core#resources
-### Token encryption
+### Disable AccessToken Encryption
-https://documentation.openiddict.com/configuration/encryption-and-signing-credentials.html
-
-> By default, OpenIddict enforces encryption for all the token types it supports. While this enforcement cannot be disabled for authorization codes, refresh tokens and device codes for security reasons, it can be relaxed for access tokens when integration with third-party APIs/resource servers is desired. Access token encryption can also be disabled if the resource servers receiving the access tokens don't fully support JSON Web Encryption.
+ABP disables the `access token encryption` by default for compatibility, you can manually enable it if needed.
```cs
-PreConfigure(builder =>
+public override void PreConfigureServices(ServiceConfigurationContext context)
{
- builder.DisableAccessTokenEncryption();
-});
-```
-
-An example of using `SecurityKey`
-
-> In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
-
-```cs
-// In OpenIddict Server
-PreConfigure(builder =>
-{
- builder.AddSigningKey(new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Abp_OpenIddict_Demo_C40DBB176E78")));
- builder.AddEncryptionKey(new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Abp_OpenIddict_Demo_87E33FC57D80")));
-});
-
-//In Client AddJwtBearer
-builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
- .AddJwtBearer(options =>
+ PreConfigure(builder =>
{
- //Other configuration
-
- options.TokenValidationParameters.IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Abp_OpenIddict_Demo_C40DBB176E78"));
- options.TokenValidationParameters.TokenDecryptionKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Abp_OpenIddict_Demo_87E33FC57D80"));
+ builder.Configure(options => options.DisableAccessTokenEncryption = false);
});
+}
```
+https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
+
### PKCE
diff --git a/docs/en/PlugIn-Modules.md b/docs/en/PlugIn-Modules.md
index 1d613582ab..5c0cdacfd3 100644
--- a/docs/en/PlugIn-Modules.md
+++ b/docs/en/PlugIn-Modules.md
@@ -178,10 +178,8 @@ namespace MyMvcUIPlugIn
//Add plugin assembly
mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(typeof(MyMvcUIPlugInModule).Assembly));
- //Add views assembly
- var viewDllPath = Path.Combine(Path.GetDirectoryName(typeof(MyMvcUIPlugInModule).Assembly.Location), "MyMvcUIPlugIn.Views.dll");
- var viewAssembly = new CompiledRazorAssemblyPart(Assembly.LoadFrom(viewDllPath));
- mvcBuilder.PartManager.ApplicationParts.Add(viewAssembly);
+ //Add CompiledRazorAssemblyPart if the PlugIn module contains razor views.
+ mvcBuilder.PartManager.ApplicationParts.Add(new CompiledRazorAssemblyPart(typeof(MyMvcUIPlugInModule).Assembly));
});
}
}
@@ -189,8 +187,7 @@ namespace MyMvcUIPlugIn
````
* Depending on the `AbpAspNetCoreMvcUiThemeSharedModule` since we added the related NuGet package.
-* Adding the plug-in's assembly to the `PartManager` of ASP.NET Core MVC. This is required by ASP.NET Core. Otherwise, your controllers inside the plug-in doesn't work.
-* Adding the plug-in's views assembly to the `PartManager` of ASP.NET Core MVC. This is required by ASP.NET Core. Otherwise, your views inside the plug-in doesn't work.
+* Adding the plug-in's assembly as `AssemblyPart` and `CompiledRazorAssemblyPart` to the `PartManager` of ASP.NET Core MVC. This is required by ASP.NET Core. Otherwise, your controllers or views inside the plug-in doesn't work.
You can now add a razor page, like `MyPlugInPage.cshtml` inside the `Pages` folder:
@@ -205,7 +202,7 @@ Now, you can build the plug-in project. It will produce the following output:

-Copy the `MyMvcUIPlugIn.dll` and `MyMvcUIPlugIn.Views.dll` into the plug-in folder (`D:\Temp\MyPlugIns` for this example).
+Copy the `MyMvcUIPlugIn.dll` into the plug-in folder (`D:\Temp\MyPlugIns` for this example).
If you have configured the main application like described above (see Basic Usage section), you should be able to visit the `/MyPlugInPage` URL when your application:
diff --git a/docs/en/Startup-Templates/Application-Single-Layer.md b/docs/en/Startup-Templates/Application-Single-Layer.md
new file mode 100644
index 0000000000..95ebad55a7
--- /dev/null
+++ b/docs/en/Startup-Templates/Application-Single-Layer.md
@@ -0,0 +1,107 @@
+# Application (Single Layer) Startup Template
+
+## Introduction
+
+This template provides a simple solution structure with a single project. This document explains that solution structure in details.
+
+### The Difference Between the Application Startup Templates
+
+ABP's [Application Startup Template](Application.md) provides a well-organized and layered solution to create maintainable business applications based on the [Domain Driven Design](../Domain-Driven-Design.md) (DDD) practices. However, some developers find this template a little bit complex for simple and short-term applications. The single-layer application template has been created to provide a simpler development model for such applications. This template has the same functionality, features and modules on runtime with the [Application Startup Template](Application.md) but the development model is minimal and everything is in a single project (`.csproj`).
+
+## How to Start with It?
+
+You can use the [ABP CLI](../CLI.md) to create a new project using this startup template. Alternatively, you can directly create & download this startup template from the [Get Started](https://abp.io/get-started) page. In this section, we will use the ABP CLI.
+
+Firstly, install the ABP CLI if you haven't installed it before:
+
+```bash
+dotnet tool install -g Volo.Abp.Cli
+```
+
+Then, use the `abp new` command in an empty folder to create a new solution:
+
+```bash
+abp new Acme.BookStore -t app-nolayers
+```
+
+* `Acme.BookStore` is the solution name, like *YourCompany.YourProduct*. You can use single-level, two-level or three-level naming.
+* In this example, the `-t` (or `--template`) option specifies the template name.
+
+### Specify the UI Framework
+
+This template provides multiple UI frameworks:
+
+* `mvc`: ASP.NET Core MVC UI with Razor Pages (default)
+* `blazor-server`: Blazor Server UI
+* `angular`: Angular UI
+* `none`: Without UI (for HTTP API development)
+
+> This template doesn't have Blazor WebAssembly UI, because it requires 3 projects at least (server-side, UI and shared library between these two projects). We are recommending to use the layered [application startup template](Application.md) for Blazor WebAssembly projects.
+
+Use the `-u` (or `--ui`) option to specify the UI framework while creating the solution:
+
+```bash
+abp new Acme.BookStore -t app-nolayers -u angular
+```
+
+This example specifies the UI type (the `-u` option) as `angular`. You can also specify `mvc`, `blazor-server` or `none` for the UI type.
+
+### Specify the Database Provider
+
+This template supports the following database providers:
+
+- `ef`: Entity Framework Core (default)
+- `mongodb`: MongoDB
+
+Use the `-d` (or `--database-provider`) option to specify the database provider while creating the solution:
+
+```bash
+abp new Acme.BookStore -t app-nolayers -d mongodb
+```
+
+## Solution Structure
+
+If you don't specify any additional options while creating an `app-nolayers` template, you will have a solution as shown below:
+
+
+
+In the next sections, we will explain the structure based on this example. Your startup solution can be slightly different based on your preferences.
+
+### Folder Structure
+
+Since this template provides a single-project solution, we've separated concerns into folders instead of projects. You can see the pre-defined folders as shown below:
+
+
+
+* Define your database mappings (for [EF Core](../Entity-Framework-Core.md) or [MongoDB](../MongoDB.md)) and [repositories](../Repositories.md) in the `Data` folder.
+* Define your [entities](../Entities.md) in the `Entities` folder.
+* Define your UI localization keys/values in the `Localization` folder.
+* Define your UI menu items in the `Menus` folder.
+* Define your [object-to-object mapping](../Object-To-Object-Mapping.md) classes in the `ObjectMapping` folder.
+* Define your UI pages (Razor Pages) in the `Pages` folder (create `Controllers` and `Views` folder yourself if you prefer the MVC pattern).
+* Define your [application services](../Application-Services.md) in the `Services` folder.
+
+### How to Run?
+
+Before running the application, you need to create the database and seed the initial data. To do that, you can run the following command in the directory of your project (in the same folder of the `.csproj` file):
+
+```bash
+dotnet run --migrate-database
+```
+
+This command will create the database and seed the initial data for you. Then you can run the application with any IDE that supports .NET or by running the `dotnet run` command in the directory of your project. The default username is `admin` and the password is `1q2w3E*`.
+
+> While creating a database & applying migrations seem only necessary for relational databases, you should run this command even if you choose a NoSQL database provider (like MongoDB). In that case, it still seeds the initial data which is necessary for the application.
+
+### The Angular UI
+
+If you choose `Angular` as the UI framework, the solution will be separated into two folders:
+
+* An `angular` folder that contains the Angular UI application, the client-side code.
+* An `aspnet-core` folder that contains the ASP.NET Core solution (a single project), the server-side code.
+
+The server-side is similar to the solution described in the *Solution Structure* section above. This project serves the API, so the Angular application can consume it.
+
+The client-side application consumes the HTTP APIs as mentioned. You can see the folder structure of the Angular project shown below:
+
+
diff --git a/docs/en/Tutorials/Todo/Index.md b/docs/en/Tutorials/Todo/Index.md
index b3e5a876df..5ecee2074b 100644
--- a/docs/en/Tutorials/Todo/Index.md
+++ b/docs/en/Tutorials/Todo/Index.md
@@ -17,6 +17,7 @@ You can find the source code of the completed application [here](https://github.
## Pre-Requirements
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 6.0+](https://dotnet.microsoft.com/download/dotnet) development.
+* [Node v14.x](https://nodejs.org/)
{{if DB=="Mongo"}}
@@ -24,12 +25,6 @@ You can find the source code of the completed application [here](https://github.
{{end}}
-{{if UI=="NG"}}
-
-* [Node v14.x](https://nodejs.org/)
-
-{{end}}
-
## Creating a New Solution
We will use the [ABP CLI](../../CLI.md) to create new solutions with the ABP Framework. You can run the following command in a command-line terminal to install it:
diff --git a/docs/en/Tutorials/Todo/Overall.md b/docs/en/Tutorials/Todo/Overall.md
new file mode 100644
index 0000000000..2fc92ae2ac
--- /dev/null
+++ b/docs/en/Tutorials/Todo/Overall.md
@@ -0,0 +1,14 @@
+# Quick Start: Overall
+
+**Welcome to the ABP Framework**. This is a single-part, quick-start tutorial to build a simple application. Start with this tutorial if you want to quickly understand how ABP Framework works.
+
+## Select the Solution Architecture
+
+This tutorial has multiple versions. Please select the one best fits for you:
+
+* **[Single-Layer Solution](Single-Layer/Index.md)**: Creates a single-project solution. Recommended for building an application with a **simpler and easy to understand** architecture.
+* **[Layered Solution Architecture](Index.md)**: A fully layered (multiple projects) solution based on [Domain Driven Design](../../Domain-Driven-Design.md) practices. Recommended for long-term projects that need a **maintainable and extensible** codebase.
+
+## See Also
+
+* Check the [Web Application Development Tutorial](../Part-1.md) to see a real-life web application development in a layered architecture.
diff --git a/docs/en/Tutorials/Todo/Single-Layer/Index.md b/docs/en/Tutorials/Todo/Single-Layer/Index.md
new file mode 100644
index 0000000000..0dcabf664e
--- /dev/null
+++ b/docs/en/Tutorials/Todo/Single-Layer/Index.md
@@ -0,0 +1,755 @@
+# Quick Start
+
+````json
+//[doc-params]
+{
+ "UI": ["MVC", "BlazorServer", "NG"],
+ "DB": ["EF", "Mongo"]
+}
+````
+
+This is a single-part quick-start tutorial to build a simple todo application with the ABP Framework. Here's a screenshot from the final application:
+
+
+
+You can find the source code of the completed application [here](https://github.com/abpframework/abp-samples/tree/master/TodoApp-SingleLayer).
+
+## Pre-Requirements
+
+* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 6.0+](https://dotnet.microsoft.com/download/dotnet) development.
+* [Node v14.x](https://nodejs.org/)
+
+{{if DB=="Mongo"}}
+
+* [MongoDB Server 4.0+](https://docs.mongodb.com/manual/administration/install-community/)
+
+{{end}}
+
+## Creating a New Solution
+
+In this tutorial, we will use the [ABP CLI](../../../CLI.md) to create the sample application with the ABP Framework. You can run the following command in a command-line terminal to install the **ABP CLI**, if you haven't installed it yet:
+
+````bash
+dotnet tool install -g Volo.Abp.Cli
+````
+
+Then create an empty folder, open a command-line terminal and execute the following command in the terminal:
+
+````bash
+abp new TodoApp -t app-nolayers{{if UI=="BlazorServer"}} -u blazor-server{{else if UI=="NG"}} -u angular{{end}}{{if DB=="Mongo"}} -d mongodb{{end}}
+````
+
+{{if UI=="NG"}}
+
+This will create a new solution, named *TodoApp*, with `angular` and `aspnet-core` folders. Once the solution is ready, open the solution (in the `aspnet-core` folder) with your favorite IDE.
+
+{{else}}
+
+This will create a new solution with a single project, named *TodoApp*. Once the solution is ready, open it in your favorite IDE.
+
+{{end}}
+
+### Create the Database
+
+You can run the following command in the root directory of your project (in the same folder of the `.csproj` file) to create the database and seed the initial data:
+
+```bash
+dotnet run --migrate-database
+```
+
+This command will create the database and seed the initial data for you. Then you can run the application.
+
+### Run the Application
+
+{{if UI=="MVC" || UI=="BlazorServer"}}
+
+It is good to run the application before starting the development. Running the application is pretty straight-forward, you can run the application with any IDE that supports .NET or by running the `dotnet run` CLI command in the directory of your project:
+
+{{else if UI=="NG"}}
+
+It is good to run the application before starting the development. The solution has two main applications:
+
+* `TodoApp` (in the .NET solution) hosts the server-side HTTP API, so the Angular application can consume it. (server-side application)
+* `angular` folder contains the Angular application. (client-side application)
+
+Firstly, run the `TodoApp` project in your favorite IDE (or run the `dotnet run` CLI command on your project directory) to see the server-side HTTP API on [Swagger UI](https://swagger.io/tools/swagger-ui/):
+
+
+
+You can explore and test your HTTP API with this UI. If it works, then we can run the Angular client application.
+
+You can run the application using the following (or `yarn start`) command:
+
+````bash
+npm start
+````
+
+This command takes time, but eventually runs and opens the application in your default browser:
+
+{{end}}
+
+
+
+You can click on the *Login* button and use `admin` as the username and `1q2w3E*` as the password to login to the application.
+
+All right. We can start coding!
+
+## Defining the Entity
+
+This application will have a single [entity](../../../Entities.md) and we can start by creating it. So, create a new `TodoItem` class under the `Entities` folder of the project:
+
+````csharp
+using Volo.Abp.Domain.Entities;
+
+namespace TodoApp.Entities;
+
+public class TodoItem : BasicAggregateRoot
+{
+ public string Text { get; set; }
+}
+````
+
+`BasicAggregateRoot` is the simplest base class to create root entities, and `Guid` is the primary key (`Id`) of the entity here.
+
+## Database Integration
+
+{{if DB=="EF"}}
+
+Next step is to setup the [Entity Framework Core](../../../Entity-Framework-Core.md) configuration.
+
+### Mapping Configuration
+
+Open the `TodoAppDbContext` class (in the `Data` folder) and add a new `DbSet` property to this class:
+
+````csharp
+public DbSet TodoItems { get; set; }
+````
+
+Then navigate to the `OnModelCreating` method in the same class and add the following mapping code for the `TodoItem ` entity:
+
+````csharp
+protected override void OnModelCreating(ModelBuilder builder)
+{
+ base.OnModelCreating(builder);
+
+ /* Include modules to your migration db context */
+
+ builder.ConfigurePermissionManagement();
+ ...
+
+ /* Configure your own tables/entities inside here */
+ builder.Entity(b =>
+ {
+ b.ToTable("TodoItems");
+ });
+}
+````
+
+We've mapped the `TodoItem` entity to the `TodoItems` table in the database. The next step is to create a migration and apply the changes to the database.
+
+### Code First Migrations
+
+The startup solution is configured to use Entity Framework Core [Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations). Since we've changed the database mapping configuration, we should create a new migration and apply changes to the database.
+
+Open a command-line terminal in the root directory of your project and type the following command:
+
+````bash
+dotnet ef migrations add Added_TodoItem
+````
+
+This will add a new migration class to the project. You should see the new migration in the `Migrations` folder:
+
+
+
+Then, you can apply changes to the database using the following command, in the same command-line terminal:
+
+````bash
+dotnet ef database update
+````
+
+{{else if DB=="Mongo"}}
+
+The next step is to setup the [MongoDB](../../../MongoDB.md) configuration. Open the `TodoAppDbContext` class (under the **Data** folder) in your project and make the following changes:
+
+1. Add a new property to the class:
+
+````csharp
+public IMongoCollection TodoItems => Collection();
+````
+
+2. Add the following code inside the `CreateModel` method:
+
+````csharp
+modelBuilder.Entity(b =>
+{
+ b.CollectionName = "TodoItems";
+});
+````
+
+{{end}}
+
+After the database integrations, now we can start to create application service methods and implement our use-cases.
+
+## Creating the Application Service
+
+An [application service](../../../Application-Services.md) is used to perform the use cases of the application. We need to perform the following use cases in this application:
+
+* Get the list of the todo items
+* Create a new todo item
+* Delete an existing todo item
+
+Before starting to implement these use cases, first we need to create a DTO class that will be used in the application service.
+
+### Creating the Data Transfer Object (DTO)
+
+[Application services](../../../Application-Services.md) typically get and return DTOs ([Data Transfer Objects](../../../Data-Transfer-Objects.md)) instead of entities. So, create a new `TodoItemDto` class under the `Services/Dtos` folder:
+
+```csharp
+namespace TodoApp.Services.Dtos;
+
+public class TodoItemDto
+{
+ public Guid Id { get; set; }
+ public string Text { get; set; }
+}
+```
+
+This is a very simple DTO class that has the same properties as the `TodoItem` entity. Now, we are ready to implement our use-cases.
+
+### The Application Service Implementation
+
+Create a `TodoAppService` class under the `Services` folder of your project, as shown below:
+
+```csharp
+using TodoApp.Entities;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+
+namespace TodoApp.Services;
+
+public class TodoAppService : ApplicationService
+{
+ private readonly IRepository _todoItemRepository;
+
+ public TodoAppService(IRepository todoItemRepository)
+ {
+ _todoItemRepository = todoItemRepository;
+ }
+
+ // TODO: Implement the methods here...
+}
+```
+
+This class inherits from the `ApplicationService` class of the ABP Framework and implements our use-cases. ABP provides default generic [repositories](../../../Repositories.md) for the entities. We can use them to perform the fundamental database operations. This class [injects](../../../Dependency-Injection.md) `IRepository`, which is the default repository for the `TodoItem` entity. We will use it to implement our use cases.
+
+#### Getting the Todo Items
+
+Let's start by implementing the `GetListAsync` method, which is used to get a list of todo items:
+
+````csharp
+public async Task> GetListAsync()
+{
+ var items = await _todoItemRepository.GetListAsync();
+ return items
+ .Select(item => new TodoItemDto
+ {
+ Id = item.Id,
+ Text = item.Text
+ }).ToList();
+}
+````
+
+We are simply getting the `TodoItem` list from the repository, mapping them to the `TodoItemDto` objects and returning as the result.
+
+#### Creating a New Todo Item
+
+The next method is `CreateAsync` and we can implement it as shown below:
+
+````csharp
+public async Task CreateAsync(string text)
+{
+ var todoItem = await _todoItemRepository.InsertAsync(
+ new TodoItem {Text = text}
+ );
+
+ return new TodoItemDto
+ {
+ Id = todoItem.Id,
+ Text = todoItem.Text
+ };
+}
+````
+
+The repository's `InsertAsync` method inserts the given `TodoItem` to the database and returns the same `TodoItem` object. It also sets the `Id`, so we can use it on the returning object. We are simply returning a `TodoItemDto` by creating from the new `TodoItem` entity.
+
+#### Deleting a Todo Item
+
+Finally, we can implement the `DeleteAsync` as the following code block:
+
+````csharp
+public async Task DeleteAsync(Guid id)
+{
+ await _todoItemRepository.DeleteAsync(id);
+}
+````
+
+The application service is ready to be used from the UI layer. So, let's implement it.
+
+## User Interface
+
+It is time to show the todo items on the UI! Before starting to write the code, it would be good to remember what we are trying to build. Here's a sample screenshot from the final UI:
+
+
+
+{{if UI=="MVC"}}
+
+### Index.cshtml.cs
+
+Open the `Index.cshtml.cs` file in the `Pages` folder and replace the content with the following code block:
+
+```csharp
+using TodoApp.Services;
+using TodoApp.Services.Dtos;
+using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
+
+namespace TodoApp.Pages;
+
+public class IndexModel : AbpPageModel
+{
+ public List TodoItems { get; set; }
+
+ private readonly TodoAppService _todoAppService;
+
+ public IndexModel(TodoAppService todoAppService)
+ {
+ _todoAppService = todoAppService;
+ }
+
+ public async Task OnGetAsync()
+ {
+ TodoItems = await _todoAppService.GetListAsync();
+ }
+}
+```
+
+This class uses `TodoAppService` to get the list of todo items and assign the `TodoItems` property. We will use it to render the todo items on the razor page.
+
+### Index.cshtml
+
+Open the `Index.cshtml` file in the `Pages` folder and replace it with the following content:
+
+```xml
+@page
+@model TodoApp.Pages.IndexModel
+
+@section styles {
+
+}
+@section scripts {
+
+}
+
+
+
+
+
+ TODO LIST
+
+
+
+
+
+
+
+ @foreach (var todoItem in Model.TodoItems)
+ {
+
+ @todoItem.Text
+
+ }
+
+
+
+
+```
+
+We are using ABP's [card tag helper](../../../UI/AspNetCore/Tag-Helpers/Cards.md) to create a simple card view. You could directly use the standard bootstrap HTML structure, however the ABP [tag helpers](../../../UI/AspNetCore/Tag-Helpers/Index.md) make it much easier and type safe.
+
+This page imports a CSS and a JavaScript file, so we should also create them.
+
+### Index.cshtml.js
+
+Open the `Index.cshtml.js` file in the `Pages` folder and replace with the following content:
+
+````js
+$(function () {
+
+ // DELETING ITEMS /////////////////////////////////////////
+ $('#TodoList').on('click', 'li i', function(){
+ var $li = $(this).parent();
+ var id = $li.attr('data-id');
+
+ todoApp.services.todo.delete(id).then(function(){
+ $li.remove();
+ abp.notify.info('Deleted the todo item.');
+ });
+ });
+
+ // CREATING NEW ITEMS /////////////////////////////////////
+ $('#NewItemForm').submit(function(e){
+ e.preventDefault();
+
+ var todoText = $('#NewItemText').val();
+ todoApp.services.todo.create(todoText).then(function(result){
+ $('
')
+ .html(' ' + result.text)
+ .appendTo($('#TodoList'));
+ $('#NewItemText').val('');
+ });
+ });
+});
+````
+
+In the first part, we subscribed to the click events of the trash icons near the todo items, deleted the related item on the server and showed a notification on the UI. Also, we removed the deleted item from the DOM, so we wouldn't need to refresh the page.
+
+In the second part, we created a new todo item on the server. If it succeeded, we would then manipulate the DOM to insert a new `
` element to the todo list. This way, we wouldn't need to refresh the whole page after creating a new todo item.
+
+The interesting part here is how we communicate with the server. See the *Dynamic JavaScript Proxies & Auto API Controllers* section to understand how it works. But now, let's continue and complete the application.
+
+### Index.cshtml.css
+
+As for the final touch, open the `Index.cshtml.css` file in the `Pages` folder and replace with the following content:
+
+````css
+#TodoList{
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+#TodoList li {
+ padding: 5px;
+ margin: 5px 0px;
+ border: 1px solid #cccccc;
+ background-color: #f5f5f5;
+}
+
+#TodoList li i
+{
+ opacity: 0.5;
+}
+
+#TodoList li i:hover
+{
+ opacity: 1;
+ color: #ff0000;
+ cursor: pointer;
+}
+````
+
+This is a simple styling for the todo page. We believe that you can do much better :)
+
+Now, you can run the application again and see the result.
+
+### Dynamic JavaScript Proxies & Auto API Controllers
+
+In the `Index.cshtml.js` file, we've used the `todoApp.services.todo.delete(...)` and `todoApp.services.todo.create(...)` functions to communicate with the server. These functions are dynamically created by the ABP Framework, thanks to the [Dynamic JavaScript Client Proxy](../../../UI/AspNetCore/Dynamic-JavaScript-Proxies.md) system. They perform HTTP API calls to the server and return a promise, so you can register a callback to the `then` function as we've done above.
+
+> `services` keyword comes from the namespace (`namespace TodoApp.Services;`). It's a naming convention.
+
+However, you may notice that we haven't created any API Controllers, so how does the server handle these requests? This question brings us to the [Auto API Controller](../../../API/Auto-API-Controllers.md) feature of the ABP Framework. It automatically converts the application services to **API Controllers** by convention.
+
+If you open [Swagger UI](https://swagger.io/tools/swagger-ui/) by entering the `/swagger` URL in your application, you can see the Todo API:
+
+
+
+{{else if UI=="BlazorServer"}}
+
+### Index.razor.cs
+
+Open the `Index.razor.cs` file in the `Pages` folder and replace the content with the following code block:
+
+```csharp
+using Microsoft.AspNetCore.Components;
+using TodoApp.Services;
+using TodoApp.Services.Dtos;
+
+namespace TodoApp.Pages;
+
+public partial class Index
+{
+ [Inject]
+ private TodoAppService TodoAppService { get; set; }
+
+ private List TodoItems { get; set; } = new List();
+ private string NewTodoText { get; set; }
+
+ protected override async Task OnInitializedAsync()
+ {
+ TodoItems = await TodoAppService.GetListAsync();
+ }
+
+ private async Task Create()
+ {
+ var result = await TodoAppService.CreateAsync(NewTodoText);
+ TodoItems.Add(result);
+ NewTodoText = null;
+ }
+
+ private async Task Delete(TodoItemDto todoItem)
+ {
+ await TodoAppService.DeleteAsync(todoItem.Id);
+ await Notify.Info("Deleted the todo item.");
+ TodoItems.Remove(todoItem);
+ }
+}
+```
+
+This class uses the `TodoAppService` to get the list of todo items. It manipulates the `TodoItems` list after create and delete operations. This way, we don't need to refresh the whole todo list from the server.
+
+### Index.razor
+
+Open the `Index.razor` file in the `Pages` folder and replace the content with the following code block:
+
+```xml
+@page "/"
+@inherits TodoAppComponentBase
+
+
+
+
+
+ TODO LIST
+
+
+
+
+
+
+
+ @foreach (var todoItem in TodoItems)
+ {
+
+ Delete(todoItem)">
+ @todoItem.Text
+
+ }
+
+
+
+
+```
+
+### Index.razor.css
+
+As the final touch, open the `Index.razor.css` file in the `Pages` folder and replace it with the following content:
+
+````css
+#TodoList{
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+#TodoList li {
+ padding: 5px;
+ margin: 5px 0px;
+ border: 1px solid #cccccc;
+ background-color: #f5f5f5;
+}
+
+#TodoList li i
+{
+ opacity: 0.5;
+}
+
+#TodoList li i:hover
+{
+ opacity: 1;
+ color: #ff0000;
+ cursor: pointer;
+}
+````
+
+This is a simple styling for the todo page. We believe that you can do much better :)
+
+Now, you can run the application again to see the result.
+
+{{else if UI=="NG"}}
+
+### Service Proxy Generation
+
+ABP provides a handy feature to automatically create client-side services to easily consume HTTP APIs provided by the server.
+
+You first need to run the `TodoApp` project since the proxy generator reads API definitions from the server application.
+
+Once you run the `TodoApp` project (**Swagger API Definition** will be shown), open a command-line terminal in the directory of `angular` folder and run the following command:
+
+```bash
+abp generate-proxy -t ng
+```
+
+If everything goes well, it should generate an output as shown below:
+
+```bash
+CREATE src/app/proxy/generate-proxy.json (182755 bytes)
+CREATE src/app/proxy/README.md (1000 bytes)
+CREATE src/app/proxy/services/todo.service.ts (833 bytes)
+CREATE src/app/proxy/services/dtos/models.ts (71 bytes)
+CREATE src/app/proxy/services/dtos/index.ts (26 bytes)
+CREATE src/app/proxy/services/index.ts (81 bytes)
+CREATE src/app/proxy/index.ts (61 bytes)
+```
+
+Then, we can use the `TodoService` to use the server-side HTTP APIs, as we'll do in the next section.
+
+### home.component.ts
+
+Open the `/angular/src/app/home/home.component.ts` file and replace its content with the following code block:
+
+```ts
+import { ToasterService } from "@abp/ng.theme.shared";
+import { Component, OnInit } from '@angular/core';
+import { TodoItemDto } from "@proxy/services/dtos";
+import { TodoService } from "@proxy/services";
+
+@Component({
+ selector: 'app-home',
+ templateUrl: './home.component.html',
+ styleUrls: ['./home.component.scss'],
+})
+
+export class HomeComponent implements OnInit {
+
+ todoItems: TodoItemDto[];
+ newTodoText: string;
+
+ constructor(
+ private todoService: TodoService,
+ private toasterService: ToasterService)
+ { }
+
+ ngOnInit(): void {
+ this.todoService.getList().subscribe(response => {
+ this.todoItems = response;
+ });
+ }
+
+ create(): void{
+ this.todoService.create(this.newTodoText).subscribe((result) => {
+ this.todoItems = this.todoItems.concat(result);
+ this.newTodoText = null;
+ });
+ }
+
+ delete(id: string): void {
+ this.todoService.delete(id).subscribe(() => {
+ this.todoItems = this.todoItems.filter(item => item.id !== id);
+ this.toasterService.info('Deleted the todo item.');
+ });
+ }
+}
+```
+
+We've used `TodoService` to get the list of todo items and assigned the returning value to the `todoItems` array. We've also added `create` and `delete` methods. These methods will be used on the view side.
+
+### home.component.html
+
+Open the `/angular/src/app/home/home.component.html` file and replace its content with the following code block:
+
+````html
+
+
+
+
TODO LIST
+
+
+
+
+
+
+
+ {%{{{ todoItem.text }}}%}
+
+
+
+
+
+````
+
+### home.component.scss
+
+As the final touch, open the `/angular/src/app/home/home.component.scss` file and replace its content with the following code block:
+
+````css
+#TodoList{
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+#TodoList li {
+ padding: 5px;
+ margin: 5px 0px;
+ border: 1px solid #cccccc;
+ background-color: #f5f5f5;
+}
+
+#TodoList li i
+{
+ opacity: 0.5;
+}
+
+#TodoList li i:hover
+{
+ opacity: 1;
+ color: #ff0000;
+ cursor: pointer;
+}
+````
+
+This is a simple styling for the todo page. We believe that you can do much better :)
+
+Now, you can run the application again to see the result.
+
+{{end}}
+
+## Conclusion
+
+In this tutorial, we've built a very simple application to warm up with the ABP Framework.
+
+## Source Code
+
+You can find the source code of the completed application [here](https://github.com/abpframework/abp-samples/tree/master/TodoApp-SingleLayer).
+
+## See Also
+
+* Check the [Web Application Development Tutorial](../../Part-1.md) to see a real-life web application development in a layered architecture using the [Application Startup Template](../../../Startup-Templates/Application.md).
diff --git a/docs/en/Tutorials/Todo/Single-Layer/todo-efcore-migration-single-layer.png b/docs/en/Tutorials/Todo/Single-Layer/todo-efcore-migration-single-layer.png
new file mode 100644
index 0000000000..686d8a5f87
Binary files /dev/null and b/docs/en/Tutorials/Todo/Single-Layer/todo-efcore-migration-single-layer.png differ
diff --git a/docs/en/UI/Blazor/Error-Handling.md b/docs/en/UI/Blazor/Error-Handling.md
index 6582ee0c8e..18cb958f72 100644
--- a/docs/en/UI/Blazor/Error-Handling.md
+++ b/docs/en/UI/Blazor/Error-Handling.md
@@ -23,12 +23,12 @@ There are different type of `Exception` classes handled differently by the ABP F
`UserFriendlyException` is a special type of exception. You can directly show a error message dialog to the user by throwing such an exception.
+{{if UI == "BlazorServer"}}
+
> For Blazor Server, exceptions must be handled manually. Otherwise it crashes the whole application. Auto Exception Handling is not possible with Blazor Server right now, please follow [this issue](https://github.com/abpframework/abp/issues/8195) to see progress. In meantime, you can use try-catch blocks and call the `HandleErrorAsync` method of ABP to handle errors manually, which shows an error dialog for you.
**Example**
-{{if UI == "BlazorServer"}}
-
````csharp
@page "/"
@using Volo.Abp
@@ -55,6 +55,8 @@ There are different type of `Exception` classes handled differently by the ABP F
{{if UI == "Blazor"}}
+**Example**
+
````csharp
@page "/"
@using Volo.Abp
@@ -97,4 +99,4 @@ Errors (like Validation, Authorization and User Friendly Errors) sent by the ser
## See Also
-* [Exception Handling System](../../Exception-Handling.md)
\ No newline at end of file
+* [Exception Handling System](../../Exception-Handling.md)
diff --git a/docs/en/UI/Blazor/Page-Layout.md b/docs/en/UI/Blazor/Page-Layout.md
index 61d91d66af..49ed1659f4 100644
--- a/docs/en/UI/Blazor/Page-Layout.md
+++ b/docs/en/UI/Blazor/Page-Layout.md
@@ -13,6 +13,37 @@ Title is used to render page title in the PageHeader.
}
```
+## MenuItemName
+Indicates current selected menu item name. Menu item name should match a unique menu item name defined using the [Navigation / Menu system](../Blazor/Navigation-Menu.md). In this case, it is expected from the theme to make the menu item "active" in the main menu.
+
+```csharp
+@inject PageLayout PageLayout
+
+@code {
+ protected override async Task OnInitializedAsync()
+ {
+ PageLayout.MenuItemName = "MyProjectName.Products";
+ }
+}
+```
+
+Menu item name can be set on runtime too.
+
+```html
+@inject PageLayout PageLayout
+
+
+
+@code{
+ protected void SetCategoriesMenuAsSelected()
+ {
+ PageLayout.MenuItemName = "MyProjectName.Categories";
+ }
+}
+```
+
+> Be aware, The [Basic Theme](../Blazor/Basic-Theme.md) currently doesn't support the selected menu item since it is not applicable to the top menu.
+
## BreadCrumbs
BreadCrumbItems are used to render breadcrumbs in the PageHeader.
```csharp
diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json
index 186eef1e07..e6f4e89ff0 100644
--- a/docs/en/docs-nav.json
+++ b/docs/en/docs-nav.json
@@ -2,7 +2,17 @@
"items": [
{
"text": "Quick Start",
- "path": "Tutorials/Todo/Index.md"
+ "path": "Tutorials/Todo/Overall.md",
+ "items": [
+ {
+ "text": "With single-layer solution",
+ "path": "Tutorials/Todo/Single-Layer/Index.md"
+ },
+ {
+ "text": "With layered architecture",
+ "path": "Tutorials/Todo/Index.md"
+ }
+ ]
},
{
"text": "Getting Started",
@@ -118,6 +128,10 @@
"text": "Application",
"path": "Startup-Templates/Application.md"
},
+ {
+ "text": "Application (Single Layer)",
+ "path": "Startup-Templates/Application-Single-Layer.md"
+ },
{
"text": "Module",
"path": "Startup-Templates/Module.md"
diff --git a/docs/en/images/bookstore-single-layer-solution-structure.png b/docs/en/images/bookstore-single-layer-solution-structure.png
new file mode 100644
index 0000000000..edc495d909
Binary files /dev/null and b/docs/en/images/bookstore-single-layer-solution-structure.png differ
diff --git a/docs/en/images/simple-razor-plug-in-dll-file.png b/docs/en/images/simple-razor-plug-in-dll-file.png
index 06b7a565fe..9561941952 100644
Binary files a/docs/en/images/simple-razor-plug-in-dll-file.png and b/docs/en/images/simple-razor-plug-in-dll-file.png differ
diff --git a/docs/en/images/single-layer-angular-folder-structure.png b/docs/en/images/single-layer-angular-folder-structure.png
new file mode 100644
index 0000000000..91fe09d61e
Binary files /dev/null and b/docs/en/images/single-layer-angular-folder-structure.png differ
diff --git a/docs/en/images/single-layer-folder-structure.png b/docs/en/images/single-layer-folder-structure.png
new file mode 100644
index 0000000000..06aa77049c
Binary files /dev/null and b/docs/en/images/single-layer-folder-structure.png differ
diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln
index f92a9d336b..fadd40bcc5 100644
--- a/framework/Volo.Abp.sln
+++ b/framework/Volo.Abp.sln
@@ -407,6 +407,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Gdpr.Abstractions"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.RemoteServices", "src\Volo.Abp.RemoteServices\Volo.Abp.RemoteServices.csproj", "{EDFFDA74-090D-439C-A58D-06CCF86D4423}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.PlugIn", "test\Volo.Abp.AspNetCore.Mvc.PlugIn\Volo.Abp.AspNetCore.Mvc.PlugIn.csproj", "{C6D6D878-208A-4FD2-822E-365545D8681B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1213,6 +1215,10 @@ Global
{EDFFDA74-090D-439C-A58D-06CCF86D4423}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDFFDA74-090D-439C-A58D-06CCF86D4423}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDFFDA74-090D-439C-A58D-06CCF86D4423}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C6D6D878-208A-4FD2-822E-365545D8681B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C6D6D878-208A-4FD2-822E-365545D8681B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C6D6D878-208A-4FD2-822E-365545D8681B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C6D6D878-208A-4FD2-822E-365545D8681B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1418,6 +1424,7 @@ Global
{E5FCE710-C5A3-4F94-B9C9-BD1E99252BFB} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{3683340D-92F5-4B14-B77B-34A163333309} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{EDFFDA74-090D-439C-A58D-06CCF86D4423} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
+ {C6D6D878-208A-4FD2-822E-365545D8681B} = {447C8A77-E5F0-4538-8687-7383196D04EA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageLayout.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageLayout.cs
index 618445bd83..3edbb9dc45 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageLayout.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Layout/PageLayout.cs
@@ -1,5 +1,6 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Runtime.CompilerServices;
using Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars;
using Volo.Abp.BlazoriseUI;
using Volo.Abp.DependencyInjection;
@@ -11,19 +12,32 @@ public class PageLayout : IScopedDependency, INotifyPropertyChanged
private string title;
// TODO: Consider using this property for setting Page Title too.
- public virtual string Title
- {
+ public virtual string Title {
get => title;
- set
- {
+ set {
title = value;
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Title)));
+ OnPropertyChanged();
}
}
+ private string menuItemName;
+
+ public string MenuItemName {
+ get => menuItemName;
+ set {
+ menuItemName = value;
+ OnPropertyChanged();
+ }
+ }
+
public virtual ObservableCollection BreadcrumbItems { get; set; } = new();
public virtual ObservableCollection ToolbarItems { get; set; } = new();
public event PropertyChangedEventHandler PropertyChanged;
+
+ protected void OnPropertyChanged([CallerMemberName]string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs b/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs
index 9b6c261392..241c3dd7a8 100644
--- a/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs
+++ b/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs
@@ -94,13 +94,22 @@ public static class AutofacRegistration
throw new ArgumentNullException(nameof(services));
}
- builder.RegisterType().As().ExternallyOwned();
+ builder.RegisterType()
+ .As()
+ .As()
+ .ExternallyOwned();
+
var autofacServiceScopeFactory = typeof(AutofacServiceProvider).Assembly.GetType("Autofac.Extensions.DependencyInjection.AutofacServiceScopeFactory");
if (autofacServiceScopeFactory == null)
{
throw new AbpException("Unable get type of Autofac.Extensions.DependencyInjection.AutofacServiceScopeFactory!");
}
- builder.RegisterType(autofacServiceScopeFactory).As();
+
+ // Issue #83: IServiceScopeFactory must be a singleton and scopes must be flat, not hierarchical.
+ builder
+ .RegisterType(autofacServiceScopeFactory)
+ .As()
+ .SingleInstance();
Register(builder, services, lifetimeScopeTagForSingletons);
}
diff --git a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
index 7ce82c1c9e..d8d2b83e5a 100644
--- a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
+++ b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
index aabd5c6dfd..6ee6a74a47 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs
@@ -132,6 +132,11 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency
if (!response.IsNullOrWhiteSpace())
{
Logger.LogError(response);
+
+ if (response.Contains("Commercial.SuiteTemplates.dll"))
+ {
+ Logger.LogInformation("The solution should be built before generating an entity! Use `dotnet build` to build your solution.");
+ }
}
else
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs
index 3984f0ca08..71cf789c9c 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs
@@ -236,13 +236,13 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency
private void RunNpmInstall(string directory)
{
Logger.LogInformation($"Running npm install on {directory}");
- CmdHelper.RunCmd($"cd {directory} && npm install");
+ CmdHelper.RunCmd($"npm install", directory);
}
private void RunYarn(string directory)
{
Logger.LogInformation($"Running Yarn on {directory}");
- CmdHelper.RunCmd($"cd {directory} && yarn");
+ CmdHelper.RunCmd($"yarn", directory);
}
private bool IsNpmInstalled()
@@ -253,7 +253,7 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency
private bool IsYarnAvailable()
{
- var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g").Trim();
+ var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g --depth 0").Trim();
if (output.Contains("empty"))
{
return false;
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs
similarity index 93%
rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs
rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs
index e781accafe..c376397a3d 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs
@@ -4,7 +4,7 @@ using Volo.Abp.Cli.ProjectBuilding.Building;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App;
-public class AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep
+public class AngularEnvironmentFilePortChangeForSeparatedAuthServersStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
index 0e268d6705..45a3a228d3 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
@@ -283,7 +283,7 @@ public abstract class AppTemplateBase : TemplateInfo
context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server"))
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds"));
- steps.Add(new BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep());
+ steps.Add(new BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep());
steps.Add(new AppTemplateChangeDbMigratorPortSettingsStep("44300"));
}
else
@@ -368,12 +368,12 @@ public abstract class AppTemplateBase : TemplateInfo
context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server"))
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds"));
- steps.Add(new AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep());
+ steps.Add(new AngularEnvironmentFilePortChangeForSeparatedAuthServersStep());
steps.Add(new AppTemplateChangeDbMigratorPortSettingsStep("44300"));
if (context.BuildArgs.MobileApp == MobileApp.ReactNative)
{
- steps.Add(new ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep());
+ steps.Add(new ReactEnvironmentFilePortChangeForSeparatedAuthServersStep());
}
}
else
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs
index 4eb9867117..b37736696f 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs
@@ -6,16 +6,16 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App;
public class AppTemplateChangeConsoleTestClientPortSettingsStep : ProjectBuildPipelineStep
{
public string RemoteServicePort { get; }
- public string IdentityServerPort { get; }
+ public string AuthServerPort { get; }
///
- /// Assumed same as the if leaved as null.
+ /// Assumed same as the if leaved as null.
public AppTemplateChangeConsoleTestClientPortSettingsStep(
string remoteServicePort,
- string identityServerPort = null)
+ string authServerPort = null)
{
RemoteServicePort = remoteServicePort;
- IdentityServerPort = identityServerPort ?? remoteServicePort;
+ AuthServerPort = authServerPort ?? remoteServicePort;
}
public override void Execute(ProjectBuildContext context)
@@ -23,6 +23,6 @@ public class AppTemplateChangeConsoleTestClientPortSettingsStep : ProjectBuildPi
context
.GetFile("/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json")
.ReplaceText("44300", RemoteServicePort)
- .ReplaceText("44301", IdentityServerPort);
+ .ReplaceText("44301", AuthServerPort);
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs
index d8665c0d6d..81c4ad3304 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs
@@ -5,19 +5,19 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App;
public class AppTemplateChangeDbMigratorPortSettingsStep : ProjectBuildPipelineStep
{
- public string IdentityServerPort { get; }
+ public string AuthServerPort { get; }
- ///
+ ///
public AppTemplateChangeDbMigratorPortSettingsStep(
- string identityServerPort)
+ string authServerPort)
{
- IdentityServerPort = identityServerPort;
+ AuthServerPort = authServerPort;
}
public override void Execute(ProjectBuildContext context)
{
context
.GetFile("/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json")
- .ReplaceText("44305", IdentityServerPort);
+ .ReplaceText("44305", AuthServerPort);
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs
index 58e4e62225..0eadd103e7 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs
@@ -55,6 +55,15 @@ public class AppTemplateSwitchEntityFrameworkCoreToMongoDbStep : ProjectBuildPip
"MyProjectNameMongoDbModule"
);
+ ChangeNamespaceAndKeyword(
+ context,
+ "/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs",
+ "MyCompanyName.MyProjectName.EntityFrameworkCore",
+ "MyCompanyName.MyProjectName.MongoDB",
+ _hasDbMigrations ? "MyProjectNameEntityFrameworkCoreDbMigrationsModule" : "MyProjectNameEntityFrameworkCoreModule",
+ "MyProjectNameMongoDbModule"
+ );
+
ChangeConnectionStringToMongoDb(
context,
"/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/appsettings.json"
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs
similarity index 92%
rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs
rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs
index 0a89d41a45..8c96082a60 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs
@@ -4,7 +4,7 @@ using Volo.Abp.Cli.ProjectBuilding.Building;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App;
-public class BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep
+public class BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs
similarity index 91%
rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs
rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs
index d0ffe98e34..0750587401 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs
@@ -4,7 +4,7 @@ using Volo.Abp.Cli.ProjectBuilding.Building;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App;
-public class ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep
+public class ReactEnvironmentFilePortChangeForSeparatedAuthServersStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs
index e34f41a7a5..e3bc11a7c9 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs
@@ -58,8 +58,8 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep
f.Name.Contains("MyCompanyName.MyProjectName.DbMigrator") && f.Name.EndsWith("appsettings.json"));
var appSettingsJsonObject = JObject.Parse(dbMigratorAppSettings.Content);
- var identityServerJsonObject = (JObject)appSettingsJsonObject["IdentityServer"];
- var clientsJsonObject = (JObject)identityServerJsonObject["Clients"];
+ var authServerJsonObject = (JObject)appSettingsJsonObject["IdentityServer"] ?? (JObject)appSettingsJsonObject["OpenIddict"];
+ var clientsJsonObject = (JObject)authServerJsonObject["Clients"] ?? (JObject)authServerJsonObject["Applications"];
if (context.BuildArgs.UiFramework != UiFramework.Blazor)
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
index 64517b1900..135c04feaf 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
@@ -314,13 +314,13 @@ public class NpmPackagesUpdater : ITransientDependency
protected virtual void RunYarn(string fileDirectory)
{
Logger.LogInformation($"Running Yarn on {fileDirectory}");
- CmdHelper.RunCmd($"cd {fileDirectory} && yarn");
+ CmdHelper.RunCmd($"yarn", fileDirectory);
}
protected virtual void RunNpmInstall(string fileDirectory)
{
Logger.LogInformation($"Running npm install on {fileDirectory}");
- CmdHelper.RunCmd($"cd {fileDirectory} && npm install");
+ CmdHelper.RunCmd($"npm install", fileDirectory);
}
protected virtual List GetPackageVersionList(JProperty package)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs
index 4d111cbf73..c9b2473bcb 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs
@@ -14,7 +14,7 @@ public enum NuGetPackageTarget : byte
MongoDB = 9,
SignalR = 10,
Blazor = 11,
- IdentityServer = 12,
+ IdentityServer = 12, //todo: Rename to AuthServer
BlazorServer = 13,
BlazorWebAssembly = 14
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs
index f4adfd4cf0..fbd8cdb599 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs
@@ -23,7 +23,8 @@ public static class ProjectFinder
case NuGetPackageTarget.Web:
return FindProjectEndsWith(projectFiles, assemblyNames, ".Web");
case NuGetPackageTarget.IdentityServer:
- return FindProjectEndsWith(projectFiles, assemblyNames, ".IdentityServer");
+ return FindProjectEndsWith(projectFiles, assemblyNames, ".IdentityServer") ??
+ FindProjectEndsWith(projectFiles, assemblyNames, ".AuthServer");
case NuGetPackageTarget.EntityFrameworkCore:
return FindProjectEndsWith(projectFiles, assemblyNames, ".EntityFrameworkCore");
case NuGetPackageTarget.MongoDB:
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs
index 4ca0e646e8..165c915c3a 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs
@@ -396,6 +396,6 @@ public class ProjectNugetPackageAdder : ITransientDependency
return projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath)
.Any(p => p.EndsWith(".HttpApi.Host"))
&& projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath)
- .Any(p => p.EndsWith(".IdentityServer"));
+ .Any(p => p.EndsWith(".IdentityServer") || p.EndsWith(".AuthServer"));
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
index 2bfcad2d32..8aa17596a2 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
@@ -804,6 +804,6 @@ public class SolutionModuleAdder : ITransientDependency
return projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath)
.Any(p => p.EndsWith(".HttpApi.Host"))
&& projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath)
- .Any(p => p.EndsWith(".IdentityServer"));
+ .Any(p => p.EndsWith(".IdentityServer") || p.EndsWith(".AuthServer"));
}
}
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs
index faab005376..a2448190a5 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs
@@ -253,8 +253,6 @@ public static class Check
return value;
}
-
-
public static Int16 Range(
Int16 value,
[InvokerParameterName][NotNull] string parameterName,
@@ -307,10 +305,10 @@ public static class Check
{
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
}
-
return value;
}
+
public static double Range(
double value,
[InvokerParameterName][NotNull] string parameterName,
@@ -340,4 +338,21 @@ public static class Check
return value;
}
+ public static T NotDefaultOrNull(
+ T? value,
+ [InvokerParameterName][NotNull] string parameterName)
+ where T : struct
+ {
+ if (value == null)
+ {
+ throw new ArgumentException($"{parameterName} is null!", parameterName);
+ }
+
+ if (value.Value.Equals(default(T)))
+ {
+ throw new ArgumentException($"{parameterName} has a default value!", parameterName);
+ }
+
+ return value.Value;
+ }
}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/MyPlungInModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/MyPlungInModule.cs
new file mode 100644
index 0000000000..5f007720b3
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/MyPlungInModule.cs
@@ -0,0 +1,22 @@
+using Microsoft.AspNetCore.Mvc.ApplicationParts;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.AspNetCore.Mvc.PlugIn;
+
+[DependsOn(typeof(AbpAspNetCoreMvcUiThemeSharedModule))]
+public class MyPlungInModule : AbpModule
+{
+ public override void PreConfigureServices(ServiceConfigurationContext context)
+ {
+ PreConfigure(mvcBuilder =>
+ {
+ //Add plugin assembly
+ mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(typeof(MyPlungInModule).Assembly));
+
+ //Add CompiledRazorAssemblyPart if the PlugIn module contains razor views.
+ mvcBuilder.PartManager.ApplicationParts.Add(new CompiledRazorAssemblyPart(typeof(MyPlungInModule).Assembly));
+ });
+ }
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo.Abp.AspNetCore.Mvc.PlugIn.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo.Abp.AspNetCore.Mvc.PlugIn.csproj
new file mode 100644
index 0000000000..91ca2b1312
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo.Abp.AspNetCore.Mvc.PlugIn.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ Library
+ true
+
+
+
+
+
+
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo/Abp/AspNetCore/Mvc/Index.cshtml b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo/Abp/AspNetCore/Mvc/Index.cshtml
new file mode 100644
index 0000000000..6ed75571d1
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo/Abp/AspNetCore/Mvc/Index.cshtml
@@ -0,0 +1,4 @@
+@page
+@model Volo.Abp.AspNetCore.Mvc.PlugIn.Volo.Abp.AspNetCore.Mvc.Index
+
Welcome to my plug-in page
+
This page is located inside a plug-in module! :)
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo/Abp/AspNetCore/Mvc/Index.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo/Abp/AspNetCore/Mvc/Index.cshtml.cs
new file mode 100644
index 0000000000..2570e93950
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.PlugIn/Volo/Abp/AspNetCore/Mvc/Index.cshtml.cs
@@ -0,0 +1,11 @@
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace Volo.Abp.AspNetCore.Mvc.PlugIn.Volo.Abp.AspNetCore.Mvc;
+
+public class Index : PageModel
+{
+ public void OnGet()
+ {
+
+ }
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PlugIn/PlugIn_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PlugIn/PlugIn_Tests.cs
new file mode 100644
index 0000000000..c8519e9612
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PlugIn/PlugIn_Tests.cs
@@ -0,0 +1,18 @@
+using System.Threading.Tasks;
+using Shouldly;
+using Xunit;
+
+namespace Volo.Abp.AspNetCore.Mvc.PlugIn;
+
+public class PlugIn_Tests : AspNetCoreMvcTestBase
+{
+ [Fact]
+ public async Task Get_PlugIn_Views()
+ {
+ var page = await GetResponseAsStringAsync(
+ "/Index"
+ );
+
+ page.ShouldContain("Welcome to my plug-in page");
+ }
+}
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs
index f913b431e7..e26e6ce2c3 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Startup.cs
@@ -1,8 +1,9 @@
-using System;
+using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using Volo.Abp.Modularity.PlugIns;
namespace Volo.Abp.AspNetCore.Mvc;
@@ -10,7 +11,19 @@ public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
- services.AddApplication();
+ services.AddApplication(options =>
+ {
+ var hostEnvironment = services.GetHostingEnvironment();
+#if DEBUG
+ var plugDllInPath = Path.Combine(hostEnvironment.ContentRootPath,
+ @"..\..\..\..\..\Volo.Abp.AspNetCore.Mvc.PlugIn\bin\Debug\net6.0\");
+#else
+ plugDllInPath = Path.Combine(_env.ContentRootPath,
+ @"..\..\..\..\..\Volo.Abp.AspNetCore.Mvc.PlugIn\bin\Release\net6.0\");
+#endif
+
+ options.PlugInSources.AddFolder(plugDllInPath);
+ });
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml
index ec65f49834..ba695a8557 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml
+++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml
@@ -20,7 +20,7 @@
@L["PersonalSettings"]
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs
index c987e5dff6..714141e25a 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs
@@ -1,5 +1,6 @@
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
@@ -7,7 +8,6 @@ using MyCompanyName.MyProjectName.Menus;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
@@ -21,6 +21,7 @@ using Volo.Abp.AuditLogging.MongoDB;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.MongoDB;
+using Volo.Abp.Emailing;
using Volo.Abp.FeatureManagement;
using Volo.Abp.FeatureManagement.Blazor.Server;
using Volo.Abp.FeatureManagement.MongoDB;
@@ -57,7 +58,6 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreComponentsServerBasicThemeModule),
@@ -117,13 +117,6 @@ public class MyProjectNameModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -140,6 +133,11 @@ public class MyProjectNameModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
+ if (hostingEnvironment.IsDevelopment())
+ {
+ context.Services.Replace(ServiceDescriptor.Singleton());
+ }
+
ConfigureUrls(configuration);
ConfigureBundles();
ConfigureAutoMapper(context);
@@ -150,7 +148,6 @@ public class MyProjectNameModule : AbpModule
ConfigureAutoApiControllers();
ConfigureBlazorise(context);
ConfigureRouter(context);
- ConfigureAuthentication(context, configuration);
ConfigureMongoDB(context);
}
@@ -189,17 +186,6 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
- {
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureLocalizationServices()
{
Configure(options =>
@@ -338,7 +324,7 @@ public class MyProjectNameModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (IsMultiTenant)
{
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/appsettings.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/appsettings.json
index e08d35f224..7872199c7e 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/appsettings.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/appsettings.json
@@ -6,10 +6,6 @@
"ConnectionStrings": {
"Default": "mongodb://localhost:27017/MyProjectName",
},
- "AuthServer": {
- "Authority": "https://localhost:44300",
- "RequireHttpsMetadata": "false"
- },
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/package.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/package.json
index 49176baf14..4e18681ce6 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/package.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/package.json
@@ -3,7 +3,7 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2",
- "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3",
+ "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.3"
}
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
index 9c350d2ad2..ee53dbd329 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
@@ -18,7 +18,6 @@
-
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs
index b9c8dca8f0..68f79c9fad 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs
@@ -1,5 +1,6 @@
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
@@ -7,7 +8,6 @@ using MyCompanyName.MyProjectName.Menus;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
@@ -20,6 +20,7 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
+using Volo.Abp.Emailing;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.FeatureManagement;
@@ -58,7 +59,6 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAutoMapperModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreComponentsServerBasicThemeModule),
@@ -118,13 +118,6 @@ public class MyProjectNameModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -140,6 +133,11 @@ public class MyProjectNameModule : AbpModule
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
+
+ if (hostingEnvironment.IsDevelopment())
+ {
+ context.Services.Replace(ServiceDescriptor.Singleton());
+ }
ConfigureUrls(configuration);
ConfigureBundles();
@@ -151,7 +149,6 @@ public class MyProjectNameModule : AbpModule
ConfigureAutoApiControllers();
ConfigureBlazorise(context);
ConfigureRouter(context);
- ConfigureAuthentication(context, configuration);
ConfigureEfCore(context);
}
@@ -190,17 +187,6 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
- {
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureLocalizationServices()
{
Configure(options =>
@@ -346,7 +332,7 @@ public class MyProjectNameModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (IsMultiTenant)
{
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/appsettings.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/appsettings.json
index cc9e8226f2..250ecde40e 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/appsettings.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/appsettings.json
@@ -6,10 +6,6 @@
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
},
- "AuthServer": {
- "Authority": "https://localhost:44300",
- "RequireHttpsMetadata": "false"
- },
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/package.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/package.json
index 49176baf14..4e18681ce6 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/package.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/package.json
@@ -3,7 +3,7 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2",
- "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3",
+ "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.3"
}
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj
index 6262e3f303..0f7b4bb850 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj
@@ -16,7 +16,6 @@
-
@@ -70,7 +69,6 @@
-
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs
index 6a9474af7b..791e06e044 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs
@@ -1,13 +1,12 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
-using StackExchange.Redis;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
@@ -19,7 +18,7 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.MongoDB;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
-using Volo.Abp.Caching.StackExchangeRedis;
+using Volo.Abp.Emailing;
using Volo.Abp.FeatureManagement;
using Volo.Abp.FeatureManagement.MongoDB;
using Volo.Abp.Identity;
@@ -52,10 +51,8 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
- typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
// Account module packages
@@ -108,13 +105,6 @@ public class MyProjectNameModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -130,18 +120,22 @@ public class MyProjectNameModule : AbpModule
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
+
+ if (hostingEnvironment.IsDevelopment())
+ {
+ context.Services.Replace(ServiceDescriptor.Singleton());
+ }
ConfigureBundles();
ConfigureMultiTenancy();
ConfigureUrls(configuration);
ConfigureAutoMapper(context);
- ConfigureSwagger(context.Services);
+ ConfigureSwagger(context.Services, configuration);
ConfigureAutoApiControllers();
ConfigureVirtualFiles(hostingEnvironment);
ConfigureLocalization();
- ConfigureAuthentication(context.Services, configuration);
ConfigureCors(context, configuration);
- ConfigureDataProtection(context, configuration, hostingEnvironment);
+ ConfigureDataProtection(context);
ConfigureMongoDB(context);
}
@@ -176,17 +170,6 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureAuthentication(IServiceCollection services, IConfiguration configuration)
- {
- services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureLocalization()
{
Configure(options =>
@@ -246,16 +229,20 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureSwagger(IServiceCollection services)
+ private void ConfigureSwagger(IServiceCollection services, IConfiguration configuration)
{
- services.AddAbpSwaggerGen(
+ services.AddAbpSwaggerGenWithOAuth(
+ configuration["AuthServer:Authority"],
+ new Dictionary
+ {
+ {"MyProjectName", "MyProjectName API"}
+ },
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "MyProjectName API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
- }
- );
+ });
}
private void ConfigureAutoMapper(ServiceConfigurationContext context)
@@ -293,17 +280,9 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureDataProtection(
- ServiceConfigurationContext context,
- IConfiguration configuration,
- IWebHostEnvironment hostingEnvironment)
+ private void ConfigureDataProtection(ServiceConfigurationContext context)
{
- var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
- if (!hostingEnvironment.IsDevelopment())
- {
- var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
- dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
- }
+ context.Services.AddDataProtection().SetApplicationName("MyProjectName");
}
private void ConfigureMongoDB(ServiceConfigurationContext context)
@@ -341,7 +320,7 @@ public class MyProjectNameModule : AbpModule
app.UseRouting();
app.UseCors();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (IsMultiTenant)
{
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/appsettings.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/appsettings.json
index a63bc0eeb8..c500cef5fa 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/appsettings.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/appsettings.json
@@ -8,13 +8,11 @@
"ConnectionStrings": {
"Default": "mongodb://localhost:27017/MyProjectName"
},
- "Redis": {
- "Configuration": "127.0.0.1"
- },
"AuthServer": {
"Authority": "https://localhost:44300",
"RequireHttpsMetadata": "false",
- "SwaggerClientId": "MyProjectName_Swagger"
+ "SwaggerClientId": "MyProjectName_Swagger",
+ "SwaggerClientSecret": "1q2w3e*"
},
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/package.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/package.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
index 1d92ee3dcd..6f37c0395b 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
@@ -16,7 +16,6 @@
-
@@ -71,7 +70,6 @@
-
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs
index bc3a0eea8e..f92833f373 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs
@@ -1,13 +1,12 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
-using StackExchange.Redis;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
@@ -19,7 +18,7 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
-using Volo.Abp.Caching.StackExchangeRedis;
+using Volo.Abp.Emailing;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.FeatureManagement;
@@ -53,11 +52,9 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
- typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
// Account module packages
@@ -110,13 +107,6 @@ public class MyProjectNameModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -132,18 +122,22 @@ public class MyProjectNameModule : AbpModule
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
+
+ if (hostingEnvironment.IsDevelopment())
+ {
+ context.Services.Replace(ServiceDescriptor.Singleton());
+ }
ConfigureBundles();
ConfigureMultiTenancy();
ConfigureUrls(configuration);
ConfigureAutoMapper(context);
- ConfigureSwagger(context.Services);
+ ConfigureSwagger(context.Services, configuration);
ConfigureAutoApiControllers();
ConfigureVirtualFiles(hostingEnvironment);
ConfigureLocalization();
- ConfigureAuthentication(context.Services, configuration);
ConfigureCors(context, configuration);
- ConfigureDataProtection(context, configuration, hostingEnvironment);
+ ConfigureDataProtection(context);
ConfigureEfCore(context);
}
@@ -178,17 +172,6 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureAuthentication(IServiceCollection services, IConfiguration configuration)
- {
- services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureLocalization()
{
Configure(options =>
@@ -248,16 +231,20 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureSwagger(IServiceCollection services)
+ private void ConfigureSwagger(IServiceCollection services, IConfiguration configuration)
{
- services.AddAbpSwaggerGen(
+ services.AddAbpSwaggerGenWithOAuth(
+ configuration["AuthServer:Authority"],
+ new Dictionary
+ {
+ {"MyProjectName", "MyProjectName API"}
+ },
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "MyProjectName API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
- }
- );
+ });
}
private void ConfigureAutoMapper(ServiceConfigurationContext context)
@@ -295,17 +282,9 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureDataProtection(
- ServiceConfigurationContext context,
- IConfiguration configuration,
- IWebHostEnvironment hostingEnvironment)
+ private void ConfigureDataProtection(ServiceConfigurationContext context)
{
- var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
- if (!hostingEnvironment.IsDevelopment())
- {
- var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
- dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
- }
+ context.Services.AddDataProtection().SetApplicationName("MyProjectName");
}
private void ConfigureEfCore(ServiceConfigurationContext context)
@@ -350,7 +329,7 @@ public class MyProjectNameModule : AbpModule
app.UseRouting();
app.UseCors();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (IsMultiTenant)
{
@@ -364,6 +343,10 @@ public class MyProjectNameModule : AbpModule
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "MyProjectName API");
+
+ var configuration = context.GetConfiguration();
+ options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
+ options.OAuthScopes("MyProjectName");
});
app.UseAuditing();
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/appsettings.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/appsettings.json
index 6c9d002cc6..0b445a8d83 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/appsettings.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/appsettings.json
@@ -8,13 +8,11 @@
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
},
- "Redis": {
- "Configuration": "127.0.0.1"
- },
"AuthServer": {
"Authority": "https://localhost:44300",
"RequireHttpsMetadata": "false",
- "SwaggerClientId": "MyProjectName_Swagger"
+ "SwaggerClientId": "MyProjectName_Swagger",
+ "SwaggerClientSecret": "1q2w3e*"
},
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/package.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/package.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj
index 1c770c1fe4..acc37e1b83 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj
@@ -16,7 +16,6 @@
-
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs
index 7a0d97014a..6a8a0d533a 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs
@@ -1,11 +1,11 @@
-using Microsoft.OpenApi.Models;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName.Menus;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
@@ -16,6 +16,8 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.MongoDB;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
+using Volo.Abp.MongoDB;
+using Volo.Abp.Emailing;
using Volo.Abp.FeatureManagement;
using Volo.Abp.FeatureManagement.MongoDB;
using Volo.Abp.Identity;
@@ -52,7 +54,6 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
@@ -110,13 +111,6 @@ public class MyProjectNameModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -132,6 +126,11 @@ public class MyProjectNameModule : AbpModule
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
+
+ if (hostingEnvironment.IsDevelopment())
+ {
+ context.Services.Replace(ServiceDescriptor.Singleton());
+ }
ConfigureMultiTenancy();
ConfigureUrls(configuration);
@@ -142,7 +141,6 @@ public class MyProjectNameModule : AbpModule
ConfigureAutoApiControllers();
ConfigureVirtualFiles(hostingEnvironment);
ConfigureLocalization();
- ConfigureAuthentication(context.Services, configuration);
ConfigureMongoDB(context);
}
@@ -176,17 +174,6 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureAuthentication(IServiceCollection services, IConfiguration configuration)
- {
- services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureLocalization()
{
Configure(options =>
@@ -314,7 +301,7 @@ public class MyProjectNameModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (IsMultiTenant)
{
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/appsettings.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/appsettings.json
index 97ad461966..f64cfd6c90 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/appsettings.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/appsettings.json
@@ -5,10 +5,6 @@
"ConnectionStrings": {
"Default": "mongodb://localhost:27017/MyProjectName"
},
- "AuthServer": {
- "Authority": "https://localhost:44300",
- "RequireHttpsMetadata": "false"
- },
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/package.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/package.json
index 6f6bdf156d..275f57d06b 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/package.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "~5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "~5.3.0-rc.3"
}
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj
index f73e132e84..1d584562a0 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj
@@ -16,7 +16,6 @@
-
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs
index 7f7a7a4da9..03833bdbf8 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs
@@ -1,11 +1,11 @@
-using Microsoft.OpenApi.Models;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName.Menus;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
@@ -16,6 +16,7 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
+using Volo.Abp.Emailing;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.FeatureManagement;
@@ -54,7 +55,6 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAutoMapperModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
@@ -112,13 +112,6 @@ public class MyProjectNameModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -134,6 +127,11 @@ public class MyProjectNameModule : AbpModule
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
+
+ if (hostingEnvironment.IsDevelopment())
+ {
+ context.Services.Replace(ServiceDescriptor.Singleton());
+ }
ConfigureMultiTenancy();
ConfigureUrls(configuration);
@@ -144,7 +142,6 @@ public class MyProjectNameModule : AbpModule
ConfigureAutoApiControllers();
ConfigureVirtualFiles(hostingEnvironment);
ConfigureLocalization();
- ConfigureAuthentication(context.Services, configuration);
ConfigureEfCore(context);
}
@@ -179,17 +176,6 @@ public class MyProjectNameModule : AbpModule
});
}
- private void ConfigureAuthentication(IServiceCollection services, IConfiguration configuration)
- {
- services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureLocalization()
{
Configure(options =>
@@ -323,7 +309,7 @@ public class MyProjectNameModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (IsMultiTenant)
{
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/appsettings.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/appsettings.json
index 74bc952883..4d95841d08 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/appsettings.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/appsettings.json
@@ -5,10 +5,6 @@
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
},
- "AuthServer": {
- "Authority": "https://localhost:44300",
- "RequireHttpsMetadata": "false"
- },
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/package.json b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/package.json
index 6f6bdf156d..275f57d06b 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/package.json
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "~5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "~5.3.0-rc.3"
}
}
diff --git a/templates/app/angular/package.json b/templates/app/angular/package.json
index da804c260e..5330a04e5a 100644
--- a/templates/app/angular/package.json
+++ b/templates/app/angular/package.json
@@ -12,14 +12,14 @@
},
"private": true,
"dependencies": {
- "@abp/ng.account": "~5.3.0-rc.2",
- "@abp/ng.components": "~5.3.0-rc.2",
- "@abp/ng.core": "~5.3.0-rc.2",
- "@abp/ng.identity": "~5.3.0-rc.2",
- "@abp/ng.setting-management": "~5.3.0-rc.2",
- "@abp/ng.tenant-management": "~5.3.0-rc.2",
- "@abp/ng.theme.basic": "~5.3.0-rc.2",
- "@abp/ng.theme.shared": "~5.3.0-rc.2",
+ "@abp/ng.account": "~5.3.0-rc.3",
+ "@abp/ng.components": "~5.3.0-rc.3",
+ "@abp/ng.core": "~5.3.0-rc.3",
+ "@abp/ng.identity": "~5.3.0-rc.3",
+ "@abp/ng.setting-management": "~5.3.0-rc.3",
+ "@abp/ng.tenant-management": "~5.3.0-rc.3",
+ "@abp/ng.theme.basic": "~5.3.0-rc.3",
+ "@abp/ng.theme.shared": "~5.3.0-rc.3",
"@angular/animations": "~13.3.3",
"@angular/common": "~13.3.3",
"@angular/compiler": "~13.3.3",
@@ -34,7 +34,7 @@
"zone.js": "~0.11.4"
},
"devDependencies": {
- "@abp/ng.schematics": "~5.3.0-rc.2",
+ "@abp/ng.schematics": "~5.3.0-rc.3",
"@angular-devkit/build-angular": "~13.3.3",
"@angular-eslint/builder": "~13.2.1",
"@angular-eslint/eslint-plugin": "~13.2.1",
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
index 05ea1c90ea..225033259f 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
@@ -48,13 +48,6 @@ public class MyProjectNameAuthServerModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/package.json
index e65907860e..05f221aeb4 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/package.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/package.json
@@ -3,6 +3,6 @@
"name": "my-app-authserver",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/package.json
index 49176baf14..4e18681ce6 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/package.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/package.json
@@ -3,7 +3,7 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2",
- "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3",
+ "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.3"
}
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
index e1295a33c7..299bec9d66 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
@@ -26,7 +26,6 @@
-
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs
index a01ea41953..4c4ad943ad 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs
@@ -1,4 +1,3 @@
-using System;
using System.IO;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
@@ -14,7 +13,6 @@ using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName.MultiTenancy;
using Volo.Abp;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
@@ -50,7 +48,6 @@ namespace MyCompanyName.MyProjectName.Blazor.Server;
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebOpenIddictModule),
typeof(AbpAspNetCoreComponentsServerBasicThemeModule),
@@ -74,13 +71,6 @@ public class MyProjectNameBlazorModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -99,7 +89,6 @@ public class MyProjectNameBlazorModule : AbpModule
ConfigureUrls(configuration);
ConfigureBundles();
- ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureLocalizationServices();
@@ -145,17 +134,6 @@ public class MyProjectNameBlazorModule : AbpModule
});
}
- private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
- {
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
{
if (hostingEnvironment.IsDevelopment())
@@ -283,7 +261,7 @@ public class MyProjectNameBlazorModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (MultiTenancyConsts.IsEnabled)
{
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/package.json
index 49176baf14..4e18681ce6 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/package.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/package.json
@@ -3,7 +3,7 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2",
- "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3",
+ "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.3"
}
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json
index 4b7a8f4029..5131851809 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json
@@ -12,7 +12,7 @@
"Authority": "https://localhost:44301",
"RequireHttpsMetadata": "true",
"SwaggerClientId": "MyProjectName_Swagger"
-},
+ },
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj
index 7dd3166a17..0049c0b35b 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj
@@ -15,7 +15,6 @@
-
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs
index fc8211ee43..428290c240 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs
@@ -2,14 +2,11 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Net.Http;
-using System.Text;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.IdentityModel.Tokens;
using MyCompanyName.MyProjectName.EntityFrameworkCore;
using MyCompanyName.MyProjectName.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
@@ -17,7 +14,6 @@ using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
@@ -27,7 +23,6 @@ using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
-using Volo.Abp.OpenIddict;
using Volo.Abp.Swashbuckle;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
@@ -41,7 +36,6 @@ namespace MyCompanyName.MyProjectName;
typeof(MyProjectNameApplicationModule),
typeof(MyProjectNameEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAccountWebOpenIddictModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
@@ -50,13 +44,6 @@ public class MyProjectNameHttpApiHostModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -76,7 +63,6 @@ public class MyProjectNameHttpApiHostModule : AbpModule
ConfigureBundles();
ConfigureUrls(configuration);
ConfigureConventionalControllers();
- ConfigureAuthentication(context, configuration);
ConfigureLocalization();
ConfigureVirtualFileSystem(context);
ConfigureCors(context, configuration);
@@ -138,23 +124,6 @@ public class MyProjectNameHttpApiHostModule : AbpModule
});
}
- private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
- {
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- options.BackchannelHttpHandler = new HttpClientHandler
- {
- ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
- };
-
- options.MapInboundClaims = false;
- });
- }
-
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAbpSwaggerGenWithOAuth(
@@ -241,7 +210,7 @@ public class MyProjectNameHttpApiHostModule : AbpModule
app.UseRouting();
app.UseCors();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (MultiTenancyConsts.IsEnabled)
{
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj
index daecf98955..8bedd81ba4 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj
@@ -42,7 +42,6 @@
-
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs
index 82e7a4b7bd..22e6446be7 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs
@@ -12,7 +12,6 @@ using MyCompanyName.MyProjectName.Web.Menus;
using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
@@ -49,7 +48,6 @@ namespace MyCompanyName.MyProjectName.Web;
typeof(AbpSettingManagementWebModule),
typeof(AbpAccountWebModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpTenantManagementWebModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
@@ -78,7 +76,6 @@ public class MyProjectNameWebModule : AbpModule
ConfigureUrls(configuration);
ConfigureBundles();
- ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureLocalizationServices();
@@ -109,17 +106,6 @@ public class MyProjectNameWebModule : AbpModule
});
}
- private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
- {
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
- }
-
private void ConfigureAutoMapper()
{
Configure(options =>
@@ -231,7 +217,6 @@ public class MyProjectNameWebModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
if (MultiTenancyConsts.IsEnabled)
{
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/appsettings.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/appsettings.json
index cf1965742b..aa65a91573 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/appsettings.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/appsettings.json
@@ -5,10 +5,6 @@
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
},
- "AuthServer": {
- "Authority": "https://localhost:44303",
- "RequireHttpsMetadata": "false"
- },
"StringEncryption": {
"DefaultPassPhrase": "gsKnGZ041HLL4IM8"
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/module/angular/package.json b/templates/module/angular/package.json
index f05c8b9514..ae2b939cb0 100644
--- a/templates/module/angular/package.json
+++ b/templates/module/angular/package.json
@@ -15,14 +15,14 @@
},
"private": true,
"dependencies": {
- "@abp/ng.account": "~5.3.0-rc.2",
- "@abp/ng.components": "~5.3.0-rc.2",
- "@abp/ng.core": "~5.3.0-rc.2",
- "@abp/ng.identity": "~5.3.0-rc.2",
- "@abp/ng.setting-management": "~5.3.0-rc.2",
- "@abp/ng.tenant-management": "~5.3.0-rc.2",
- "@abp/ng.theme.basic": "~5.3.0-rc.2",
- "@abp/ng.theme.shared": "~5.3.0-rc.2",
+ "@abp/ng.account": "~5.3.0-rc.3",
+ "@abp/ng.components": "~5.3.0-rc.3",
+ "@abp/ng.core": "~5.3.0-rc.3",
+ "@abp/ng.identity": "~5.3.0-rc.3",
+ "@abp/ng.setting-management": "~5.3.0-rc.3",
+ "@abp/ng.tenant-management": "~5.3.0-rc.3",
+ "@abp/ng.theme.basic": "~5.3.0-rc.3",
+ "@abp/ng.theme.shared": "~5.3.0-rc.3",
"@angular/animations": "~13.3.3",
"@angular/common": "~13.3.3",
"@angular/compiler": "~13.3.3",
@@ -37,7 +37,7 @@
"zone.js": "~0.11.4"
},
"devDependencies": {
- "@abp/ng.schematics": "~5.3.0-rc.2",
+ "@abp/ng.schematics": "~5.3.0-rc.3",
"@angular-devkit/build-angular": "~13.3.3",
"@angular-eslint/builder": "~13.2.1",
"@angular-eslint/eslint-plugin": "~13.2.1",
diff --git a/templates/module/angular/projects/my-project-name/package.json b/templates/module/angular/projects/my-project-name/package.json
index ca3c1b07be..cfd3740aac 100644
--- a/templates/module/angular/projects/my-project-name/package.json
+++ b/templates/module/angular/projects/my-project-name/package.json
@@ -4,8 +4,8 @@
"peerDependencies": {
"@angular/common": ">=9",
"@angular/core": ">=9",
- "@abp/ng.core": ">=5.3.0-rc.2",
- "@abp/ng.theme.shared": ">=5.3.0-rc.2"
+ "@abp/ng.core": ">=5.3.0-rc.3",
+ "@abp/ng.theme.shared": ">=5.3.0-rc.3"
},
"dependencies": {
"tslib": "^2.1.0"
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
index 237ce701f9..d1052473bb 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
@@ -17,7 +17,6 @@
allruntime; build; native; contentfiles; analyzers
-
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
index 831eb154bd..520b4b98de 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
@@ -13,7 +13,6 @@ using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
@@ -77,7 +76,6 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpTenantManagementApplicationModule),
typeof(AbpTenantManagementHttpApiModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(MyProjectNameApplicationContractsModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
@@ -86,13 +84,6 @@ public class MyProjectNameAuthServerModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -156,14 +147,6 @@ public class MyProjectNameAuthServerModule : AbpModule
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
});
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = configuration["AuthServer:ApiName"];
- });
-
Configure(options =>
{
options.KeyPrefix = "MyProjectName:";
@@ -226,7 +209,7 @@ public class MyProjectNameAuthServerModule : AbpModule
app.UseRouting();
app.UseCors();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (MultiTenancyConsts.IsEnabled)
{
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/appsettings.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/appsettings.json
index 70b1fa6216..47304e7fc6 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/appsettings.json
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/appsettings.json
@@ -10,11 +10,6 @@
"Redis": {
"Configuration": "127.0.0.1"
},
- "AuthServer": {
- "Authority": "https://localhost:44301/",
- "RequireHttpsMetadata": "false",
- "ApiName": "MyProjectName"
- },
"OpenIddict": {
"Applications": {
"MyProjectName_Web": {
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/package.json
index e65907860e..05f221aeb4 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/package.json
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/package.json
@@ -3,6 +3,6 @@
"name": "my-app-authserver",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyCompanyName.MyProjectName.Blazor.Server.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyCompanyName.MyProjectName.Blazor.Server.Host.csproj
index b7b66f12ca..fcfd56b48b 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyCompanyName.MyProjectName.Blazor.Server.Host.csproj
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyCompanyName.MyProjectName.Blazor.Server.Host.csproj
@@ -25,7 +25,6 @@
-
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs
index 7dce65bbdb..97e9dfcae0 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Net.Http;
using System.Threading.Tasks;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
@@ -16,7 +15,6 @@ using MyCompanyName.MyProjectName.MultiTenancy;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
-using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme;
using Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
@@ -48,7 +46,6 @@ using Volo.Abp.Swashbuckle;
using Volo.Abp.TenantManagement;
using Volo.Abp.TenantManagement.Blazor.Server;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
-using Volo.Abp.Threading;
using Volo.Abp.UI.Navigation;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
@@ -62,7 +59,6 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host;
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebOpenIddictModule),
typeof(AbpAccountApplicationModule),
@@ -100,13 +96,6 @@ public class MyProjectNameBlazorHostModule : AbpModule
);
});
- PreConfigure(builder =>
- {
- // https://documentation.openiddict.com/configuration/token-formats.html#disabling-jwt-access-token-encryption
- // In production, it is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.
- builder.DisableAccessTokenEncryption();
- });
-
PreConfigure(builder =>
{
builder.AddValidation(options =>
@@ -151,14 +140,6 @@ public class MyProjectNameBlazorHostModule : AbpModule
);
});
- context.Services.AddAuthentication()
- .AddJwtBearer(options =>
- {
- options.Authority = configuration["AuthServer:Authority"];
- options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
- options.Audience = "MyProjectName";
- });
-
if (hostingEnvironment.IsDevelopment())
{
Configure(options =>
@@ -253,7 +234,7 @@ public class MyProjectNameBlazorHostModule : AbpModule
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
- app.UseJwtTokenMiddleware();
+ app.UseAbpOpenIddictValidation();
if (MultiTenancyConsts.IsEnabled)
{
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/appsettings.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/appsettings.json
index 75f6e96512..53f04d8271 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/appsettings.json
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/appsettings.json
@@ -5,9 +5,5 @@
},
"ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Unified;Trusted_Connection=True"
- },
- "AuthServer": {
- "Authority": "https://localhost:44304",
- "RequireHttpsMetadata": "false"
}
}
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/package.json
index 49176baf14..4e18681ce6 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/package.json
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/package.json
@@ -3,7 +3,7 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2",
- "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3",
+ "@abp/aspnetcore.components.server.basictheme": "^5.3.0-rc.3"
}
}
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json
index 02c80e93f1..c2c482a664 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json
@@ -3,6 +3,6 @@
"name": "my-app",
"private": true,
"dependencies": {
- "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.2"
+ "@abp/aspnetcore.mvc.ui.theme.basic": "^5.3.0-rc.3"
}
}