diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 5f974c2da8..696d401fed 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@master
with:
- dotnet-version: 8.0.100-rc.2.23502.2
+ dotnet-version: 8.0.100
- name: chown
run: |
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 67c100c20b..2e28ebc0ea 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -4,104 +4,105 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -111,57 +112,60 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
-
+
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
index 3889b5ec77..d2ea2d3a0b 100644
--- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
+++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json
@@ -18,7 +18,7 @@
"Save": "Save",
"SameUrlAlreadyExist": "Same url already exists if you want to add this post, you should change the url!",
"UrlIsNotValid": "Url is not valid.",
- "UrlNotFound" : "Url not found.",
+ "UrlNotFound": "Url not found.",
"UrlContentNotFound": "Url content not found.",
"Summary": "Summary",
"MostRead": "Most Read",
@@ -171,7 +171,7 @@
"Discord_Page_Announce": "We are happy to announce ABP Community Discord Server!",
"Discord_Page_Description_1": "ABP Community has been growing since day one. We wanted to take it to the next step by creating an official ABP Discord server so the ABP Community can interact with each other using the wonders of instant messaging.",
"Discord_Page_Description_2": "ABP Community Discord Server is the place where you can showcase your creations using ABP Framework, share the tips that worked for you, catch up with the latest news and announcements about ABP Framework, just chat with community members to exchange ideas, and have fun!",
- "Discord_Page_Description_3": "This ABP Community Discord Server is the official one with the ABP Core Team is present on the server to monitor.",
+ "Discord_Page_Description_3": "This ABP Community Discord Server is the official one with the ABP Core Team is present on the server to monitor.",
"Discord_Page_JoinToServer": "Join ABP Discord Server",
"Events_Page_MetaTitle": "ABP Community Events",
"Events_Page_MetaDescription": "The live shows, hosted by the ABP Team, are casual sessions full of community content, demos, Q&A, and discussions around what's happening in ABP.",
@@ -252,6 +252,9 @@
"MostWatched": "Most Watched",
"Articles({0})": "Articles ({0})",
"Videos({0})": "Videos ({0})",
- "LatestArticles": "Latest Articles"
+ "LatestArticles": "Latest Articles",
+ "RaffleHeader": "Hello ABP Community Member!",
+ "RafflesInfo": "
This is the raffle page dedicated to show our appreciation towards you for being an active Community Member. We do ABP Community Talks ,ABP .NET Conference, attend or sponsor to the .NET-related events in which we give away some gifts.
You can follow this page to see the upcoming raffles, attend them, or see previous raffles we draw including the winners.
Thank you for being an active member! See you in the upcoming raffles.",
+ "RafflesInfoTitle": "ABP Community "
}
}
diff --git a/docs/en/Community-Articles/2023-10-23-NET-8-Feature-containers/POST.md b/docs/en/Community-Articles/2023-10-23-NET-8-Feature-containers/POST.md
index dc0f96e726..73bea079a1 100644
--- a/docs/en/Community-Articles/2023-10-23-NET-8-Feature-containers/POST.md
+++ b/docs/en/Community-Articles/2023-10-23-NET-8-Feature-containers/POST.md
@@ -17,8 +17,8 @@ It's important to note that this change only affects the default port used when
If you want your application to continue using port 80, you can still specify it during the application launch or configure it in the application settings.
-* Recommended: Explicitly set the `ASPNETCORE_HTTP_PORTS`, `ASPNETCORE_HTTPS_PORTS``, and `ASPNETCORE_URLS` environment variables to the desired port. Example: `docker run --rm -it -p 9999:80 -e ASPNETCORE_HTTP_PORTS=80 ``
-* Update existing commands and configuration that rely on the expected default port of port 80 to reference port 8080 instead. Example: `docker run --rm -it -p 9999:8080 ``
+* Recommended: Explicitly set the `ASPNETCORE_HTTP_PORTS`, `ASPNETCORE_HTTPS_PORTS`, and `ASPNETCORE_URLS` environment variables to the desired port. Example: `docker run --rm -it -p 9999:80 -e ASPNETCORE_HTTP_PORTS=80 `
+* Update existing commands and configuration that rely on the expected default port of port 80 to reference port 8080 instead. Example: `docker run --rm -it -p 9999:8080 `
> The `dockerfile` of ABP templates has been updated to use port `80`.
diff --git a/docs/en/Community-Articles/2023-11-05-EF-Core-8-Complex-Types/POST.MD b/docs/en/Community-Articles/2023-11-05-EF-Core-8-Complex-Types/POST.MD
index 06289387e5..f11dec060d 100644
--- a/docs/en/Community-Articles/2023-11-05-EF-Core-8-Complex-Types/POST.MD
+++ b/docs/en/Community-Articles/2023-11-05-EF-Core-8-Complex-Types/POST.MD
@@ -105,7 +105,7 @@ And update the database:
dotnet ef database update
````
-If you check the fields of the `Customers` table in your dayabase, you will see the following fields:
+If you check the fields of the `Customers` table in your database, you will see the following fields:
* `Id`
* `Name`
@@ -180,7 +180,7 @@ For more details and examples, see the Microsoft's document in the *References*
You can find the sample project here:
-https://github.com/hikalkan/samples/tree/master/EfCoreComplexTypeDemo
+[https://github.com/hikalkan/samples/tree/master/EfCoreComplexTypeDemo](https://github.com/hikalkan/samples/tree/master/EfCoreComplexTypeDemo)
## References
diff --git a/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/Post.md b/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/Post.md
index a346b6f084..c3203d481d 100644
--- a/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/Post.md
+++ b/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/Post.md
@@ -1,6 +1,9 @@
# Blazor's History and Full-stack Web UI
-Blazor is a web framework that allows developers to build interactive web applications using .NET instead of JavaScript. The first version of Blazor was **released on May 14, 2020**. Since its initial release, Blazor has evolved with the new versions. Until now, six different versions have been declared. Sometimes, it can be not very clear to see the differences between these approaches. First, let's try to understand these.
+
+
+
+Blazor is a web framework that allows developers to build interactive web applications using .NET instead of JavaScript. The first version of Blazor was released on May 14, 2020. Since its initial release, Blazor has evolved with the new versions. Until now, six different versions have been declared. Sometimes, it can be not very clear to see the differences between these approaches. First, let's try to understand these.
* **Blazor-Server**: >> *Loads fast at first* >> In this version, heavy things are done in the server. Browsers are thin clients and download a small page for the first load. The page updates are done via SignalR connection. This was released with .NET Core 3.
* **Blazor WebAssembly (WASM):** >> *Loads slow at first* >> In this version, some binary files are being downloaded to the browser. This approach takes longer initialization time than the "Server" approach. The hard work is done on the browser.
@@ -40,7 +43,7 @@ You can switch between two rendering modes and even mix them on the same page. W
- ## How it works?
+## How it works?
### Rendering on Server
@@ -50,25 +53,27 @@ You can add `WebComponentRenderMode.Server` to your Blazor components so that th
-And sure you can add `WebComponentRenderMode.Server` to your page level, and the complete page will be rendered as a server component. All inputs on this page can work as an interactive server component like SPA mode.
+And sure, you can add `WebComponentRenderMode.Server` to your page level, and the complete page will be rendered as a server component. All inputs on this page can work as an interactive server component like SPA mode.

-### Rendering on client
+### Rendering on Client
You can switch to WebAssembly mode by writing `WebComponentRenderMode.WebAssembly` attribute to your page. By doing so, the whole page should run interactively using WebAssembly. This time there's no server connection anymore because it loads the binaries (WebAssembly runtimes) at the page load.

-## How it works?
+
+## Enabling the Blazor Fullstack UI?
To enable Blazor Full-stack Web UI, you need to write `net8.0;net7.0-browser` into the `TargetFrameworks` area of your `csproj` file. These two keywords change your app like this; `net8.0` framework renders on the server, and `net7.0-browser` framework renders on the browser.

-## Let the System decide on WebAssembly or Server approach
+
+## Let the System Decide WebAssembly or Server Approach
You can let the system decide whether it uses `WebAssembly` or `Server`. This can be done with the `Auto` mode of the `WebComponentRenderMode`. In this case, it will not load binary files (WebAssembly files) for the initial page that has `WebComponentRenderMode.Server` attribute, but whenever the user navigates to a page that has `WebComponentRenderMode.WebAssembly`, it will download the runtimes. This will allow us to load the initial page very fast, and when we need interactivity, we can switch to `WebAssembly` and wait for the binaries to download. But this download will be done one time because it will be cached.
@@ -80,10 +85,10 @@ You can let the system decide whether it uses `WebAssembly` or `Server`. This ca
I summarized the new generation Blazor in a very simple way. This architecture will be useful to everyone who uses Blazor.
-
+---
*Resources:*
-* You can check out Dan Roth's GitHub issue 👉 [github.com/dotnet/aspnetcore/issues/46636](https://github.com/dotnet/aspnetcore/issues/46636).
+* You can check Dan Roth's GitHub issue 👉 [github.com/dotnet/aspnetcore/issues/46636](https://github.com/dotnet/aspnetcore/issues/46636).
* Steven Sanderson's YouTube video is very good for understanding these concepts 👉 [Blazor United Prototype Video](https://youtu.be/48G_CEGXZZM).
diff --git a/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/cover-image.png b/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/cover-image.png
new file mode 100644
index 0000000000..b3f1d6920e
Binary files /dev/null and b/docs/en/Community-Articles/2023-11-06-Blazor-Fullstack-Web-Ui/cover-image.png differ
diff --git a/docs/en/Community-Articles/2023-11-06-EF-Core_Hierarchy-Id/POST.md b/docs/en/Community-Articles/2023-11-06-EF-Core_Hierarchy-Id/POST.md
index 9255c39a5a..a3c143a9c8 100644
--- a/docs/en/Community-Articles/2023-11-06-EF-Core_Hierarchy-Id/POST.md
+++ b/docs/en/Community-Articles/2023-11-06-EF-Core_Hierarchy-Id/POST.md
@@ -76,4 +76,4 @@ await context.SaveChangesAsync();
For more information about hierarchy id, see the following resource:
-https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/whatsnew#hierarchyid-in-net-and-ef-core
+- [https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/whatsnew#hierarchyid-in-net-and-ef-core](https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/whatsnew#hierarchyid-in-net-and-ef-core)
diff --git a/docs/en/Community-Articles/2023-11-16-Upgrading-Your-Existing-Projects-to-NET8/POST.md b/docs/en/Community-Articles/2023-11-16-Upgrading-Your-Existing-Projects-to-NET8/POST.md
new file mode 100644
index 0000000000..cc154ad9c1
--- /dev/null
+++ b/docs/en/Community-Articles/2023-11-16-Upgrading-Your-Existing-Projects-to-NET8/POST.md
@@ -0,0 +1,95 @@
+# Upgrade Your Existing Projects to .NET 8 & ABP 8.0
+
+A new .NET version was released on November 14, 2023 and ABP 8.0 RC.1 shipped based on .NET 8.0 just after Microsoft's .NET 8.0 release. Therefore, it's a good time to see what we need to do to upgrade our existing projects to .NET 8.0.
+
+Despite all the related dependency upgrades and changes made on ABP Framework and ABP Commercial sides, we still need to make some changes. Let's see the required actions that need to be taken in the following sections.
+
+## Installing the .NET 8.0 SDK
+
+To get started with ASP.NET Core in .NET 8.0, you need to install the .NET 8 SDK. You can install it at [https://dotnet.microsoft.com/en-us/download/dotnet/8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).
+
+After installing the SDK & Runtime, you can upgrade your existing ASP.NET Core application to .NET 8.0.
+
+## Updating the Target Framework
+
+First, you need to update all your `*.csproj` files to support .NET 8. Find and replace all your `TargetFramework` definitions in the `*.csproj` files to support .NET 8.0:
+
+```xml
+net8.0
+```
+
+> This and all other changes mentioned in this article have already been done in the ABP Framework and ABP Commercial side, so you would not get any problems related to that.
+
+## Updating Microsoft Package Versions
+
+You are probably using some Microsoft packages in your solution, so you need to update them to the latest .NET 8.0 version. Therefore, update all `Microsoft.AspNetCore.*` and `Microsoft.Extensions.*` packages' references to `8.0.0`.
+
+## Checking the Breaking Changes in .NET 8.0
+
+As I have mentioned earlier in this article, on the ABP Framework & ABP Commercial sides all the related code changes have been made, so you would not get any error related to breaking changes introduced with .NET 8.0. However, you still need to check the [Breaking Changes in .NET 8.0 documentation](https://learn.microsoft.com/en-us/dotnet/core/compatibility/8.0), because the breaking changes listed in this documentation still might affect you. Therefore, read them accordingly and make the related changes in your application, if needed.
+
+## Update Your Global Dotnet CLI Tools (optional)
+
+You can update the global dotnet tools to the latest version by running the `dotnet tool update` command. For example, if you are using EF Core, you can update your `dotnet-ef` CLI tool with the following command:
+
+```bash
+dotnet tool update dotnet-ef --global
+```
+
+## Installing/Restoring the Workloads (required for Blazor WASM & MAUI apps)
+
+The `dotnet workload restore` command installs the workloads needed for a project or a solution. This command analyzes a project or solution to determine which workloads are needed and if you have a .NET MAUI or Blazor-WASM project, you can update your workloads by running the following command in a terminal:
+
+```bash
+dotnet workload restore
+```
+
+## Docker Image Updates
+
+If you are using Docker to automate the deployment of applications, you also need to update your images.
+
+For example, you can update the ASP.NET Core image as follows:
+
+```diff
+- FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim AS base
++ FROM mcr.microsoft.com/dotnet/aspnet:8.0-bullseye-slim AS base
+```
+
+You can check the related images from Docker Hub and update them accordingly:
+
+* [https://hub.docker.com/_/microsoft-dotnet-aspnet/](https://hub.docker.com/_/microsoft-dotnet-aspnet/)
+* [https://hub.docker.com/_/microsoft-dotnet-sdk/](https://hub.docker.com/_/microsoft-dotnet-sdk/)
+* [https://hub.docker.com/_/microsoft-dotnet-runtime/](https://hub.docker.com/_/microsoft-dotnet-runtime/)
+
+## Upgrading Your Existing Projects to ABP 8.0
+
+Updating your application to ABP 8.0 is pretty straight-forward. You first need to upgrade the ABP CLI to version `8.0.0-rc.1` using a command line terminal:
+
+````bash
+dotnet tool update Volo.Abp.Cli -g --version 8.0.0-rc.1
+````
+
+**or install** it if you haven't before:
+
+````bash
+dotnet tool install Volo.Abp.Cli -g --version 8.0.0-rc.1
+````
+
+Then, you can use the `abp update` command to update all the ABP related NuGet and NPM packages in your solution:
+
+```bash
+abp update --version 8.0.0-rc.1
+```
+
+After that, you need to check the migration guide documents, listed below:
+
+* [ABP Framework 7.x to 8.0 Migration Guide](https://docs.abp.io/en/abp/8.0/Migration-Guides/Abp-8_0)
+* [ABP Commercial 7.x to 8.0 Migration Guide](https://docs.abp.io/en/commercial/8.0/migration-guides/v8_0)
+
+> Check these documents carefully and make the related changes in your solution to prevent errors.
+
+## Final Words
+
+That's it! These were all the related steps that need to be taken to upgrade your application to .NET 8 and ABP 8.0. Now, you can enjoy the .NET 8 & ABP 8.0 and benefit from the performance improvements and new features.
+
+Happy Coding 🤗
diff --git a/docs/en/Community-Articles/2023-11-97-AOT-Compilation/Post.md b/docs/en/Community-Articles/2023-11-97-AOT-Compilation/Post.md
index 2b994b59c3..b39a2af339 100644
--- a/docs/en/Community-Articles/2023-11-97-AOT-Compilation/Post.md
+++ b/docs/en/Community-Articles/2023-11-97-AOT-Compilation/Post.md
@@ -39,7 +39,7 @@ I have created a simple console application to test the Native AOT Compilation.
| | Size | Speed |
-| --- | --- | --- |
+| --- | --- | --- |
| .NET 8
_(Self-Contained, Single File)_ | 65938 kb | 00.0051806 ~5ms |
| .NET 7 AOT (default) | 4452 kb | 00.0029823 ~2ms |
| .NET 8 AOT (default) | 1242 kb | 00.0028638 ~2ms |
@@ -65,11 +65,8 @@ Always consider the specific needs and constraints of your project before decidi
Native AOT Compilation is a great feature that improves the performance of .NET applications. It's still in early-stages and not all libraries support it yet. But it's a great beginning for the future of .NET 🚀
-
## Links
- Native AOT deployment overview - .NET | Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/.
--
- Optimize AOT deployments https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/optimizing
--
- What's new in .NET 8 | Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8.
diff --git a/docs/en/Dynamic-Claims.md b/docs/en/Dynamic-Claims.md
new file mode 100644
index 0000000000..3a2ef3ee58
--- /dev/null
+++ b/docs/en/Dynamic-Claims.md
@@ -0,0 +1,80 @@
+# Dynamic Claims
+
+## What is Dynamic Claims and Why do we need it
+
+We use claims-based authentication in ASP.NET Core, It will be store the claims in the cookie or token. But the claims are static, it will be not change after the user re-login. If the user changed its username or role, we still get the old claims.
+
+The `Dynamic Claims` feature is used to dynamically generate claims for the user in each request. You can always get the latest user claims.
+
+## How to use it
+
+This feature is disabled by default. You can enable it by following code:
+
+````csharp
+public override void ConfigureServices(ServiceConfigurationContext context)
+{
+ context.Services.Configure(options =>
+ {
+ options.IsDynamicClaimsEnabled = true;
+ });
+}
+````
+
+If you are using the tiered solution you need to set the `RemoteRefreshUrl` to the Auth Server url in the UI project.
+
+````csharp
+public override void ConfigureServices(ServiceConfigurationContext context)
+{
+ context.Services.Configure(options =>
+ {
+ options.IsDynamicClaimsEnabled = true;
+ options.RemoteRefreshUrl = configuration["AuthServerUrl"] + options.RemoteRefreshUrl;
+ });
+}
+````
+
+Then add the `DynamicClaims` middleware.
+
+````csharp
+public override void OnApplicationInitialization(ApplicationInitializationContext context)
+{
+ // Add this line before UseAuthorization.
+ app.UseDynamicClaims();
+ app.UseAuthorization();
+ //...
+}
+````
+
+## How it works
+
+The `DynamicClaims` middleware will use `IAbpClaimsPrincipalFactory` to dynamically generate claims for the current user(`HttpContext.User`) in each request.
+
+There are two implementations of `IAbpDynamicClaimsPrincipalContributor` for different scenarios.
+
+### IdentityDynamicClaimsPrincipalContributor
+
+This implementation is used for the `Monolithic` solution. It will get the dynamic claims from the `IUserClaimsPrincipalFactory` and add/replace the current user claims.
+It uses cache to improve performance. the cache will be invalidated when the user entity changed.
+
+### RemoteDynamicClaimsPrincipalContributor
+
+This implementation is used for the `Tiered` solution. It will get the dynamic claims from the cache of the Auth Server. It will call the `RemoteRefreshUrl` of the Auth Server to refresh the cache when the cache is invalid.
+
+## IAbpDynamicClaimsPrincipalContributor
+
+If you want to add your own dynamic claims contributor, you can a class that implement the `IAbpDynamicClaimsPrincipalContributor` interface. The framework will call the `ContributeAsync` method when get the dynamic claims.
+
+> It better to use cache to improve performance.
+
+## AbpClaimsPrincipalFactoryOptions
+
+* `IsDynamicClaimsEnabled`: Enable or disable the dynamic claims feature.
+* `RemoteRefreshUrl`: The url of the Auth Server to refresh the cache. It will be used by the `RemoteDynamicClaimsPrincipalContributor`. The default value is `/api/account/dynamic-claims/refresh`.
+* `DynamicClaims`: A list of dynamic claim types, `DynamicClaims contributor`` will only handle the claim type in this list.
+* `ClaimsMap`: A dictionary to map the claim types. This is used when the claim types are different between the Auth Server and the client. Already set up for common claim types by default
+
+## See Also
+
+* [Authorization](Authorization.md)
+* [Claims-based authorization in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/security/authorization/claims)
+* [Mapping, customizing, and transforming claims in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/claims)
diff --git a/docs/en/Migration-Guides/Abp-8_0.md b/docs/en/Migration-Guides/Abp-8_0.md
index 108de6ba98..0bafa8b0c8 100644
--- a/docs/en/Migration-Guides/Abp-8_0.md
+++ b/docs/en/Migration-Guides/Abp-8_0.md
@@ -1,77 +1,282 @@
# ABP Version 8.0 Migration Guide
-This document is a guide for upgrading ABP v7.4.x solutions to ABP v8.0.x.
+This document is a guide for upgrading ABP v7.x solutions to ABP v8.0. There are some changes in this version that may affect your applications, please read it carefully and apply the necessary changes to your application.
+
+> ABP Framework upgraded to .NET 8.0, so you need to move your solutions to .NET 8.0 if you want to use the ABP 8.0. You can check the [Migrate from ASP.NET Core 7.0 to 8.0](https://learn.microsoft.com/en-us/aspnet/core/migration/70-80) documentation.
+
+## Injected the `IDistributedEventBus` Dependency into the `IdentityUserManager`
+
+In this version, `IDistributedEventBus` service has been injected to the `IdentityUserManager` service, to publish a distributed event when the email or username is changed for a user, this was needed because sometimes there may be scenarios where the old email/username is needed for the synchronization purposes.
+
+Therefore, you might need to update the `IdentityUserManager`'s constructor if you have overridden the class and are using it.
+
+> See the issue for more information: https://github.com/abpframework/abp/pull/17990
+
+## Updated Method Signatures in the Bundling System
+
+In this version, ABP Framework introduced the CDN support for bundling. During the development, we have made some improvements on the bundling system and changed some method signatures.
+
+See https://github.com/abpframework/abp/issues/17864 for more information.
+
+## Replaced `IdentityUserLookupAppService` with the `IIdentityUserIntegrationService`
+
+[Integration Services](../Integration-Services.md) are built for module-to-module (or microservice-to-microservice) communication rather than consumed from a UI or a client application as [Application Services](../Application-Services.md) are intended to do.
+
+In that regard, we are discarding the `IIdentityUserLookupAppService` in the Identity Module and moving its functionality to the `IIdentityUserIntegrationService`. Therefore, if you have used that application service directly, use the integration service (`IIdentityUserIntegrationService`) instead. `IIdentityUserLookupAppService` will be removed in thes next versions, so you may need to create a similar service in your application.
+
+> Notice that integration services have no authorization and are not exposed as HTTP API by default.
+Also, if you have overridden the `IdentityUserLookupAppService` and `IdentityUserIntegrationService` classes in your application, you should update these classes' constructors as follows:
+
+*IdentityUserLookupAppService.cs*
+```csharp
+ public IdentityUserLookupAppService(IIdentityUserIntegrationService identityUserIntegrationService)
+ {
+ IdentityUserIntegrationService = identityUserIntegrationService;
+ }
+```
+
+*IdentityUserIntegrationService.cs*
+
+```diff
+ public IdentityUserIntegrationService(
+ IUserRoleFinder userRoleFinder,
++ IdentityUserRepositoryExternalUserLookupServiceProvider userLookupServiceProvider)
+ {
+ UserRoleFinder = userRoleFinder;
++ UserLookupServiceProvider = userLookupServiceProvider;
+ }
+```
+
+## MongoDB Event Bus Enhancements
+
+In this version, we have made some enhancements in the transactional inbox/outbox pattern implementation and defined two new methods: `ConfigureEventInbox` and `ConfigureEventOutbox` for MongoDB Event Box collections.
+
+If you call one of these methods in your DbContext class, then this introduces a breaking-change because if you do it, MongoDB collection names will be changed. Therefore, it should be carefully done since existing (non-processed) event records are not automatically moved to new collection and they will be lost. Existing applications with event records should rename the collection manually while deploying their solutions.
+
+See https://github.com/abpframework/abp/pull/17723 for more information. Also, check the documentation for the related configurations: [Distributed Event Bus](../Distributed-Event-Bus.md)
+
+## Moved the CMS Kit Pages Feature's Routing to a `DynamicRouteValueTransformer`
+
+In this version, we have made some improvements in the [CMS Kit's Pages Feature](../Modules/Cms-Kit/Pages.md), such as moving the routing logic to a `DynamicRouteValueTransformer` and etc...
+
+These enhancements led to some breaking changes as listed below that should be taken care of:
+
+* Page routing has been moved to **DynamicRouteValueTransformer**. If you use `{**slug}` pattern in your routing, it might conflict with new CMS Kit routing.
+* `PageConsts.UrlPrefix` has been removed, instead, the default prefix is *pages* for now. Still `/pages/{slug}` route works for backward compatibility alongside with `/{slug}` route.
+
+* **Endpoints changed:**
+ * `api/cms-kit-public/pages/{slug}` endpoint is changed to `api/cms-kit-public/pages/by-slug?slug={slug}`. Now multiple level of page URLs can be used and `/` characters will be transferred as URL Encoded in querysting to the HTTP API.
+ * `api/cms-kit-public/pages` changed to `api/cms-kit-public/pages/home`
+
+>_CmsKit Client Proxies are updated. If you don't send a **custom request** to this endpoint, **you don't need to take an action**_
+
+## Added Integration Postfix for Auto Controllers
+
+With this version on, the `Integration` suffix from controller names while generating [auto controllers](../API/Auto-API-Controllers.md) are not going to be removed, to differ the integration services from application services in the OpenAPI specification:
+
+
+
+> This should not affect most of the applications since you normally do not depend on the controller names in the client side.
+
+See https://github.com/abpframework/abp/issues/17625 for more information (how to preserve the existing behaviour, etc...).
+
+## Revised the reCaptcha Generator for CMS Kit's Comment Feature
+
+In this version, we have made improvements on the [CMS Kit's Comment Feature](../Modules/Cms-Kit/Comments.md) and revised the reCaptcha generation process, and made a performance improvement.
+
+This introduced some breaking changes that you should aware of:
+
+* Lifetime of the `SimpleMathsCaptchaGenerator` changed from singleton to transient,
+* Changed method signatures for `SimpleMathsCaptchaGenerator` class. (all of its methods are now async)
+
+If you haven't override the comment view component, then you don't need to make any changes, however if you have overriden the component and used the `SimpleMathsCaptchaGenerator` class, then you should make the required changes as described.
+
+## Disabled Logging for `HEAD` HTTP Methods
+
+HTTP GET requests should not make any change in the database normally and audit log system of ABP Framework doesn't save audit log objects for GET requests by default. You can configure the `AbpAuditingOptions` and set the `IsEnabledForGetRequests` to **true** if you want to record _GET_ requests as described in [the documentation](../Audit-Logging.md).
+
+Prior to this version, only the _GET_ requests were not saved as audit logs. From this version on, also the _HEAD_ requests will not be saved as audit logs, if the `IsEnabledForGetRequests` explicitly set as **true**.
+
+You don't need to make any changes related to that, however it's important to know this change.
+
+## Obsolete the `AbpAspNetCoreIntegratedTestBase` Class
+
+In this version, `AbpAspNetCoreAsyncIntegratedTestBase` class has been set as `Obsolete` and it's recommended to use `AbpWebApplicationFactoryIntegratedTest` instead.
+
+## Use NoTracking for readonly repositories for EF core.
+
+In this version, ABP Framework provides read-only [repository](Repositories.md) interfaces (`IReadOnlyRepository<...>` or `IReadOnlyBasicRepository<...>`) to explicitly indicate that your purpose is to query data, but not change it. If so, you can inject these interfaces into your services.
+
+Entity Framework Core read-only repository implementation uses [EF Core's No-Tracking feature](https://learn.microsoft.com/en-us/ef/core/querying/tracking#no-tracking-queries). That means the entities returned from the repository will not be tracked by the EF Core [change tracker](https://learn.microsoft.com/en-us/ef/core/change-tracking/), because it is expected that you won't update entities queried from a read-only repository.
+
+> This behavior works only if the repository object is injected with one of the read-only repository interfaces (`IReadOnlyRepository<...>` or `IReadOnlyBasicRepository<...>`). It won't work if you have injected a standard repository (e.g. `IRepository<...>`) then casted it to a read-only repository interface.
+
+> See the issue for more information: https://github.com/abpframework/abp/pull/17421
+
+## Angular UI
+
+# Guards
+
+From Angular Documentation;
+
+> Class-based **`Route`** guards are deprecated in favor of functional guards.
+
+- Angular has been using functional guards since version 14. According to this situation we have moved our guards to functional guards.
+
+We have modified our modules to adaptate functional guards.
+
+```diff
+- import {AuthGuard, PermissionGuard} from '@abp/ng.core';
++ import {authGuard, permissionGuard} from '@abp/ng.core';
+
+- canActivate: mapToCanActivate([AuthGuard, PermissionGuard])
++ canActivate: [authGuard, permissionGuard]
+```
+
+You can still use class based guards but we recommend it to use functional guards like us :)
## Upgraded NuGet Dependencies
-The following NuGet libraries have been upgraded:
+You can see the following list of NuGet libraries that have been upgraded with .NET 8.0 upgrade, if you are using one of these packages explicitly, you may consider upgrading them in your solution:
| Package | Old Version | New Version |
| ------------------- | ----------- | ----------- |
-| All Microsoft packages | 7.x | 8.x |
-| Microsoft.CodeAnalysis | 4.2.0 | 4.5.0 |
-| NUglify | 1.20.0 | 1.21.0 |
-| Polly | 7.2.3 | 8.0.0 |
-| aliyun-net-sdk-sts | 3.1.0 | 3.1.1 |
-| Autofac | 7.0.0 | 7.1.0 |
-| Autofac.Extras.DynamicProxy | 6.0.1 | 7.1.0 |
-| AutoMapper | 12.0.0 | 12.0.1 |
-| AsyncKeyedLock | 6.2.1 | 6.2.2 |
-| AWSSDK.S3 | 3.7.9.2 | 3.7.205.9 |
-| AWSSDK.SecurityToken | 3.7.1.151 | 3.7.202.4 |
-| Azure.Storage.Blobs | 12.15.0 | 12.18.0 |
-| ConfigureAwait.Fody | 3.3.1 | 3.3.2 |
-| Confluent.Kafka | 1.8.2 | 2.2.0 |
-| Dapper | 2.0.123 | 2.1.4 |
-| Dapr.Client | 1.11.0 | 1.9.0 |
-| DistributedLock.Core | 1.0.4 | 1.0.5 |
-| DistributedLock.Redis | 1.0.1 | 1.0.2 |
-| EphemeralMongo.Core | 1.1.0 | 1.1.3 |
-| EphemeralMongo6.runtime.linux-x64 | 1.1.0 | 1.1.3 |
-| EphemeralMongo6.runtime.osx-x64 | 1.1.0 | 1.1.3 |
-| EphemeralMongo6.runtime.win-x64 | 1.1.0 | 1.1.3 |
-| FluentValidation | 11.0.1 | 11.7.1 |
-| Fody | 6.6.1 | 6.8.0 |
-| Hangfire.AspNetCore | 1.8.2 | 1.8.5 |
-| Hangfire.SqlServer | 1.8.2 | 1.8.5 |
-| HtmlSanitizer | 5.0.331 | 8.0.723 |
-| IdentityModel | 6.0.0 | 6.2.0 |
-| IdentityServer4.AspNetIdentity | 4.1.1 | 4.1.2 |
-| JetBrains.Annotations | 2022.1.0 | 2023.2.0 |
-| LibGit2Sharp | 0.26.2 | 0.27.2 |
-| Magick.NET-Q16-AnyCPU | 13.2.0 | 13.3.0 |
-| MailKit | 3.2.0 | 4.2.0 |
-| Markdig.Signed | 0.26.0 | 0.33.0 |
-| Microsoft.AspNetCore.Mvc.Versioning | 5.0.0 | 5.1.0 |
-| Microsoft.AspNetCore.Razor.Language | 6.0.8 | 6.0.22 |
-| Microsoft.NET.Test.Sdk | 17.2.0 | 17.7.2 |
-| Minio | 4.0.6 | 6.0.0 |
-| MongoDB.Driver | 2.19.1 | 2.21.0 |
-| NEST | 7.14.1 | 7.17.5 |
-| Newtonsoft.Json | 13.0.1 | 13.0.3 |
-| NSubstitute | 4.3.0 | 5.1.0 |
-| NSubstitute.Analyzers.CSharp | 1.0.15 | 1.0.16 |
-| NuGet.Versioning | 5.11.0 | 6.7.0 |
-| Octokit | 0.50.0 | 8.0.1 |
-| Quartz | 3.4.0 | 3.7.0 |
-| Quartz.Extensions.DependencyInjection | 3.4.0 | 3.7.0 |
-| Quartz.Plugins.TimeZoneConverter | 3.4.0 | 3.7.0 |
-| RabbitMQ.Client | 6.3.0 | 6.5.0 |
-| Rebus | 6.6.5 | 7.2.1 |
-| Rebus.ServiceProvider | 7.0.0 | 9.1.0 |
-| Scriban | 5.4.4 | 5.9.0 |
-| Serilog.AspNetCore | 5.0.0 | 7.0.0 |
-| Serilog.Extensions.Hosting | 3.1.0 | 7.0.0 |
-| Serilog.Extensions.Logging | 3.1.0 | 7.0.0 |
-| Serilog.Sinks.Async | 1.4.0 | 1.5.0 |
-| SharpZipLib | 1.3.3 | 1.4.2 |
-| Shouldly | 4.1.0 | 4.2.1 |
-| SixLabors.ImageSharp | 1.0.4 | 3.0.2 |
-| Slugify.Core | 3.0.0 | 4.0.1 |
-| Spectre.Console | 0.46.1-preview.0.7 | 0.47.0 |
-| Swashbuckle.AspNetCore | 6.2.1 | 6.5.0 |
-| System.Linq.Dynamic.Core | 1.3.3 | 1.3.5 |
-| TimeZoneConverter | 5.0.0 | 6.1.0 |
-| xunit | 2.4.1 | 2.5.1 |
-| xunit.extensibility.execution | 2.4.1 | 2.5.1 |
-| xunit.runner.visualstudio | 2.4.5 | 2.5.1 |
+| aliyun-net-sdk-sts | 3.1.0 | 3.1.2 |
+| AsyncKeyedLock | 6.2.1 | 6.2.2 |
+| Autofac | 7.0.0 | 7.1.0 |
+| Autofac.Extras.DynamicProxy | 6.0.1 | 7.1.0 |
+| AutoMapper | 12.0.0 | 12.0.1 |
+| AWSSDK.S3 | 3.7.9.2 | 3.7.300.2 |
+| AWSSDK.SecurityToken | 3.7.1.151 | 3.7.300.2 |
+| Azure.Messaging.ServiceBus | 7.8.1 | 7.17.0 |
+| Azure.Storage.Blobs | 12.15.0 | 12.19.1 |
+| Blazorise | 1.3.1 | 1.3.2 |
+| Blazorise.Bootstrap5 | 1.3.1 | 1.3.2 |
+| Blazorise.Icons.FontAwesome | 1.3.1 | 1.3.2 |
+| Blazorise.Components | 1.3.1 | 1.3.2 |
+| Blazorise.DataGrid | 1.3.1 | 1.3.2 |
+| Blazorise.Snackbar | 1.3.1 | 1.3.2 |
+| Confluent.Kafka | 1.8.2 | 2.3.0 |
+| Dapper | 2.0.123 | 2.1.21 |
+| Dapr.AspNetCore | 1.9.0 | 1.12.0 |
+| Dapr.Client | 1.9.0 | 1.12.0 |
+| Devart.Data.Oracle.EFCore | 10.1.134.7 | 10.1.151.7 |
+| DistributedLock.Core | 1.0.4 | 1.0.5 |
+| DistributedLock.Redis | 1.0.1 | 1.0.2 |
+| EphemeralMongo.Core | 1.1.0 | 1.1.3 |
+| EphemeralMongo6.runtime.linux-x64 | 1.1.0 | 1.1.3 |
+| EphemeralMongo6.runtime.osx-x64 | 1.1.0 | 1.1.3 |
+| EphemeralMongo6.runtime.win-x64 | 1.1.0 | 1.1.3 |
+| FluentValidation | 11.0.1 | 11.8.0 |
+| Hangfire.AspNetCore | 1.8.2 | 1.8.6 |
+| Hangfire.SqlServer | 1.8.2 | 1.8.6 |
+| HtmlSanitizer | 5.0.331 | 8.0.746 |
+| HtmlAgilityPack | 1.11.42 | 1.11.54 |
+| IdentityModel | 6.0.0 | 6.2.0 |
+| IdentityServer4.AspNetIdentity | 4.1.1 | 4.1.2 |
+| JetBrains.Annotations | 2022.1.0 | 2023.3.0 |
+| LibGit2Sharp | 0.26.2 | 0.28.0 |
+| Magick.NET-Q16-AnyCPU | 13.2.0 | 13.4.0 |
+| MailKit | 3.2.0 | 4.3.0 |
+| Markdig.Signed | 0.26.0 | 0.33.0 |
+| Microsoft.AspNetCore.Authentication.JwtBearer | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Authentication.OpenIdConnect | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Authorization | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components.Authorization | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components.Web | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components.WebAssembly | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components.WebAssembly.Authentication | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components.WebAssembly.DevServer | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Components.WebAssembly.Server | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.DataProtection.StackExchangeRedis | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Mvc.NewtonsoftJson | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.Mvc.Versioning | 5.0.0 | 5.1.0 |
+| Microsoft.AspNetCore.Razor.Language | 6.0.8 | 6.0.25 |
+| Microsoft.AspNetCore.TestHost | 7.0.10 | 8.0.0 |
+| Microsoft.AspNetCore.WebUtilities | 2.2.0 | 8.0.0 |
+| Microsoft.Bcl.AsyncInterfaces | 7.0.0 | 8.0.0 |
+| Microsoft.CodeAnalysis.CSharp | 4.2.0 | 4.5.0 |
+| Microsoft.Data.Sqlite | 7.0.0 | 8.0.0 |
+| Microsoft.EntityFrameworkCore | 7.0.10 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.Design | 7.0.0 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.InMemory | 7.0.10 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.Proxies | 7.0.10 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.Relational | 7.0.10 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.Sqlite | 7.0.10 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.SqlServer | 7.0.0 | 8.0.0 |
+| Microsoft.EntityFrameworkCore.Tools | 7.0.1 | 8.0.0 |
+| Microsoft.Extensions.Caching.Memory | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Caching.StackExchangeRedis | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Configuration.Binder | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Configuration.CommandLine | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Configuration.EnvironmentVariables | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Configuration.UserSecrets | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.DependencyInjection | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.DependencyInjection.Abstractions | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.FileProviders.Composite | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.FileProviders.Embedded | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.FileProviders.Physical | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.FileSystemGlobbing | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Hosting | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Hosting.Abstractions | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Http | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Http.Polly| 7.0.10 | 8.0.0 |
+| Microsoft.Extensions.Identity.Core | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Localization | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Logging | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Logging.Console | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Options | 7.0.0 | 8.0.0 |
+| Microsoft.Extensions.Options.ConfigurationExtensions | 7.0.0 | 8.0.0 |
+| Microsoft.NET.Test.Sdk | 17.2.0 | 17.8.0 |
+| Microsoft.VisualStudio.Web.CodeGeneration.Design | 7.0.0 | 8.0.0 |
+| Minio | 4.0.6 | 6.0.1 |
+| MongoDB.Driver | 2.19.1 | 2.22.0 |
+| NEST | 7.14.1 | 7.17.5 |
+| Newtonsoft.Json | 13.0.1 | 13.0.3 |
+| NSubstitute | 4.3.0 | 5.1.0 |
+| NuGet.Versioning | 5.11.0 | 6.7.0 |
+| NUglify | 1.20.0 | 1.21.0 |
+| Npgsql.EntityFrameworkCore.PostgreSQL | 7.0.0 | 8.0.0-rc.2 |
+| NSubstitute.Analyzers.CSharp | 1.0.15 | 1.0.16 |
+| Octokit | 0.50.0 | 9.0.0 |
+| OpenIddict.Abstractions | 4.8.0 | 4.10.0 |
+| OpenIddict.Core | 4.8.0 | 4.10.0 |
+| OpenIddict.Server.AspNetCore | 4.8.0 | 4.10.0 |
+| OpenIddict.Validation.AspNetCore | 4.8.0 | 4.10.0 |
+| OpenIddict.Validation.ServerIntegration | 4.8.0 | 4.10.0 |
+| Oracle.EntityFrameworkCore | 7.21.8 | 7.21.12 |
+| Polly | 7.2.3 | 8.2.0 |
+| Pomelo.EntityFrameworkCore.MySql | 7.0.0 | 8.0.0-beta.1 |
+| Quartz | 3.4.0 | 3.7.0 |
+| Quartz.Extensions.DependencyInjection | 3.4.0 | 3.7.0 |
+| Quartz.Plugins.TimeZoneConverter | 3.4.0 | 3.7.0 |
+| Quartz.Serialization.Json | 3.3.3 | 3.7.0 |
+| RabbitMQ.Client | 6.3.0 | 6.6.0 |
+| Rebus | 6.6.5 | 7.2.1 |
+| Rebus.ServiceProvider | 7.0.0 | 9.1.0 |
+| Scriban | 5.4.4 | 5.9.0 |
+| Serilog | 2.11.0 | 3.1.1 |
+| Serilog.AspNetCore | 5.0.0 | 8.0.0 |
+| Serilog.Extensions.Hosting | 3.1.0 | 8.0.0 |
+| Serilog.Extensions.Logging | 3.1.0 | 8.0.0 |
+| Serilog.Sinks.Async | 1.4.0 | 1.5.0 |
+| Serilog.Sinks.Console | 3.1.1 | 5.0.0 |
+| Serilog.Sinks.File | 4.1.0 | 5.0.0 |
+| SharpZipLib | 1.3.3 | 1.4.2 |
+| Shouldly | 4.0.3 | 4.2.1 |
+| SixLabors.ImageSharp.Drawing | 2.0.0 | 2.0.1 |
+| Slugify.Core | 3.0.0 | 4.0.1 |
+| StackExchange.Redis | 2.6.122 | 2.7.4 |
+| Swashbuckle.AspNetCore | 6.2.1 | 6.5.0 |
+| System.Collections.Immutable | 7.0.0 | 8.0.0 |
+| System.Linq.Dynamic.Core | 1.3.3 | 1.3.5 |
+| System.Security.Permissions | 7.0.0 | 8.0.0 |
+| System.Text.Encoding.CodePages | 7.0.0 | 8.0.0 |
+| System.Text.Encodings.Web | 7.0.0 | 8.0.0 |
+| System.Text.Json | 7.0.0 | 8.0.0 |
+| TimeZoneConverter | 5.0.0 | 6.1.0 |
+| xunit | 2.4.1 | 2.6.1 |
+| xunit.extensibility.execution | 2.4.1 | 2.6.1 |
+| xunit.runner.visualstudio | 2.4.5 | 2.5.3 |
diff --git a/docs/en/Migration-Guides/Index.md b/docs/en/Migration-Guides/Index.md
index 88a2087ba0..e7dfa97f86 100644
--- a/docs/en/Migration-Guides/Index.md
+++ b/docs/en/Migration-Guides/Index.md
@@ -2,6 +2,7 @@
The following documents explain how to migrate your existing ABP applications. We write migration documents only if you need to take an action while upgrading your solution. Otherwise, you can easily upgrade your solution using the [abp update command](../Upgrading.md).
+- [7.x to 8.0](Abp-8_0.md)
- [7.3 to 7.4](Abp-7_4.md)
- [7.2 to 7.3](Abp-7_3.md)
- [7.1 to 7.2](Abp-7_2.md)
diff --git a/docs/en/Migration-Guides/images/integration-postfix-not-removed.png b/docs/en/Migration-Guides/images/integration-postfix-not-removed.png
new file mode 100644
index 0000000000..183a7a57c2
Binary files /dev/null and b/docs/en/Migration-Guides/images/integration-postfix-not-removed.png differ
diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json
index fa0a98915a..80ff5aa501 100644
--- a/docs/en/docs-nav.json
+++ b/docs/en/docs-nav.json
@@ -178,7 +178,13 @@
},
{
"text": "Authorization",
- "path": "Authorization.md"
+ "path": "Authorization.md",
+ "items": [
+ {
+ "text": "Dynamic Claims",
+ "path": "Dynamic-Claims.md"
+ }
+ ]
},
{
"text": "Caching",
diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln
index cd003b7f07..42339a60ac 100644
--- a/framework/Volo.Abp.sln
+++ b/framework/Volo.Abp.sln
@@ -459,6 +459,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Imaging.AspNetCore
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Maui.Client", "src\Volo.Abp.Maui.Client\Volo.Abp.Maui.Client.csproj", "{F19A6E0C-F719-4ED9-A024-14E4B8D40883}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Imaging.SkiaSharp", "src\Volo.Abp.Imaging.SkiaSharp\Volo.Abp.Imaging.SkiaSharp.csproj", "{198683D0-7DC6-40F2-B81B-8E446E70A9DE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Imaging.SkiaSharp.Tests", "test\Volo.Abp.Imaging.SkiaSharp.Tests\Volo.Abp.Imaging.SkiaSharp.Tests.csproj", "{DFAF8763-D1D6-4EB4-B459-20E31007FE2F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1369,6 +1373,14 @@ Global
{F19A6E0C-F719-4ED9-A024-14E4B8D40883}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F19A6E0C-F719-4ED9-A024-14E4B8D40883}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F19A6E0C-F719-4ED9-A024-14E4B8D40883}.Release|Any CPU.Build.0 = Release|Any CPU
+ {198683D0-7DC6-40F2-B81B-8E446E70A9DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {198683D0-7DC6-40F2-B81B-8E446E70A9DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {198683D0-7DC6-40F2-B81B-8E446E70A9DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {198683D0-7DC6-40F2-B81B-8E446E70A9DE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1600,6 +1612,8 @@ Global
{62B2B8C9-8F24-4D31-894F-C1F0728D32AB} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{983B0136-384B-4439-B374-31111FFAA286} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{F19A6E0C-F719-4ED9-A024-14E4B8D40883} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
+ {198683D0-7DC6-40F2-B81B-8E446E70A9DE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
+ {DFAF8763-D1D6-4EB4-B459-20E31007FE2F} = {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/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs
index 74cbd37e29..8df1824e81 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs
@@ -1,9 +1,9 @@
using System.Security.Claims;
using System.Threading.Tasks;
-using JetBrains.Annotations;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection;
+using Volo.Abp.Security.Claims;
namespace Volo.Abp.AspNetCore.Components.Web.Security;
@@ -12,16 +12,18 @@ public class AbpComponentsClaimsCache : IScopedDependency
public ClaimsPrincipal Principal { get; private set; } = default!;
private readonly AuthenticationStateProvider? _authenticationStateProvider;
+ private readonly IAbpClaimsPrincipalFactory _abpClaimsPrincipalFactory;
public AbpComponentsClaimsCache(
IClientScopeServiceProviderAccessor serviceProviderAccessor)
{
_authenticationStateProvider = serviceProviderAccessor.ServiceProvider.GetService();
+ _abpClaimsPrincipalFactory = serviceProviderAccessor.ServiceProvider.GetRequiredService();
if (_authenticationStateProvider != null)
{
_authenticationStateProvider.AuthenticationStateChanged += async (task) =>
{
- Principal = (await task).User;
+ Principal = await _abpClaimsPrincipalFactory.CreateDynamicAsync((await task).User);
};
}
}
@@ -32,6 +34,7 @@ public class AbpComponentsClaimsCache : IScopedDependency
{
var authenticationState = await _authenticationStateProvider.GetAuthenticationStateAsync();
Principal = authenticationState.User;
+ await _abpClaimsPrincipalFactory.CreateDynamicAsync(Principal);
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteDynamicClaimsPrincipalContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteDynamicClaimsPrincipalContributor.cs
new file mode 100644
index 0000000000..d9339b57df
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteDynamicClaimsPrincipalContributor.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Linq;
+using System.Security.Claims;
+using System.Security.Principal;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Volo.Abp.Security.Claims;
+
+namespace Volo.Abp.AspNetCore.Mvc.Client;
+
+public class RemoteDynamicClaimsPrincipalContributor : AbpDynamicClaimsPrincipalContributorBase
+{
+ public async override Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
+ if (identity == null)
+ {
+ return;
+ }
+
+ var userId = identity.FindUserId();
+ if (userId == null)
+ {
+ return;
+ }
+
+ var dynamicClaimsCache = context.GetRequiredService();
+ AbpDynamicClaimCacheItem dynamicClaims;
+ try
+ {
+ dynamicClaims = await dynamicClaimsCache.GetAsync(userId.Value, identity.FindTenantId());
+ }
+ catch (Exception e)
+ {
+ // In case if failed refresh remote dynamic cache, We force to clear the claims principal.
+ context.ClaimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity());
+ var logger = context.GetRequiredService>();
+ logger.LogWarning(e, $"Failed to refresh remote dynamic claims cache for user: {userId.Value}");
+ return;
+ }
+
+ await AddDynamicClaimsAsync(context, identity, dynamicClaims.Claims);
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteDynamicClaimsPrincipalContributorCache.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteDynamicClaimsPrincipalContributorCache.cs
new file mode 100644
index 0000000000..e9b03e847c
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteDynamicClaimsPrincipalContributorCache.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using Microsoft.Extensions.Options;
+using Volo.Abp.Caching;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http.Client;
+using Volo.Abp.Http.Client.Authentication;
+using Volo.Abp.Security.Claims;
+
+namespace Volo.Abp.AspNetCore.Mvc.Client;
+
+public class RemoteDynamicClaimsPrincipalContributorCache : ITransientDependency
+{
+ public const string HttpClientName = nameof(RemoteDynamicClaimsPrincipalContributorCache);
+
+ public ILogger Logger { get; set; }
+ protected IDistributedCache Cache { get; }
+ protected IHttpClientFactory HttpClientFactory { get; }
+ protected IOptions AbpClaimsPrincipalFactoryOptions { get; }
+ protected IRemoteServiceHttpClientAuthenticator HttpClientAuthenticator { get; }
+
+ public RemoteDynamicClaimsPrincipalContributorCache(
+ IDistributedCache cache,
+ IHttpClientFactory httpClientFactory,
+ IOptions abpClaimsPrincipalFactoryOptions,
+ IRemoteServiceHttpClientAuthenticator httpClientAuthenticator)
+ {
+ Cache = cache;
+ HttpClientFactory = httpClientFactory;
+ AbpClaimsPrincipalFactoryOptions = abpClaimsPrincipalFactoryOptions;
+ HttpClientAuthenticator = httpClientAuthenticator;
+
+ Logger = NullLogger.Instance;
+ }
+
+ public virtual async Task GetAsync(Guid userId, Guid? tenantId = null)
+ {
+ Logger.LogDebug($"Get dynamic claims cache for user: {userId}");
+ var dynamicClaims = await Cache.GetAsync(AbpDynamicClaimCacheItem.CalculateCacheKey(userId, tenantId));
+ if (dynamicClaims != null && !dynamicClaims.Claims.IsNullOrEmpty())
+ {
+ return dynamicClaims;
+ }
+
+ Logger.LogDebug($"Refresh dynamic claims for user: {userId} from remote service.");
+ try
+ {
+ var client = HttpClientFactory.CreateClient(HttpClientName);
+ var requestMessage = new HttpRequestMessage(HttpMethod.Post, AbpClaimsPrincipalFactoryOptions.Value.RemoteRefreshUrl);
+ await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, requestMessage, new RemoteServiceConfiguration("/"), string.Empty));
+ var response = await client.SendAsync(requestMessage);
+ response.EnsureSuccessStatusCode();
+ }
+ catch (Exception e)
+ {
+ Logger.LogWarning(e, $"Failed to refresh remote claims for user: {userId}");
+ throw;
+ }
+
+ dynamicClaims = await Cache.GetAsync(AbpDynamicClaimCacheItem.CalculateCacheKey(userId, tenantId));
+ if (dynamicClaims == null || dynamicClaims.Claims.IsNullOrEmpty())
+ {
+ throw new AbpException($"Failed to refresh remote claims for user: {userId}");
+ }
+
+ return dynamicClaims!;
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs
index 57fa9fe0fb..5fc90eebd9 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs
@@ -26,6 +26,7 @@ public class AbpDynamicFormTagHelperService : AbpTagHelperService _localizer;
+ private List _models = new();
public AbpDynamicFormTagHelperService(
HtmlEncoder htmlEncoder,
@@ -41,6 +42,7 @@ public class AbpDynamicFormTagHelperService : AbpTagHelperService x != model.ModelExplorer && x.GetAttribute()?.PickerId == pickerId);
+ otherModel = _models.Select(x => x.ModelExplorer).SingleOrDefault(x => x != model.ModelExplorer && x.GetAttribute()?.PickerId == pickerId);
return otherModel != null;
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs
index fbd6c3eaa1..53fceef714 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs
@@ -2,11 +2,11 @@ using System;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;
-public class BundleFile
+public class BundleFile : IEquatable, IComparable
{
- public string FileName { get; set; }
+ public string FileName { get; }
- public bool IsExternalFile { get; set; }
+ public bool IsExternalFile { get; }
public BundleFile(string fileName)
{
@@ -28,4 +28,59 @@ public class BundleFile
{
return new BundleFile(fileName);
}
+
+ public bool Equals(BundleFile? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ return FileName == other.FileName;
+ }
+
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj.GetType() != this.GetType())
+ {
+ return false;
+ }
+
+ return Equals((BundleFile)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return FileName.GetHashCode();
+ }
+
+ public int CompareTo(BundleFile? other)
+ {
+ if (ReferenceEquals(this, other))
+ {
+ return 0;
+ }
+
+ if (ReferenceEquals(null, other))
+ {
+ return 1;
+ }
+
+ return string.Compare(FileName, other.FileName, StringComparison.Ordinal);
+ }
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs
index 8a5a8c2073..36b941cd4a 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
@@ -61,12 +61,12 @@ public abstract class ChallengeAccountController : AbpController
}
[HttpGet]
- public virtual Task AccessDenied(string returnUrl = "", string returnUrlHash = "")
+ public virtual Task AccessDenied()
{
return Task.FromResult(Challenge(
new AuthenticationProperties
{
- RedirectUri = GetRedirectUrl(returnUrl, returnUrlHash)
+ RedirectUri = "/"
},
(ForbidSchemes.IsNullOrEmpty()
? new[]
diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
index 8628c2c803..593992aed4 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
@@ -111,4 +111,9 @@ public static class AbpApplicationBuilderExtensions
{
return app.UseMiddleware();
}
+
+ public static IApplicationBuilder UseDynamicClaims(this IApplicationBuilder app)
+ {
+ return app.UseMiddleware();
+ }
}
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs
new file mode 100644
index 0000000000..777ca7744a
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs
@@ -0,0 +1,25 @@
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Security.Claims;
+
+namespace Volo.Abp.AspNetCore.Security.Claims;
+
+public class AbpDynamicClaimsMiddleware : IMiddleware, ITransientDependency
+{
+ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
+ {
+ if (context.User.Identity?.IsAuthenticated == true)
+ {
+ if (context.RequestServices.GetRequiredService>().Value.IsDynamicClaimsEnabled)
+ {
+ var abpClaimsPrincipalFactory = context.RequestServices.GetRequiredService();
+ context.User = await abpClaimsPrincipalFactory.CreateDynamicAsync(context.User);
+ }
+ }
+
+ await next(context);
+ }
+}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj
index bb46006ac9..70d234cd20 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj
@@ -21,6 +21,7 @@
+
diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo.Abp.EventBus.Rebus.csproj b/framework/src/Volo.Abp.EventBus.Rebus/Volo.Abp.EventBus.Rebus.csproj
index 8ece532ebf..5923f966fe 100644
--- a/framework/src/Volo.Abp.EventBus.Rebus/Volo.Abp.EventBus.Rebus.csproj
+++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo.Abp.EventBus.Rebus.csproj
@@ -21,6 +21,9 @@
+
+
+
diff --git a/framework/src/Volo.Abp.Imaging.SkiaSharp/FodyWeavers.xml b/framework/src/Volo.Abp.Imaging.SkiaSharp/FodyWeavers.xml
new file mode 100644
index 0000000000..1715698ccd
--- /dev/null
+++ b/framework/src/Volo.Abp.Imaging.SkiaSharp/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Imaging.SkiaSharp/FodyWeavers.xsd b/framework/src/Volo.Abp.Imaging.SkiaSharp/FodyWeavers.xsd
new file mode 100644
index 0000000000..3f3946e282
--- /dev/null
+++ b/framework/src/Volo.Abp.Imaging.SkiaSharp/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo.Abp.Imaging.SkiaSharp.csproj b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo.Abp.Imaging.SkiaSharp.csproj
new file mode 100644
index 0000000000..857cb0f92f
--- /dev/null
+++ b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo.Abp.Imaging.SkiaSharp.csproj
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ netstandard2.0;netstandard2.1;net8.0
+ enable
+ Nullable
+ Volo.Abp.Imaging.SkiaSharp
+ $(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/AbpImagingSkiaSharpModule.cs b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/AbpImagingSkiaSharpModule.cs
new file mode 100644
index 0000000000..79fc4314aa
--- /dev/null
+++ b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/AbpImagingSkiaSharpModule.cs
@@ -0,0 +1,8 @@
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.Imaging;
+
+[DependsOn(typeof(AbpImagingAbstractionsModule))]
+public class AbpImagingSkiaSharpModule : AbpModule
+{
+}
diff --git a/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/SkiaSharpImageResizerContributor.cs b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/SkiaSharpImageResizerContributor.cs
new file mode 100644
index 0000000000..760acd0916
--- /dev/null
+++ b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/SkiaSharpImageResizerContributor.cs
@@ -0,0 +1,98 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
+using SkiaSharp;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http;
+
+namespace Volo.Abp.Imaging;
+
+public class SkiaSharpImageResizerContributor : IImageResizerContributor, ITransientDependency
+{
+ protected SkiaSharpResizerOptions Options { get; }
+
+ public SkiaSharpImageResizerContributor(IOptions options)
+ {
+ Options = options.Value;
+ }
+
+ public virtual async Task> TryResizeAsync(byte[] bytes, ImageResizeArgs resizeArgs, string? mimeType = null, CancellationToken cancellationToken = default)
+ {
+ if (!mimeType.IsNullOrWhiteSpace() && !CanResize(mimeType))
+ {
+ return new ImageResizeResult(bytes, ImageProcessState.Unsupported);
+ }
+
+ using (var memoryStream = new MemoryStream(bytes))
+ {
+ var result = await TryResizeAsync(memoryStream, resizeArgs, mimeType, cancellationToken);
+
+ if (result.State != ImageProcessState.Done)
+ {
+ return new ImageResizeResult(bytes, result.State);
+ }
+
+ var newBytes = await result.Result.GetAllBytesAsync(cancellationToken);
+
+ result.Result.Dispose();
+
+ return new ImageResizeResult(newBytes, result.State);
+ }
+ }
+
+ public virtual async Task> TryResizeAsync(Stream stream, ImageResizeArgs resizeArgs, string? mimeType = null, CancellationToken cancellationToken = default)
+ {
+ if (!mimeType.IsNullOrWhiteSpace() && !CanResize(mimeType))
+ {
+ return new ImageResizeResult(stream, ImageProcessState.Unsupported);
+ }
+
+ var (memoryBitmapStream, memorySkCodecStream) = await CreateMemoryStream(stream);
+
+ using (var original = SKBitmap.Decode(memoryBitmapStream))
+ {
+ using (var resized = original.Resize(new SKImageInfo(resizeArgs.Width, resizeArgs.Height), Options.SKFilterQuality))
+ {
+ using (var image = SKImage.FromBitmap(resized))
+ {
+ using (var codec = SKCodec.Create(memorySkCodecStream))
+ {
+ var memoryStream = new MemoryStream();
+ image.Encode(codec.EncodedFormat, Options.Quality).SaveTo(memoryStream);
+ return new ImageResizeResult(memoryStream, ImageProcessState.Done);
+ }
+ }
+ }
+ }
+ }
+
+ protected virtual async Task<(MemoryStream, MemoryStream)> CreateMemoryStream(Stream stream)
+ {
+ var streamPosition = stream.Position;
+
+ var memoryBitmapStream = new MemoryStream();
+ var memorySkCodecStream = new MemoryStream();
+
+ await stream.CopyToAsync(memoryBitmapStream);
+ stream.Position = streamPosition;
+ await stream.CopyToAsync(memorySkCodecStream);
+ stream.Position = streamPosition;
+
+ memoryBitmapStream.Position = 0;
+ memorySkCodecStream.Position = 0;
+
+ return (memoryBitmapStream, memorySkCodecStream);
+ }
+
+ protected virtual bool CanResize(string? mimeType)
+ {
+ return mimeType switch {
+ MimeTypes.Image.Jpeg => true,
+ MimeTypes.Image.Png => true,
+ MimeTypes.Image.Webp => true,
+ _ => false
+ };
+ }
+}
diff --git a/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/SkiaSharpResizerOptions.cs b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/SkiaSharpResizerOptions.cs
new file mode 100644
index 0000000000..6bc220feb1
--- /dev/null
+++ b/framework/src/Volo.Abp.Imaging.SkiaSharp/Volo/Abp/Imaging/SkiaSharpResizerOptions.cs
@@ -0,0 +1,16 @@
+using SkiaSharp;
+
+namespace Volo.Abp.Imaging;
+
+public class SkiaSharpResizerOptions
+{
+ public SKFilterQuality SKFilterQuality { get; set; }
+
+ public int Quality { get; set; }
+
+ public SkiaSharpResizerOptions()
+ {
+ SKFilterQuality = SKFilterQuality.None;
+ Quality = 75;
+ }
+}
diff --git a/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs b/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs
index 6c12decd19..2661298405 100644
--- a/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs
+++ b/framework/src/Volo.Abp.Security/System/Security/Principal/AbpClaimsIdentityExtensions.cs
@@ -238,6 +238,19 @@ public static class AbpClaimsIdentityExtensions
return claimsIdentity;
}
+ public static ClaimsIdentity RemoveAll(this ClaimsIdentity claimsIdentity, string claimType)
+ {
+ Check.NotNull(claimsIdentity, nameof(claimsIdentity));
+
+ foreach (var x in claimsIdentity.FindAll(claimType).ToList())
+ {
+ claimsIdentity.RemoveClaim(x);
+ }
+
+ return claimsIdentity;
+ }
+
+
public static ClaimsIdentity AddOrReplace(this ClaimsIdentity claimsIdentity, Claim claim)
{
Check.NotNull(claimsIdentity, nameof(claimsIdentity));
@@ -263,5 +276,4 @@ public static class AbpClaimsIdentityExtensions
return principal;
}
-
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs
index 69107c6d1d..5abddbd7a0 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs
@@ -59,9 +59,11 @@ public class AbpSecurityModule : AbpModule
});
}
+
private static void AutoAddClaimsPrincipalContributors(IServiceCollection services)
{
var contributorTypes = new List();
+ var dynamicContributorTypes = new List();
services.OnRegistered(context =>
{
@@ -69,11 +71,17 @@ public class AbpSecurityModule : AbpModule
{
contributorTypes.Add(context.ImplementationType);
}
+
+ if (typeof(IAbpDynamicClaimsPrincipalContributor).IsAssignableFrom(context.ImplementationType))
+ {
+ dynamicContributorTypes.Add(context.ImplementationType);
+ }
});
services.Configure(options =>
{
options.Contributors.AddIfNotContains(contributorTypes);
+ options.DynamicContributors.AddIfNotContains(dynamicContributorTypes);
});
}
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs
index 274f109f93..6b9aff1a66 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalContributorContext.cs
@@ -1,13 +1,14 @@
using System;
using System.Security.Claims;
using JetBrains.Annotations;
+using Microsoft.Extensions.DependencyInjection;
namespace Volo.Abp.Security.Claims;
public class AbpClaimsPrincipalContributorContext
{
[NotNull]
- public ClaimsPrincipal ClaimsPrincipal { get; }
+ public ClaimsPrincipal ClaimsPrincipal { get; set; }
[NotNull]
public IServiceProvider ServiceProvider { get; }
@@ -19,4 +20,11 @@ public class AbpClaimsPrincipalContributorContext
ClaimsPrincipal = claimsIdentity;
ServiceProvider = serviceProvider;
}
+
+ public virtual T GetRequiredService()
+ where T : notnull
+ {
+ Check.NotNull(ServiceProvider, nameof(ServiceProvider));
+ return ServiceProvider.GetRequiredService();
+ }
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs
index ae9d947fb0..b0e9fea653 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs
@@ -22,6 +22,16 @@ public class AbpClaimsPrincipalFactory : IAbpClaimsPrincipalFactory, ITransientD
}
public virtual async Task CreateAsync(ClaimsPrincipal? existsClaimsPrincipal = null)
+ {
+ return await InternalCreateAsync(Options, existsClaimsPrincipal, false);
+ }
+
+ public virtual async Task CreateDynamicAsync(ClaimsPrincipal? existsClaimsPrincipal = null)
+ {
+ return await InternalCreateAsync(Options, existsClaimsPrincipal, true);
+ }
+
+ public virtual async Task InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal? existsClaimsPrincipal = null, bool isDynamic = false)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@@ -32,13 +42,24 @@ public class AbpClaimsPrincipalFactory : IAbpClaimsPrincipalFactory, ITransientD
var context = new AbpClaimsPrincipalContributorContext(claimsPrincipal, scope.ServiceProvider);
- foreach (var contributorType in Options.Contributors)
+ if (!isDynamic)
+ {
+ foreach (var contributorType in options.Contributors)
+ {
+ var contributor = (IAbpClaimsPrincipalContributor)scope.ServiceProvider.GetRequiredService(contributorType);
+ await contributor.ContributeAsync(context);
+ }
+ }
+ else
{
- var contributor = (IAbpClaimsPrincipalContributor)scope.ServiceProvider.GetRequiredService(contributorType);
- await contributor.ContributeAsync(context);
+ foreach (var contributorType in options.DynamicContributors)
+ {
+ var contributor = (IAbpDynamicClaimsPrincipalContributor)scope.ServiceProvider.GetRequiredService(contributorType);
+ await contributor.ContributeAsync(context);
+ }
}
- return claimsPrincipal;
+ return context.ClaimsPrincipal;
}
}
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs
index 90e411e2a1..75bf67bee6 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Collections;
+using System.Collections.Generic;
+using System.Security.Claims;
+using Volo.Abp.Collections;
namespace Volo.Abp.Security.Claims;
@@ -6,8 +8,44 @@ public class AbpClaimsPrincipalFactoryOptions
{
public ITypeList Contributors { get; }
+ public ITypeList DynamicContributors { get; }
+
+ public List DynamicClaims { get; }
+
+ public string RemoteRefreshUrl { get; set; }
+
+ public Dictionary> ClaimsMap { get; set; }
+
+ public bool IsDynamicClaimsEnabled { get; set; }
+
public AbpClaimsPrincipalFactoryOptions()
{
Contributors = new TypeList();
+ DynamicContributors = new TypeList();
+
+ DynamicClaims = new List
+ {
+ AbpClaimTypes.UserName,
+ AbpClaimTypes.Name,
+ AbpClaimTypes.SurName,
+ AbpClaimTypes.Role,
+ AbpClaimTypes.Email,
+ AbpClaimTypes.EmailVerified,
+ AbpClaimTypes.PhoneNumber,
+ AbpClaimTypes.PhoneNumberVerified
+ };
+
+ RemoteRefreshUrl = "/api/account/dynamic-claims/refresh";
+
+ ClaimsMap = new Dictionary>()
+ {
+ { AbpClaimTypes.UserName, new List { "preferred_username", "unique_name", ClaimTypes.Name }},
+ { AbpClaimTypes.Name, new List { "given_name", ClaimTypes.GivenName }},
+ { AbpClaimTypes.SurName, new List { "family_name", ClaimTypes.Surname }},
+ { AbpClaimTypes.Role, new List { "role", "roles", ClaimTypes.Role }},
+ { AbpClaimTypes.Email, new List { "email", ClaimTypes.Email }},
+ };
+
+ IsDynamicClaimsEnabled = false;
}
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaim.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaim.cs
new file mode 100644
index 0000000000..ab8fc13f17
--- /dev/null
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaim.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace Volo.Abp.Security.Claims;
+
+[Serializable]
+public class AbpDynamicClaim
+{
+ public string Type { get; set; }
+
+ public string? Value { get; set; }
+
+ public AbpDynamicClaim(string type, string? value)
+ {
+ Type = type;
+ Value = value;
+ }
+}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaimCacheItem.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaimCacheItem.cs
new file mode 100644
index 0000000000..8c25cb19e7
--- /dev/null
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaimCacheItem.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace Volo.Abp.Security.Claims;
+
+[Serializable]
+public class AbpDynamicClaimCacheItem
+{
+ public List Claims { get; set; }
+
+ public AbpDynamicClaimCacheItem()
+ {
+ Claims = new List();
+ }
+
+ public AbpDynamicClaimCacheItem(List claims)
+ {
+ Claims = claims;
+ }
+
+ public static string CalculateCacheKey(Guid userId, Guid? tenantId)
+ {
+ return $"{tenantId}-{userId}";
+ }
+}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaimsPrincipalContributorBase.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaimsPrincipalContributorBase.cs
new file mode 100644
index 0000000000..2e607ace93
--- /dev/null
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpDynamicClaimsPrincipalContributorBase.cs
@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Claims;
+using System.Security.Principal;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.Security.Claims;
+
+public abstract class AbpDynamicClaimsPrincipalContributorBase : IAbpDynamicClaimsPrincipalContributor, ITransientDependency
+{
+ public abstract Task ContributeAsync(AbpClaimsPrincipalContributorContext context);
+
+ protected virtual async Task AddDynamicClaimsAsync(AbpClaimsPrincipalContributorContext context, ClaimsIdentity identity, List dynamicClaims)
+ {
+ var options = context.GetRequiredService>().Value;
+ foreach (var map in options.ClaimsMap)
+ {
+ await MapClaimAsync(identity, dynamicClaims, map.Key, map.Value.ToArray());
+ }
+
+ foreach (var claimGroup in dynamicClaims.GroupBy(x => x.Type))
+ {
+ identity.RemoveAll(claimGroup.First().Type);
+ identity.AddClaims(claimGroup.Where(c => c.Value != null).Select(c => new Claim(claimGroup.First().Type, c.Value!)));
+ }
+ }
+
+ protected virtual Task MapClaimAsync(ClaimsIdentity identity, List dynamicClaims, string targetClaimType, params string[] sourceClaimTypes)
+ {
+ var claims = dynamicClaims.Where(c => sourceClaimTypes.Contains(c.Type)).ToList();
+ if (claims.IsNullOrEmpty())
+ {
+ return Task.CompletedTask;
+ }
+
+ dynamicClaims.RemoveAll(claims);
+ identity.RemoveAll(targetClaimType);
+ identity.AddClaims(claims.Where(c => c.Value != null).Select(c => new Claim(targetClaimType, c.Value!)));
+
+ return Task.CompletedTask;;
+ }
+}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs
index b4f3046c9d..75da993f4d 100644
--- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpClaimsPrincipalFactory.cs
@@ -6,4 +6,6 @@ namespace Volo.Abp.Security.Claims;
public interface IAbpClaimsPrincipalFactory
{
Task CreateAsync(ClaimsPrincipal? existsClaimsPrincipal = null);
+
+ Task CreateDynamicAsync(ClaimsPrincipal? existsClaimsPrincipal = null);
}
diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpDynamicClaimsPrincipalContributor.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpDynamicClaimsPrincipalContributor.cs
new file mode 100644
index 0000000000..43f73374d7
--- /dev/null
+++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/IAbpDynamicClaimsPrincipalContributor.cs
@@ -0,0 +1,8 @@
+using System.Threading.Tasks;
+
+namespace Volo.Abp.Security.Claims;
+
+public interface IAbpDynamicClaimsPrincipalContributor
+{
+ Task ContributeAsync(AbpClaimsPrincipalContributorContext context);
+}
diff --git a/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo.Abp.Imaging.SkiaSharp.Tests.csproj b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo.Abp.Imaging.SkiaSharp.Tests.csproj
new file mode 100644
index 0000000000..3272fc325a
--- /dev/null
+++ b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo.Abp.Imaging.SkiaSharp.Tests.csproj
@@ -0,0 +1,19 @@
+
+
+
+
+
+ net8.0
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/AbpImagingMagickNetTestModule.cs b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/AbpImagingMagickNetTestModule.cs
new file mode 100644
index 0000000000..7fce00d3ac
--- /dev/null
+++ b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/AbpImagingMagickNetTestModule.cs
@@ -0,0 +1,14 @@
+using Volo.Abp.Autofac;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.Imaging;
+
+[DependsOn(
+ typeof(AbpAutofacModule),
+ typeof(AbpImagingSkiaSharpModule),
+ typeof(AbpTestBaseModule)
+)]
+public class AbpImagingSkiaSharpTestModule : AbpModule
+{
+
+}
diff --git a/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/AbpImagingSkiaSharpTestModule.cs b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/AbpImagingSkiaSharpTestModule.cs
new file mode 100644
index 0000000000..953e8c4b3a
--- /dev/null
+++ b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/AbpImagingSkiaSharpTestModule.cs
@@ -0,0 +1,11 @@
+using Volo.Abp.Testing;
+
+namespace Volo.Abp.Imaging;
+
+public abstract class AbpImagingSkiaSharpTestBase : AbpIntegratedTest
+{
+ protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
+ {
+ options.UseAutofac();
+ }
+}
diff --git a/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/SkiaSharpImageResizerTests.cs b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/SkiaSharpImageResizerTests.cs
new file mode 100644
index 0000000000..460c83bf5b
--- /dev/null
+++ b/framework/test/Volo.Abp.Imaging.SkiaSharp.Tests/Volo/Abp/Imaging/SkiaSharpImageResizerTests.cs
@@ -0,0 +1,75 @@
+using System.IO;
+using System.Threading.Tasks;
+using Shouldly;
+using Xunit;
+
+namespace Volo.Abp.Imaging;
+
+public class SkiaSharpImageResizerTests : AbpImagingSkiaSharpTestBase
+{
+ public IImageResizer ImageResizer { get; }
+
+ public SkiaSharpImageResizerTests()
+ {
+ ImageResizer = GetRequiredService();
+ }
+
+ [Fact]
+ public async Task Should_Resize_Jpg()
+ {
+ await using var jpegImage = ImageFileHelper.GetJpgTestFileStream();
+ var resizedImage = await ImageResizer.ResizeAsync(jpegImage, new ImageResizeArgs(100, 100));
+
+ resizedImage.ShouldNotBeNull();
+ resizedImage.State.ShouldBe(ImageProcessState.Done);
+ resizedImage.Result.Length.ShouldBeLessThan(jpegImage.Length);
+
+ resizedImage.Result.Dispose();
+ }
+
+ [Fact]
+ public async Task Should_Resize_Png()
+ {
+ await using var pngImage = ImageFileHelper.GetPngTestFileStream();
+ var resizedImage = await ImageResizer.ResizeAsync(pngImage, new ImageResizeArgs(100, 100));
+
+ resizedImage.ShouldNotBeNull();
+ resizedImage.State.ShouldBe(ImageProcessState.Done);
+ resizedImage.Result.Length.ShouldBeLessThan(pngImage.Length);
+
+ resizedImage.Result.Dispose();
+ }
+
+ [Fact]
+ public async Task Should_Resize_Webp()
+ {
+ await using var webpImage = ImageFileHelper.GetWebpTestFileStream();
+ var resizedImage = await ImageResizer.ResizeAsync(webpImage, new ImageResizeArgs(100, 100));
+
+ resizedImage.ShouldNotBeNull();
+ resizedImage.State.ShouldBe(ImageProcessState.Done);
+ resizedImage.Result.Length.ShouldBeLessThan(webpImage.Length);
+
+ resizedImage.Result.Dispose();
+ }
+
+ [Fact]
+ public async Task Should_Resize_Stream_And_Byte_Array_The_Same()
+ {
+ await using var jpegImage = ImageFileHelper.GetJpgTestFileStream();
+ var resizedImage1 = await ImageResizer.ResizeAsync(jpegImage, new ImageResizeArgs(100, 100));
+ var resizedImage2 = await ImageResizer.ResizeAsync(await jpegImage.GetAllBytesAsync(), new ImageResizeArgs(100, 100));
+
+ resizedImage1.ShouldNotBeNull();
+ resizedImage1.State.ShouldBe(ImageProcessState.Done);
+ resizedImage1.Result.Length.ShouldBeLessThan(jpegImage.Length);
+
+ resizedImage2.ShouldNotBeNull();
+ resizedImage2.State.ShouldBe(ImageProcessState.Done);
+ resizedImage2.Result.LongLength.ShouldBeLessThan(jpegImage.Length);
+
+ resizedImage1.Result.Length.ShouldBe(resizedImage2.Result.LongLength);
+
+ resizedImage1.Result.Dispose();
+ }
+}
diff --git a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory_Test.cs b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory_Test.cs
deleted file mode 100644
index b46694f9ed..0000000000
--- a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory_Test.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System.Linq;
-using System.Security.Claims;
-using System.Security.Principal;
-using System.Threading.Tasks;
-using Microsoft.Extensions.DependencyInjection;
-using Shouldly;
-using Volo.Abp.Testing;
-using Xunit;
-
-namespace Volo.Abp.Security.Claims;
-
-public class AbpClaimsPrincipalFactory_Test : AbpIntegratedTest
-{
- private readonly IAbpClaimsPrincipalFactory _abpClaimsPrincipalFactory;
- private static string TestAuthenticationType => "Identity.Application";
-
- public AbpClaimsPrincipalFactory_Test()
- {
- _abpClaimsPrincipalFactory = GetRequiredService();
-
- }
-
- protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
- {
- options.UseAutofac();
- }
-
- protected override void AfterAddApplication(IServiceCollection services)
- {
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- }
-
- [Fact]
- public async Task CreateAsync()
- {
- var claimsPrincipal = await _abpClaimsPrincipalFactory.CreateAsync();
- claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "admin2@abp.io");
- claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Email && x.Value == "admin@abp.io");
- claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Version && x.Value == "2.0");
- }
-
- [Fact]
- public async Task Create_With_Exists_ClaimsPrincipal()
- {
- var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(TestAuthenticationType, ClaimTypes.Name, ClaimTypes.Role));
- claimsPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Name, "123"));
- claimsPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Role, "admin"));
-
- await _abpClaimsPrincipalFactory.CreateAsync(claimsPrincipal);
- claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value == "123");
- claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Role && x.Value == "admin");
- claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "admin2@abp.io");
- claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Email && x.Value == "admin@abp.io");
- claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Version && x.Value == "2.0");
- }
-
- class TestAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor
- {
- public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
- {
- var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
- ?? new ClaimsIdentity(TestAuthenticationType);
-
- claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Email, "admin@abp.io"));
-
- context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
-
- return Task.CompletedTask;
- }
- }
-
- class Test2AbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor
- {
- public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
- {
- var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
- ?? new ClaimsIdentity(TestAuthenticationType);
-
- claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Email, "admin2@abp.io"));
-
- context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
-
- return Task.CompletedTask;
- }
- }
-
- class Test3AbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor
- {
- public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
- {
- var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
- ?? new ClaimsIdentity(TestAuthenticationType);
-
- claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Version, "2.0"));
-
- context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
-
- return Task.CompletedTask;
- }
- }
-}
diff --git a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory_Tests.cs b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory_Tests.cs
new file mode 100644
index 0000000000..b8abaff000
--- /dev/null
+++ b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory_Tests.cs
@@ -0,0 +1,189 @@
+using System.Linq;
+using System.Security.Claims;
+using System.Security.Principal;
+using System.Threading.Tasks;
+using Shouldly;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Testing;
+using Xunit;
+
+namespace Volo.Abp.Security.Claims;
+
+public class AbpClaimsPrincipalFactory_Tests : AbpIntegratedTest
+{
+ private readonly IAbpClaimsPrincipalFactory _abpClaimsPrincipalFactory;
+ private static string TestAuthenticationType => "Identity.Application";
+
+ public AbpClaimsPrincipalFactory_Tests()
+ {
+ _abpClaimsPrincipalFactory = GetRequiredService();
+
+ }
+
+ protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
+ {
+ options.UseAutofac();
+ }
+
+ [Fact]
+ public async Task CreateAsync()
+ {
+ var claimsPrincipal = await _abpClaimsPrincipalFactory.CreateAsync();
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "admin2@abp.io");
+ claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Email && x.Value == "admin@abp.io");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Version && x.Value == "2.0");
+ }
+
+ [Fact]
+ public async Task Create_With_Exists_ClaimsPrincipal()
+ {
+ var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(TestAuthenticationType, ClaimTypes.Name, ClaimTypes.Role));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Name, "123"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Role, "admin"));
+
+ await _abpClaimsPrincipalFactory.CreateAsync(claimsPrincipal);
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value == "123");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Role && x.Value == "admin");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "admin2@abp.io");
+ claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Email && x.Value == "admin@abp.io");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Version && x.Value == "2.0");
+ }
+
+ [Fact]
+ public async Task DynamicCreateAsync()
+ {
+ var claimsPrincipal = await _abpClaimsPrincipalFactory.CreateDynamicAsync();
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value == "admin");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Role && x.Value == "admin");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Role && x.Value == "manager");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "admin2@abp.io");
+ claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Email && x.Value == "admin@abp.io");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Version && x.Value == "2.0");
+ }
+
+ [Fact]
+ public async Task DynamicCreate_With_Exists_ClaimsPrincipal()
+ {
+ var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(TestAuthenticationType, ClaimTypes.Name, ClaimTypes.Role));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Name, "123"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Role, "123"));
+
+ await _abpClaimsPrincipalFactory.CreateDynamicAsync(claimsPrincipal);
+ claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Name && x.Value == "123");
+ claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Role && x.Value == "123");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value == "admin");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Role && x.Value == "admin");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Role && x.Value == "manager");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "admin2@abp.io");
+ claimsPrincipal.Claims.ShouldNotContain(x => x.Type == ClaimTypes.Email && x.Value == "admin@abp.io");
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Version && x.Value == "2.0");
+ }
+
+ class TestAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Email, "admin@abp.io"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+
+ class Test2AbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Email, "admin2@abp.io"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+
+ class Test3AbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Version, "2.0"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+
+ class TestAbpDynamicClaimsPrincipalContributor : IAbpDynamicClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Email, "admin@abp.io"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+
+ class Test2AbpDynamicClaimsPrincipalContributor : IAbpDynamicClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Email, "admin2@abp.io"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+
+ class Test3AbpDynamicClaimsPrincipalContributor : IAbpDynamicClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Version, "2.0"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+
+ class Test4AbpDynamicClaimsPrincipalContributor : IAbpDynamicClaimsPrincipalContributor, ITransientDependency
+ {
+ public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var claimsIdentity = context.ClaimsPrincipal.Identities.FirstOrDefault(x => x.AuthenticationType == TestAuthenticationType)
+ ?? new ClaimsIdentity(TestAuthenticationType);
+
+ claimsIdentity.AddOrReplace(new Claim(ClaimTypes.Name, "admin"));
+ claimsIdentity.RemoveAll(ClaimTypes.Role);
+ claimsIdentity.AddClaim(new Claim(ClaimTypes.Role, "admin"));
+ claimsIdentity.AddClaim(new Claim(ClaimTypes.Role, "manager"));
+
+ context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
+
+ return Task.CompletedTask;
+ }
+ }
+}
diff --git a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpDynamicClaimsPrincipalContributorBase_Tests.cs b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpDynamicClaimsPrincipalContributorBase_Tests.cs
new file mode 100644
index 0000000000..7054319dfa
--- /dev/null
+++ b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/AbpDynamicClaimsPrincipalContributorBase_Tests.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Claims;
+using System.Threading.Tasks;
+using Shouldly;
+using Volo.Abp.Testing;
+using Xunit;
+
+namespace Volo.Abp.Security.Claims;
+
+class TestAbpDynamicClaimsPrincipalContributor : AbpDynamicClaimsPrincipalContributorBase
+{
+ public async override Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
+ Check.NotNull(identity, nameof(identity));
+
+ await AddDynamicClaimsAsync(context, identity, AbpDynamicClaimsPrincipalContributorBase_Tests.DynamicClaims.Claims);
+ }
+}
+
+public class AbpDynamicClaimsPrincipalContributorBase_Tests : AbpIntegratedTest
+{
+ private readonly TestAbpDynamicClaimsPrincipalContributor _dynamicClaimsPrincipalContributorBase = new TestAbpDynamicClaimsPrincipalContributor();
+
+ public readonly static AbpDynamicClaimCacheItem DynamicClaims = new AbpDynamicClaimCacheItem();
+
+ protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
+ {
+ options.UseAutofac();
+ }
+
+ [Fact]
+ public async Task AddDynamicClaimsAsync()
+ {
+ var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity());
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.UserName, "test-source-userName"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.Name, "test-source-name"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.SurName, "test-source-surname"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.Role, "test-source-role1"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.Role, "test-source-role2"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.Email, "test-source-email"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.EmailVerified, "test-source-emailVerified"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.PhoneNumber, "test-source-phoneNumber"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim(AbpClaimTypes.PhoneNumberVerified, "test-source-phoneNumberVerified"));
+ claimsPrincipal.Identities.First().AddClaim(new Claim("my-claim", "test-source-my-claim"));
+
+ DynamicClaims.Claims.AddRange(new []
+ {
+ new AbpDynamicClaim("preferred_username", "test-preferred_username"),
+ new AbpDynamicClaim(ClaimTypes.GivenName, "test-given_name"),
+ new AbpDynamicClaim("family_name", "test-family_name"),
+ new AbpDynamicClaim("role", "test-role1"),
+ new AbpDynamicClaim("roles", "test-role2"),
+ new AbpDynamicClaim(ClaimTypes.Role, "test-role3"),
+ new AbpDynamicClaim("email", "test-email"),
+ new AbpDynamicClaim(AbpClaimTypes.EmailVerified, "test-email-verified"),
+ new AbpDynamicClaim(AbpClaimTypes.PhoneNumberVerified, null),
+ });
+
+ await _dynamicClaimsPrincipalContributorBase.ContributeAsync(new AbpClaimsPrincipalContributorContext(claimsPrincipal, GetRequiredService()));
+
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.UserName && c.Value == "test-preferred_username");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.SurName && c.Value == "test-family_name");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.Name && c.Value == "test-given_name");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.Role && c.Value == "test-role1");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.Role && c.Value == "test-role2");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.Role && c.Value == "test-role3");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.Email && c.Value == "test-email");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.EmailVerified && c.Value == "test-email-verified");
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == AbpClaimTypes.PhoneNumber && c.Value == "test-source-phoneNumber");
+ claimsPrincipal.Identities.First().Claims.ShouldNotContain(c => c.Type == AbpClaimTypes.PhoneNumberVerified);
+ claimsPrincipal.Identities.First().Claims.ShouldContain(c => c.Type == "my-claim" && c.Value == "test-source-my-claim");
+ }
+}
diff --git a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/CurrentPrincipalAccessor_Test.cs b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/CurrentPrincipalAccessor_Tests.cs
similarity index 91%
rename from framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/CurrentPrincipalAccessor_Test.cs
rename to framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/CurrentPrincipalAccessor_Tests.cs
index d7c87148f4..bbc18089be 100644
--- a/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/CurrentPrincipalAccessor_Test.cs
+++ b/framework/test/Volo.Abp.Security.Tests/Volo/Abp/Security/Claims/CurrentPrincipalAccessor_Tests.cs
@@ -6,11 +6,11 @@ using Xunit;
namespace Volo.Abp.Security.Claims;
-public class CurrentPrincipalAccessor_Test : AbpIntegratedTest
+public class CurrentPrincipalAccessor_Tests : AbpIntegratedTest
{
private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor;
- public CurrentPrincipalAccessor_Test()
+ public CurrentPrincipalAccessor_Tests()
{
_currentPrincipalAccessor = GetRequiredService();
}
diff --git a/global.json b/global.json
index 90f885f952..391ba3c2a3 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.100-rc.2.23502.2",
+ "version": "8.0.100",
"rollForward": "latestFeature"
}
}
diff --git a/latest-versions.json b/latest-versions.json
index e2911011e7..372ed08ffc 100644
--- a/latest-versions.json
+++ b/latest-versions.json
@@ -1,6 +1,6 @@
[
{
- "version": "7.4.1",
+ "version": "7.4.2",
"releaseDate": "",
"type": "stable",
"message": ""
diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/IDynamicClaimsAppService.cs b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/IDynamicClaimsAppService.cs
new file mode 100644
index 0000000000..36a91b2155
--- /dev/null
+++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/IDynamicClaimsAppService.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+
+namespace Volo.Abp.Account;
+
+public interface IDynamicClaimsAppService : IApplicationService
+{
+ Task RefreshAsync();
+}
diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs
new file mode 100644
index 0000000000..e26dbfc979
--- /dev/null
+++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/DynamicClaimsAppService.cs
@@ -0,0 +1,31 @@
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Volo.Abp.Identity;
+using Volo.Abp.Security.Claims;
+using Volo.Abp.Users;
+
+namespace Volo.Abp.Account;
+
+[Authorize]
+public class DynamicClaimsAppService : IdentityAppServiceBase, IDynamicClaimsAppService
+{
+ protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; }
+ protected IAbpClaimsPrincipalFactory AbpClaimsPrincipalFactory { get; }
+ protected ICurrentPrincipalAccessor PrincipalAccessor { get; }
+
+ public DynamicClaimsAppService(
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache,
+ IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory,
+ ICurrentPrincipalAccessor principalAccessor)
+ {
+ IdentityDynamicClaimsPrincipalContributorCache = identityDynamicClaimsPrincipalContributorCache;
+ AbpClaimsPrincipalFactory = abpClaimsPrincipalFactory;
+ PrincipalAccessor = principalAccessor;
+ }
+
+ public virtual async Task RefreshAsync()
+ {
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(CurrentUser.GetId(), CurrentUser.TenantId);
+ await AbpClaimsPrincipalFactory.CreateDynamicAsync(PrincipalAccessor.Principal);
+ }
+}
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs
new file mode 100644
index 0000000000..7bb80a95cb
--- /dev/null
+++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.Generated.cs
@@ -0,0 +1,24 @@
+// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.Account;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http.Client;
+using Volo.Abp.Http.Client.ClientProxying;
+using Volo.Abp.Http.Modeling;
+
+// ReSharper disable once CheckNamespace
+namespace Volo.Abp.Account;
+
+[Dependency(ReplaceServices = true)]
+[ExposeServices(typeof(IDynamicClaimsAppService), typeof(DynamicClaimsClientProxy))]
+public partial class DynamicClaimsClientProxy : ClientProxyBase, IDynamicClaimsAppService
+{
+ public virtual async Task RefreshAsync()
+ {
+ await RequestAsync(nameof(RefreshAsync));
+ }
+}
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.cs b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.cs
new file mode 100644
index 0000000000..da398d8951
--- /dev/null
+++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/Volo/Abp/Account/DynamicClaimsClientProxy.cs
@@ -0,0 +1,7 @@
+// This file is part of DynamicClaimsClientProxy, you can customize it here
+// ReSharper disable once CheckNamespace
+namespace Volo.Abp.Account;
+
+public partial class DynamicClaimsClientProxy
+{
+}
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/account-generate-proxy.json b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/account-generate-proxy.json
index 24bd9c6079..9857f97c9a 100644
--- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/account-generate-proxy.json
+++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/account-generate-proxy.json
@@ -338,6 +338,47 @@
}
}
},
+ "Volo.Abp.Account.DynamicClaimsController": {
+ "controllerName": "DynamicClaims",
+ "controllerGroupName": "DynamicClaims",
+ "isRemoteService": true,
+ "isIntegrationService": false,
+ "apiVersion": null,
+ "type": "Volo.Abp.Account.DynamicClaimsController",
+ "interfaces": [
+ {
+ "type": "Volo.Abp.Account.IDynamicClaimsAppService",
+ "name": "IDynamicClaimsAppService",
+ "methods": [
+ {
+ "name": "RefreshAsync",
+ "parametersOnMethod": [],
+ "returnValue": {
+ "type": "System.Void",
+ "typeSimple": "System.Void"
+ }
+ }
+ ]
+ }
+ ],
+ "actions": {
+ "RefreshAsync": {
+ "uniqueName": "RefreshAsync",
+ "name": "RefreshAsync",
+ "httpMethod": "POST",
+ "url": "api/account/dynamic-claims/refresh",
+ "supportedVersions": [],
+ "parametersOnMethod": [],
+ "parameters": [],
+ "returnValue": {
+ "type": "System.Void",
+ "typeSimple": "System.Void"
+ },
+ "allowAnonymous": null,
+ "implementFrom": "Volo.Abp.Account.IDynamicClaimsAppService"
+ }
+ }
+ },
"Volo.Abp.Account.ProfileController": {
"controllerName": "Profile",
"controllerGroupName": "Profile",
diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs
new file mode 100644
index 0000000000..f3546e6607
--- /dev/null
+++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/DynamicClaimsController.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Volo.Abp.AspNetCore.Mvc;
+
+namespace Volo.Abp.Account;
+
+[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)]
+[Area(AccountRemoteServiceConsts.ModuleName)]
+[ControllerName("DynamicClaims")]
+[Route("/api/account/dynamic-claims")]
+public class DynamicClaimsController : AbpControllerBase, IDynamicClaimsAppService
+{
+ protected IDynamicClaimsAppService DynamicClaimsAppService { get; }
+
+ public DynamicClaimsController(IDynamicClaimsAppService dynamicClaimsAppService)
+ {
+ DynamicClaimsAppService = dynamicClaimsAppService;
+ }
+
+ [HttpPost]
+ [Route("refresh")]
+ public virtual Task RefreshAsync()
+ {
+ return DynamicClaimsAppService.RefreshAsync();
+ }
+}
diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs
index d04abee6d9..d60c90ce60 100644
--- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs
+++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs
@@ -10,7 +10,6 @@ using System;
using System.Diagnostics;
using System.Linq;
using System.Security.Claims;
-using System.Security.Principal;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.Account.Settings;
@@ -32,14 +31,12 @@ public class IdentityServerSupportedLoginModel : LoginModel
public IdentityServerSupportedLoginModel(
IAuthenticationSchemeProvider schemeProvider,
IOptions accountOptions,
+ IOptions identityOptions,
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache,
IIdentityServerInteractionService interaction,
IClientStore clientStore,
- IEventService identityServerEvents,
- IOptions identityOptions)
- : base(
- schemeProvider,
- accountOptions,
- identityOptions)
+ IEventService identityServerEvents)
+ : base(schemeProvider, accountOptions, identityOptions, identityDynamicClaimsPrincipalContributorCache)
{
Interaction = interaction;
ClientStore = clientStore;
@@ -177,6 +174,9 @@ public class IdentityServerSupportedLoginModel : LoginModel
Debug.Assert(user != null, nameof(user) + " != null");
await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); //TODO: Use user's name once implemented
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
+
return RedirectSafely(ReturnUrl, ReturnUrlHash);
}
diff --git a/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Pages/Account/OpenIddictSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Pages/Account/OpenIddictSupportedLoginModel.cs
index 10231a2607..d7998eb826 100644
--- a/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Pages/Account/OpenIddictSupportedLoginModel.cs
+++ b/modules/account/src/Volo.Abp.Account.Web.OpenIddict/Pages/Account/OpenIddictSupportedLoginModel.cs
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
using OpenIddict.Server;
using OpenIddict.Server.AspNetCore;
using Volo.Abp.DependencyInjection;
+using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.OpenIddict;
@@ -17,12 +18,14 @@ namespace Volo.Abp.Account.Web.Pages.Account;
public class OpenIddictSupportedLoginModel : LoginModel
{
protected AbpOpenIddictRequestHelper OpenIddictRequestHelper { get; }
+
public OpenIddictSupportedLoginModel(
IAuthenticationSchemeProvider schemeProvider,
IOptions accountOptions,
IOptions identityOptions,
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache,
AbpOpenIddictRequestHelper openIddictRequestHelper)
- : base(schemeProvider, accountOptions, identityOptions)
+ : base(schemeProvider, accountOptions, identityOptions, identityDynamicClaimsPrincipalContributorCache)
{
OpenIddictRequestHelper = openIddictRequestHelper;
}
diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs
index 8e93913176..9caff2c187 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs
@@ -29,13 +29,15 @@ public class AccountController : AbpControllerBase
protected ISettingProvider SettingProvider { get; }
protected IdentitySecurityLogManager IdentitySecurityLogManager { get; }
protected IOptions IdentityOptions { get; }
+ protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; }
public AccountController(
SignInManager signInManager,
IdentityUserManager userManager,
ISettingProvider settingProvider,
IdentitySecurityLogManager identitySecurityLogManager,
- IOptions identityOptions)
+ IOptions identityOptions,
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache)
{
LocalizationResource = typeof(AccountResource);
@@ -44,6 +46,7 @@ public class AccountController : AbpControllerBase
SettingProvider = settingProvider;
IdentitySecurityLogManager = identitySecurityLogManager;
IdentityOptions = identityOptions;
+ IdentityDynamicClaimsPrincipalContributorCache = identityDynamicClaimsPrincipalContributorCache;
}
[HttpPost]
@@ -69,6 +72,16 @@ public class AccountController : AbpControllerBase
UserName = login.UserNameOrEmailAddress
});
+ if (signInResult.Succeeded)
+ {
+ var user = await UserManager.FindByNameAsync(login.UserNameOrEmailAddress);
+ if (user != null)
+ {
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
+ }
+ }
+
return GetAbpLoginResult(signInResult);
}
diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
index d4bb0dbc5e..7b7d4a2b94 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
@@ -52,17 +52,19 @@ public class LoginModel : AccountPageModel
protected IAuthenticationSchemeProvider SchemeProvider { get; }
protected AbpAccountOptions AccountOptions { get; }
protected IOptions IdentityOptions { get; }
-
+ protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; }
public bool ShowCancelButton { get; set; }
public LoginModel(
IAuthenticationSchemeProvider schemeProvider,
IOptions accountOptions,
- IOptions identityOptions)
+ IOptions identityOptions,
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache)
{
SchemeProvider = schemeProvider;
IdentityOptions = identityOptions;
AccountOptions = accountOptions.Value;
+ IdentityDynamicClaimsPrincipalContributorCache = identityDynamicClaimsPrincipalContributorCache;
}
public virtual async Task OnGetAsync()
@@ -138,6 +140,9 @@ public class LoginModel : AccountPageModel
Debug.Assert(user != null, nameof(user) + " != null");
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
+
return RedirectSafely(ReturnUrl, ReturnUrlHash);
}
@@ -222,8 +227,16 @@ public class LoginModel : AccountPageModel
throw new UserFriendlyException("Cannot proceed because user is not allowed!");
}
+ IdentityUser user;
if (result.Succeeded)
{
+ user = await UserManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey);
+ if (user != null)
+ {
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
+ }
+
return RedirectSafely(returnUrl, returnUrlHash);
}
@@ -239,7 +252,7 @@ public class LoginModel : AccountPageModel
});
}
- var user = await UserManager.FindByEmailAsync(email);
+ user = await UserManager.FindByEmailAsync(email);
if (user == null)
{
return RedirectToPage("./Register", new {
@@ -263,6 +276,9 @@ public class LoginModel : AccountPageModel
UserName = user.Name
});
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
+
return RedirectSafely(returnUrl, returnUrlHash);
}
diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs
index 322a17e82f..9e0a2c191b 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs
@@ -46,13 +46,16 @@ public class RegisterModel : AccountPageModel
protected IAuthenticationSchemeProvider SchemeProvider { get; }
protected AbpAccountOptions AccountOptions { get; }
+ protected IdentityDynamicClaimsPrincipalContributorCache IdentityDynamicClaimsPrincipalContributorCache { get; }
public RegisterModel(
IAccountAppService accountAppService,
IAuthenticationSchemeProvider schemeProvider,
- IOptions accountOptions)
+ IOptions accountOptions,
+ IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache)
{
SchemeProvider = schemeProvider;
+ IdentityDynamicClaimsPrincipalContributorCache = identityDynamicClaimsPrincipalContributorCache;
AccountAppService = accountAppService;
AccountOptions = accountOptions.Value;
}
@@ -159,6 +162,9 @@ public class RegisterModel : AccountPageModel
var user = await UserManager.GetByIdAsync(userDto.Id);
await SignInManager.SignInAsync(user, isPersistent: true);
+
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
}
protected virtual async Task RegisterExternalUserAsync(ExternalLoginInfo externalLoginInfo, string userName, string emailAddress)
@@ -185,6 +191,9 @@ public class RegisterModel : AccountPageModel
}
await SignInManager.SignInAsync(user, isPersistent: true, ExternalLoginAuthSchema);
+
+ // Clear the dynamic claims cache.
+ await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
}
protected virtual async Task CheckSelfRegistrationAsync()
diff --git a/modules/account/src/Volo.Abp.Account.Web/wwwroot/client-proxies/account-proxy.js b/modules/account/src/Volo.Abp.Account.Web/wwwroot/client-proxies/account-proxy.js
index 2e291710d5..d3c29354ef 100644
--- a/modules/account/src/Volo.Abp.Account.Web/wwwroot/client-proxies/account-proxy.js
+++ b/modules/account/src/Volo.Abp.Account.Web/wwwroot/client-proxies/account-proxy.js
@@ -79,6 +79,21 @@
})();
+ // controller volo.abp.account.dynamicClaims
+
+ (function(){
+
+ abp.utils.createNamespace(window, 'volo.abp.account.dynamicClaims');
+
+ volo.abp.account.dynamicClaims.get = function(ajaxParams) {
+ return abp.ajax($.extend(true, {
+ url: abp.appPath + 'api/account/dynamic-claims',
+ type: 'GET'
+ }, ajaxParams));
+ };
+
+ })();
+
// controller volo.abp.account.profile
(function(){
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs
index d6043a1624..8fb3260beb 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs
@@ -33,7 +33,7 @@ public class AbpUserClaimsPrincipalFactory : UserClaimsPrincipalFactory CreateAsync(IdentityUser user)
+ public async override Task CreateAsync(IdentityUser user)
{
var principal = await base.CreateAsync(user);
var identity = principal.Identities.First();
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributor.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributor.cs
new file mode 100644
index 0000000000..7d56a3b184
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributor.cs
@@ -0,0 +1,39 @@
+using System.Linq;
+using System.Security.Claims;
+using System.Security.Principal;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Volo.Abp.Domain.Entities;
+using Volo.Abp.Security.Claims;
+
+namespace Volo.Abp.Identity;
+
+public class IdentityDynamicClaimsPrincipalContributor : AbpDynamicClaimsPrincipalContributorBase
+{
+ public async override Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
+ {
+ var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
+ var userId = identity?.FindUserId();
+ if (userId == null)
+ {
+ return;
+ }
+
+ var dynamicClaimsCache = context.GetRequiredService();
+ AbpDynamicClaimCacheItem dynamicClaims;
+ try
+ {
+ dynamicClaims = await dynamicClaimsCache.GetAsync(userId.Value, identity.FindTenantId());
+ }
+ catch (EntityNotFoundException e)
+ {
+ // In case if user not found, We force to clear the claims principal.
+ context.ClaimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity());
+ var logger = context.GetRequiredService>();
+ logger.LogWarning(e, $"User not found: {userId.Value}");
+ return;
+ }
+
+ await AddDynamicClaimsAsync(context, identity, dynamicClaims.Claims);
+ }
+}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributorCache.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributorCache.cs
new file mode 100644
index 0000000000..b0ab885e03
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributorCache.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.Extensions.Caching.Distributed;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using Microsoft.Extensions.Options;
+using Volo.Abp.Caching;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.MultiTenancy;
+using Volo.Abp.Security.Claims;
+
+namespace Volo.Abp.Identity;
+
+public class IdentityDynamicClaimsPrincipalContributorCache : ITransientDependency
+{
+ public ILogger Logger { get; set; }
+
+ protected IDistributedCache Cache { get; }
+ protected ICurrentTenant CurrentTenant { get; }
+ protected IdentityUserManager UserManager { get; }
+ protected IUserClaimsPrincipalFactory UserClaimsPrincipalFactory { get; }
+ protected IOptions AbpClaimsPrincipalFactoryOptions { get; }
+ protected IOptions CacheOptions { get; }
+
+ public IdentityDynamicClaimsPrincipalContributorCache(
+ IDistributedCache cache,
+ ICurrentTenant currentTenant,
+ IdentityUserManager userManager,
+ IUserClaimsPrincipalFactory userClaimsPrincipalFactory,
+ IOptions abpClaimsPrincipalFactoryOptions,
+ IOptions cacheOptions)
+ {
+ Cache = cache;
+ CurrentTenant = currentTenant;
+ UserManager = userManager;
+ UserClaimsPrincipalFactory = userClaimsPrincipalFactory;
+ AbpClaimsPrincipalFactoryOptions = abpClaimsPrincipalFactoryOptions;
+ CacheOptions = cacheOptions;
+
+ Logger = NullLogger.Instance;
+ }
+
+ public virtual async Task GetAsync(Guid userId, Guid? tenantId = null)
+ {
+ Logger.LogDebug($"Get dynamic claims cache for user: {userId}");
+
+ return await Cache.GetOrAddAsync(AbpDynamicClaimCacheItem.CalculateCacheKey(userId, tenantId), async () =>
+ {
+ using (CurrentTenant.Change(tenantId))
+ {
+ Logger.LogDebug($"Filling dynamic claims cache for user: {userId}");
+
+ var user = await UserManager.GetByIdAsync(userId);
+ var principal = await UserClaimsPrincipalFactory.CreateAsync(user);
+
+ var dynamicClaims = new AbpDynamicClaimCacheItem();
+ foreach (var claimType in AbpClaimsPrincipalFactoryOptions.Value.DynamicClaims)
+ {
+ var claims = principal.Claims.Where(x => x.Type == claimType).ToList();
+ if (claims.Any())
+ {
+ dynamicClaims.Claims.AddRange(claims.Select(claim => new AbpDynamicClaim(claimType, claim.Value)));
+ }
+ else
+ {
+ dynamicClaims.Claims.Add(new AbpDynamicClaim(claimType, null));
+ }
+ }
+
+ return dynamicClaims;
+ }
+ }, () => new DistributedCacheEntryOptions
+ {
+ AbsoluteExpirationRelativeToNow = CacheOptions.Value.CacheAbsoluteExpiration
+ });
+ }
+
+ public virtual async Task ClearAsync(Guid userId, Guid? tenantId = null)
+ {
+ Logger.LogDebug($"Clearing dynamic claims cache for user: {userId}");
+ await Cache.RemoveAsync(AbpDynamicClaimCacheItem.CalculateCacheKey(userId, tenantId));
+ }
+}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributorCacheOptions.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributorCacheOptions.cs
new file mode 100644
index 0000000000..3387f6cda5
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributorCacheOptions.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace Volo.Abp.Identity;
+
+public class IdentityDynamicClaimsPrincipalContributorCacheOptions
+{
+ public TimeSpan CacheAbsoluteExpiration { get; set; }
+
+ public IdentityDynamicClaimsPrincipalContributorCacheOptions()
+ {
+ CacheAbsoluteExpiration = TimeSpan.FromHours(1);
+ }
+}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserUpdatedEventHandler.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserUpdatedEventHandler.cs
new file mode 100644
index 0000000000..9ac8ad4746
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserUpdatedEventHandler.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities.Events;
+using Volo.Abp.EventBus;
+using Volo.Abp.Uow;
+
+namespace Volo.Abp.Identity;
+
+public class UserEntityUpdatedEventHandler :
+ ILocalEventHandler>,
+ ILocalEventHandler>,
+ ITransientDependency
+{
+ private readonly IdentityDynamicClaimsPrincipalContributorCache _cache;
+
+ public UserEntityUpdatedEventHandler(IdentityDynamicClaimsPrincipalContributorCache cache)
+ {
+ _cache = cache;
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(EntityUpdatedEventData eventData)
+ {
+ await ClearAsync(eventData.Entity.Id, eventData.Entity.TenantId);
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(EntityDeletedEventData eventData)
+ {
+ await ClearAsync(eventData.Entity.Id, eventData.Entity.TenantId);
+ }
+
+ protected virtual async Task ClearAsync(Guid userId, Guid? tenantId)
+ {
+ await _cache.ClearAsync(userId, tenantId);
+ }
+}
diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory_Tests.cs
index 60a62cda1e..cf9b339cc1 100644
--- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory_Tests.cs
+++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory_Tests.cs
@@ -2,6 +2,7 @@
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Claims;
@@ -22,6 +23,11 @@ public class AbpUserClaimsPrincipalFactory_Tests : AbpIdentityDomainTestBase
_testData = GetRequiredService();
}
+ protected override void AfterAddApplication(IServiceCollection services)
+ {
+ services.AddTransient();
+ }
+
[Fact]
public async Task Add_And_Replace_Claims_Test()
{
@@ -42,7 +48,7 @@ public class AbpUserClaimsPrincipalFactory_Tests : AbpIdentityDomainTestBase
});
}
- class TestAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
+ class TestAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor
{
//https://github.com/dotnet/aspnetcore/blob/v5.0.0/src/Identity/Extensions.Core/src/UserClaimsPrincipalFactory.cs#L79
private static string IdentityAuthenticationType => "Identity.Application";
diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributor_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributor_Tests.cs
new file mode 100644
index 0000000000..9ac0a2d36b
--- /dev/null
+++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityDynamicClaimsPrincipalContributor_Tests.cs
@@ -0,0 +1,59 @@
+using System.Security.Claims;
+using System.Threading.Tasks;
+using Shouldly;
+using Volo.Abp.Security.Claims;
+using Xunit;
+
+namespace Volo.Abp.Identity;
+
+public class IdentityDynamicClaimsPrincipalContributor_Tests : AbpIdentityDomainTestBase
+{
+ private readonly IdentityUserManager _identityUserManager;
+ private readonly IAbpClaimsPrincipalFactory _abpClaimsPrincipalFactory;
+ private readonly AbpUserClaimsPrincipalFactory _abpUserClaimsPrincipalFactory;
+ private readonly IdentityTestData _testData;
+
+ public IdentityDynamicClaimsPrincipalContributor_Tests()
+ {
+ _identityUserManager = GetRequiredService();
+ _abpClaimsPrincipalFactory = GetRequiredService();
+ _abpUserClaimsPrincipalFactory = GetRequiredService();
+ _testData = GetRequiredService();
+ }
+
+ [Fact]
+ public async Task Should_Get_Correct_Claims_After_User_Updating()
+ {
+ IdentityUser user = null;
+ ClaimsPrincipal claimsPrincipal = null;
+ string securityStamp = null;
+ await UsingUowAsync(async () =>
+ {
+ user = await _identityUserManager.GetByIdAsync(_testData.UserJohnId);
+ user.ShouldNotBeNull();
+ securityStamp = user.SecurityStamp;
+ claimsPrincipal = await _abpUserClaimsPrincipalFactory.CreateAsync(user);
+
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.NameIdentifier && x.Value == user.Id.ToString());
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value == user.UserName);
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == user.Email);
+ claimsPrincipal.Claims.ShouldContain(x => x.Type == "AspNet.Identity.SecurityStamp" && x.Value == securityStamp);
+
+ var dynamicClaimsPrincipal = await _abpClaimsPrincipalFactory.CreateDynamicAsync(claimsPrincipal);
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.NameIdentifier && x.Value == user.Id.ToString());
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value == user.UserName);
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == user.Email);
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == "AspNet.Identity.SecurityStamp" && x.Value == securityStamp);//SecurityStamp is not dynamic claim
+
+ await _identityUserManager.SetUserNameAsync(user, "newUserName");
+ await _identityUserManager.SetEmailAsync(user, "newUserEmail@abp.io");
+ await _identityUserManager.UpdateSecurityStampAsync(user);
+ });
+
+ var dynamicClaimsPrincipal = await _abpClaimsPrincipalFactory.CreateDynamicAsync(claimsPrincipal);
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.NameIdentifier && x.Value == user.Id.ToString());
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Name && x.Value =="newUserName");
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == ClaimTypes.Email && x.Value == "newUserEmail@abp.io");
+ dynamicClaimsPrincipal.Claims.ShouldContain(x => x.Type == "AspNet.Identity.SecurityStamp" && x.Value == securityStamp);//SecurityStamp is not dynamic claim
+ }
+}
diff --git a/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.Designer.cs b/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20231116094249_Initial.Designer.cs
similarity index 94%
rename from modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.Designer.cs
rename to modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20231116094249_Initial.Designer.cs
index 34487a75a8..a946b38999 100644
--- a/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.Designer.cs
+++ b/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20231116094249_Initial.Designer.cs
@@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace OpenIddict.Demo.Server.Migrations
{
[DbContext(typeof(ServerDbContext))]
- [Migration("20230404033745_Initial")]
+ [Migration("20231116094249_Initial")]
partial class Initial
{
///
@@ -22,7 +22,7 @@ namespace OpenIddict.Demo.Server.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
- .HasAnnotation("ProductVersion", "7.0.1")
+ .HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -157,6 +157,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -166,6 +167,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("nvarchar(256)");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -231,6 +233,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -239,6 +242,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("int");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -331,6 +335,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -343,6 +348,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("datetime2");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -392,6 +398,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -428,6 +435,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("int");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -571,6 +579,33 @@ namespace OpenIddict.Demo.Server.Migrations
b.ToTable("AbpUserClaims", (string)null);
});
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("EndTime")
+ .HasColumnType("datetime2");
+
+ b.Property("SourceUserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("StartTime")
+ .HasColumnType("datetime2");
+
+ b.Property("TargetUserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TenantId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpUserDelegations", (string)null);
+ });
+
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property("UserId")
@@ -685,6 +720,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -715,6 +751,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("int");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -793,6 +830,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -824,6 +862,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("nvarchar(max)");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -881,6 +920,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -905,6 +945,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnName("DeletionTime");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -955,6 +996,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -988,6 +1030,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("nvarchar(max)");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -1036,6 +1079,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -1063,6 +1107,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("datetime2");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@@ -1264,6 +1309,55 @@ namespace OpenIddict.Demo.Server.Migrations
b.ToTable("AbpSettings", (string)null);
});
+ modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DefaultValue")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("Description")
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsEncrypted")
+ .HasColumnType("bit");
+
+ b.Property("IsInherited")
+ .HasColumnType("bit");
+
+ b.Property("IsVisibleToClients")
+ .HasColumnType("bit");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("Providers")
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("AbpSettingDefinitions", (string)null);
+ });
+
modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b =>
{
b.Property("Id")
@@ -1272,6 +1366,7 @@ namespace OpenIddict.Demo.Server.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
+ .IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
@@ -1296,6 +1391,7 @@ namespace OpenIddict.Demo.Server.Migrations
.HasColumnType("int");
b.Property("ExtraProperties")
+ .IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
diff --git a/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.cs b/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20231116094249_Initial.cs
similarity index 93%
rename from modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.cs
rename to modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20231116094249_Initial.cs
index 611109065a..89de930745 100644
--- a/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20230404033745_Initial.cs
+++ b/modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20231116094249_Initial.cs
@@ -23,8 +23,8 @@ namespace OpenIddict.Demo.Server.Migrations
RegexDescription = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true),
Description = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
ValueType = table.Column(type: "int", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
@@ -107,8 +107,8 @@ namespace OpenIddict.Demo.Server.Migrations
Code = table.Column(type: "nvarchar(95)", maxLength: 95, nullable: false),
DisplayName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
EntityVersion = table.Column(type: "int", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "datetime2", nullable: false),
CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column(type: "datetime2", nullable: true),
@@ -188,8 +188,8 @@ namespace OpenIddict.Demo.Server.Migrations
IsStatic = table.Column(type: "bit", nullable: false),
IsPublic = table.Column(type: "bit", nullable: false),
EntityVersion = table.Column(type: "int", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
@@ -213,14 +213,34 @@ namespace OpenIddict.Demo.Server.Migrations
ClientIpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true),
CreationTime = table.Column(type: "datetime2", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true)
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id);
});
+ migrationBuilder.CreateTable(
+ name: "AbpSettingDefinitions",
+ columns: table => new
+ {
+ Id = table.Column(type: "uniqueidentifier", nullable: false),
+ Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
+ DisplayName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
+ Description = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true),
+ DefaultValue = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ IsVisibleToClients = table.Column(type: "bit", nullable: false),
+ Providers = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true),
+ IsInherited = table.Column(type: "bit", nullable: false),
+ IsEncrypted = table.Column(type: "bit", nullable: false),
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AbpSettingDefinitions", x => x.Id);
+ });
+
migrationBuilder.CreateTable(
name: "AbpSettings",
columns: table => new
@@ -243,8 +263,8 @@ namespace OpenIddict.Demo.Server.Migrations
Id = table.Column(type: "uniqueidentifier", nullable: false),
Name = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityVersion = table.Column(type: "int", nullable: false),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "datetime2", nullable: false),
CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column(type: "datetime2", nullable: true),
@@ -258,6 +278,22 @@ namespace OpenIddict.Demo.Server.Migrations
table.PrimaryKey("PK_AbpTenants", x => x.Id);
});
+ migrationBuilder.CreateTable(
+ name: "AbpUserDelegations",
+ columns: table => new
+ {
+ Id = table.Column(type: "uniqueidentifier", nullable: false),
+ TenantId = table.Column(type: "uniqueidentifier", nullable: true),
+ SourceUserId = table.Column(type: "uniqueidentifier", nullable: false),
+ TargetUserId = table.Column(type: "uniqueidentifier", nullable: false),
+ StartTime = table.Column(type: "datetime2", nullable: false),
+ EndTime = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AbpUserDelegations", x => x.Id);
+ });
+
migrationBuilder.CreateTable(
name: "AbpUsers",
columns: table => new
@@ -284,8 +320,8 @@ namespace OpenIddict.Demo.Server.Migrations
ShouldChangePasswordOnNextLogin = table.Column(type: "bit", nullable: false),
EntityVersion = table.Column(type: "int", nullable: false),
LastPasswordChangeTime = table.Column(type: "datetimeoffset", nullable: true),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "datetime2", nullable: false),
CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column(type: "datetime2", nullable: true),
@@ -317,8 +353,8 @@ namespace OpenIddict.Demo.Server.Migrations
Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
ClientUri = table.Column(type: "nvarchar(max)", nullable: true),
LogoUri = table.Column(type: "nvarchar(max)", nullable: true),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "datetime2", nullable: false),
CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column(type: "datetime2", nullable: true),
@@ -344,8 +380,8 @@ namespace OpenIddict.Demo.Server.Migrations
Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
Properties = table.Column(type: "nvarchar(max)", nullable: true),
Resources = table.Column(type: "nvarchar(max)", nullable: true),
- ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true),
+ ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false),
CreationTime = table.Column(type: "datetime2", nullable: false),
CreatorId = table.Column(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column(type: "datetime2", nullable: true),
@@ -553,8 +589,8 @@ namespace OpenIddict.Demo.Server.Migrations
Status = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
Subject = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: true),
Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
- ExtraProperties = table.Column