Browse Source

Merge branch 'dev' into auto-merge/rel-9-3/3819

pull/23165/head
selman koc 1 year ago
committed by GitHub
parent
commit
075c982018
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
  2. 7
      abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json
  3. 4
      common.props
  4. 203
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/POST.md
  5. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/abp-studio.png
  6. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/audit-logs-export-to-excel.png
  7. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/bootcamp.png
  8. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/community-talk-2025-5.png
  9. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/cover-image.png
  10. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/download-pdf-on-docs.png
  11. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/generate-pdf-docs.png
  12. BIN
      docs/en/Blog-Posts/2025-06-18 v9_3_Preview/studio-switch-to-preview.png
  13. 250
      docs/en/Community-Articles/2025-06-20-Using-Hangfire-Dashboard-in-ABP-API-website/POST.md
  14. BIN
      docs/en/Community-Articles/2025-06-20-Using-Hangfire-Dashboard-in-ABP-API-website/gif.gif
  15. 63
      docs/en/framework/infrastructure/background-jobs/hangfire.md
  16. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/JQueryValidation/JQueryValidationScriptContributor.cs
  17. 50
      framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireAuthorizationFilter.cs
  18. 3
      npm/packs/jquery-validation/abp.resourcemapping.js
  19. 27
      npm/packs/jquery-validation/src/abp.jquery.validate.js

4
abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json

@ -721,6 +721,8 @@
"NuGetApiKey": "NuGet API key",
"QuestionCount": "Question Count",
"MakeAnnouncement": "Make Announcement",
"MakeAnnouncementInfo": "Check it if you want to make an announcement for this post"
"MakeAnnouncementInfo": "Check it if you want to make an announcement for this post",
"Permission:ViewCounts": "View counts",
"ReadCount": "Read Count"
}
}

7
abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json

@ -534,7 +534,7 @@
"WhenShouldIRenewMyLicenseExplanation2": "{0} for Team Licenses;",
"WhenShouldIRenewMyLicenseExplanation3": "{0} for Business and Enterprise Licenses;",
"WhenShouldIRenewMyLicenseExplanation4": "However, if you renew your license more than {0} days after the expiry date, the renewal price will be the same as the initial purchase price of the license, with no discounts applied to your renewal.",
"DoesTheSubscriptionRenewAutomaticallyExplanationAutoRenewal": "ABP Platform allows you to auto-renew your license. This is an optional free service. You can toggle this feature when you purchase a new license or later enable it from your <a href=\"{0}\">organization management page</a>. If you want to turn on or off the auto-renewal, visit the <a href=\"{0}\">organization management page</a>, go to the 'Payments Method' section and either check or uncheck the 'Automatic Renewal' checkbox. When you turn off the auto-renewal feature, it will be your responsibility to renew your license manually.",
"DoesTheSubscriptionRenewAutomaticallyExplanationAutoRenewal": "ABP Platform allows you to auto-renew your license. This is an optional free service. You can toggle this feature when you purchase a new license or later enable it from your <a href=\"{0}\">organization management page</a>. If you want to turn on or off the auto-renewal, visit the <a href=\"{0}\">organization management page</a>, go to the 'Payments Method' section and either check or uncheck the 'Automatic Renewal' checkbox. When you turn off the auto-renewal feature, it will be your responsibility to renew your license manually. <br> The <strong>renewals (manual)</strong> are non-refundable. On the other hand, all subscription <strong>auto-renewals</strong> are non-refundable after <strong>10 calendar days</strong> from the auto-renewal date. If you don't wish to continue your license, it is your responsibility to manage the renewal settings and cancel the subscription before the automatic renewal date.",
"TrialPlanExplanation": "Yes, to start your free trial, please contact <a href=\"mailto:sales@volosoft.com?subject=Trial License Request\">sales@volosoft.com</a>. We also offer a 30-day money-back guarantee for the Team license, with no questions asked! You can request a full refund within the first 30 days of purchasing the license. For Business and Enterprise licenses, we provide a 60% refund if requested within 30 days of purchase. This policy is due to the inclusion of the full source code for all modules and themes in the Business and Enterprise licenses.",
"BlazoriseLicenseExplanation": "We have an agreement between Volosoft and Megabit, according to which the Blazorise license is bundled with the ABP Platform’s commercial licenses. Therefore, our paid users do not need to purchase an additional Blazorise license.",
"HowToUpgradeExplanation1": "When you create a new application using the ABP startup templates, all the modules and themes are used as NuGet and NPM packages. This setup allows for easy upgrades to newer versions of the packages.",
@ -1425,7 +1425,7 @@
"TotalDevelopers": "Total {0} developer(s)",
"CustomPurchaseExplanation": "Tailored to your specific needs",
"WhereDidYouHearAboutUs": "Where did you hear about us?",
"Twitter": "Twitter",
"Twitter": "Twitter (X)",
"Facebook": "Facebook",
"Youtube": "YouTube",
"Google": "Google",
@ -1891,6 +1891,7 @@
"CreatePostSEOTitleInfo": "SEO URL is a clean, readable, keyword-rich URL that helps both users and search engines understand what this post is about. Keep it short with 60 characters. SEO titles over 60 characters will be truncated. Use hyphens (-) to separate words (not underscores). Include target keywords near the start. Lowercase only. No stop words unless needed (e.g: \"and\", \"or\", \"the\").",
"SEOTitle": "SEO URL",
"InvalidYouTubeUrl": "The URL you entered is not a valid YouTube video link. Please make sure it points to a specific video and try again.",
"SelectAnOption": "Select an option"
"SelectAnOption": "Select an option",
"MostPopular": "Most Popular"
}
}

4
common.props

@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>9.3.0-rc.2</Version>
<LeptonXVersion>4.3.0-rc.2</LeptonXVersion>
<Version>10.0.0-preview</Version>
<LeptonXVersion>5.0.0-preview</LeptonXVersion>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<PackageIconUrl>https://abp.io/assets/abp_nupkg.png</PackageIconUrl>
<PackageProjectUrl>https://abp.io/</PackageProjectUrl>

203
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/POST.md

@ -0,0 +1,203 @@
# ABP Platform 9.3 RC Has Been Released
We are happy to release [ABP](https://abp.io) version **9.3 RC** (Release Candidate). This blog post introduces the new features and important changes in this new version.
Try this version and provide feedback for a more stable version of ABP v9.3! Thanks to you in advance.
## Get Started with the 9.3 RC
You can check the [Get Started page](https://abp.io/get-started) to see how to get started with ABP. You can either download [ABP Studio](https://abp.io/get-started#abp-studio-tab) (**recommended**, if you prefer a user-friendly GUI application - desktop application) or use the [ABP CLI](https://abp.io/docs/latest/cli).
By default, ABP Studio uses stable versions to create solutions. Therefore, if you want to create a solution with a preview version, first you need to create a solution and then switch your solution to the preview version from the ABP Studio UI:
![studio-switch-to-preview.png](studio-switch-to-preview.png)
## Migration Guide
There are a few breaking changes in this version that may affect your application. Please read the migration guide carefully, if you are upgrading from v9.2 or earlier: [ABP Version 9.3 Migration Guide](https://abp.io/docs/9.3/release-info/migration-guides/abp-9-3)
## What's New with ABP v9.3?
In this section, I will introduce some major features released in this version.
Here is a brief list of titles explained in the next sections:
* Cron Expression Support for Background Workers
* Docs Module: PDF Export
* Angular UI: Standalone Package Structure
* Upgraded to Blazorise v1.7.7
* Audit Logging Module: Excel Export
### Cron Expression Support for Background Workers
We've enhanced the [Background Workers System](https://abp.io/docs/9.3/framework/infrastructure/background-workers) by adding support for Cron expressions when using [Hangfire](https://abp.io/docs/9.3/framework/infrastructure/background-workers/hangfire) or [Quartz](https://abp.io/docs/9.3/framework/infrastructure/background-workers/quartz) as the background worker manager. This new feature provides more flexibility in scheduling background tasks compared to the simple period-based timing system.
Now you can define complex scheduling patterns using standard Cron expressions. For example, you can schedule a task to run: "Every day at midnight", "Every Monday at 9 AM", or "First day of every month".
Here's how you can use it in your background worker:
```csharp
public class MyPeriodicBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
{
public MyPeriodicBackgroundWorker(
AbpAsyncTimer timer,
IServiceScopeFactory serviceScopeFactory)
: base(timer, serviceScopeFactory)
{
// You can either use Period for simple intervals
Timer.Period = 600000; //10 minutes
// 👇 or use CronExpression for more complex scheduling 👇
CronExpression = "0 0/10 * * * ?"; //Run every 10 minutes
}
protected async override Task DoWorkAsync(
PeriodicBackgroundWorkerContext context)
{
// Your background work...
}
}
```
The `CronExpression` property takes precedence over the `Period` property when both are set. This feature is available when you use either the [Hangfire](https://abp.io/docs/9.3/framework/infrastructure/background-workers/hangfire) or [Quartz](https://abp.io/docs/9.3/framework/infrastructure/background-workers/quartz) background worker managers.
> See the [Background Workers documentation](https://abp.io/docs/9.3/framework/infrastructure/background-workers) for more information about configuring and using background workers with Cron expressions.
### Docs Module: PDF Export
We're excited to introduce a new feature in the Docs Module that allows users to export documentation as PDF files. This feature makes it easier for users to access documentation offline or share it with team members who might not have immediate access to the online documentation system.
**Administrators can generate PDF files from the back-office side**:
![PDF generation settings in the admin side](generate-pdf-docs.png)
and **then a "Download PDF" button appears in the document system** (as shown in the image below - the bottom right of the navigation menu -), allowing users to download the compiled documentation as a PDF file:
![Download PDF button in the documentation system](download-pdf-on-docs.png)
The feature supports multiple versions of documentation, different language variants, and ensures proper formatting of all content including code blocks and technical documentation.
### Angular UI: Standalone Package Structure
ABP v9.3 introduces support for Angular's standalone components architecture while maintaining **full compatibility with existing module-based applications**. This update aligns with Angular's strategic direction toward standalone components as the recommended approach for building Angular applications.
The key improvements include:
* **Dual-support routing configurations** that work seamlessly with both module-based and standalone approaches
* **ABP Suite integration** for generating code that supports standalone components
* **Updated schematics** that provide templates for both development patterns
This enhancement gives developers the flexibility to choose their preferred Angular architecture. Existing module-based applications **continue to work without modifications**, while new projects can leverage the standalone approach for simplified dependency management, reduced boilerplate code, and better lazy-loading capabilities.
> For developers interested in migrating to standalone components or starting new projects, we'll be publishing a comprehensive blog post with detailed guidance and best practices. In the meantime, you can check [#22829](https://github.com/abpframework/abp/pull/22829) for implementation details of the standalone package structure and make the necessary changes to your project.
### Upgraded to Blazorise v1.7.7
Upgraded the [Blazorise](https://blazorise.com/) library to v1.7.7 for Blazor UI. If you are upgrading your project to v9.3.0, please ensure that all the Blazorise-related packages are using v1.7.7 in your application. Otherwise, you might get errors due to incompatible versions.
> See [#23013](https://github.com/abpframework/abp/pull/23013) for the updated NuGet packages.
### Audit Logging Module: Excel Export
In this version, we've added Excel export capabilities to the [Audit Logging Module](https://abp.io/docs/latest/modules/audit-logging-pro), allowing administrators to export audit logs and entity changes to Excel files for further analysis or reporting purposes.
![](audit-logs-export-to-excel.png)
This feature enables users to:
- Export audit logs with filtering options
- Export entity changes with detailed information
- Receive email notifications when exports are completed or fail
- Download exported files via secure links
The export process runs in the background, and once completed, users receive an email with a download link. This approach ensures that even large audit log exports don't block the UI or time out during processing.
You can configure various aspects of this feature using the `AuditLogExcelFileOptions` in your module's configuration:
```csharp
Configure<AuditLogExcelFileOptions>(options =>
{
// How long to keep exported files before cleanup
options.FileRetentionHours = 48;
// Base URL for download links in notification emails
options.DownloadBaseUrl = "https://yourdomain.com";
// Configure the cleanup worker schedule
options.ExcelFileCleanupOptions.Period = (int)TimeSpan.FromHours(24).TotalMilliseconds;
// Use cron expression for more advanced scheduling (requires Hangfire or Quartz)
options.ExcelFileCleanupOptions.CronExpression = "0 2 * * *"; // Run at 2 AM daily
});
```
The module includes pre-configured email templates for notifications about completed or failed exports, ensuring users are always informed about the status of their export requests.
> **Note**: This feature requires a configured BLOB storage provider to store the generated Excel files. See the [BLOB Storing documentation](https://abp.io/docs/9.3/framework/infrastructure/blob-storing) for more information.
For more details about the Audit Logging Module and its Excel export capabilities, please refer to the [official documentation](https://abp.io/docs/9.3/modules/audit-logging-pro).
## Community News
### Announcing ABP Studio 1.0 General Availability 🚀
![](abp-studio.png)
We are thrilled to announce that ABP Studio has reached version 1.0 and is now generally available! This marks a significant milestone for our integrated development environment designed specifically for ABP developers. The stable release brings several powerful features including:
* Enhanced Solution Runner with health monitoring capabilities
* Theme style selection during project creation (Basic, LeptonX Lite, and LeptonX Themes)
* New "Container" application type for better Docker container management
* Improved handling of multiple DbContexts for migration operations
> For a detailed overview of these features and to learn more about what's coming next, check out our [announcement post](https://abp.io/community/articles/announcing-abp-studio-1-0-general-availability-82yw62bt).
### ABP Community Talks 2025.05: Empower Elsa Workflows with AI in .NET + ABP Framework
In this episode of ABP Community Talks, 2025.05, we are thrilled to host [**Sipke Schoorstra**](https://github.com/sfmskywalker), the creator of the [Elsa Workflows](https://docs.elsaworkflows.io/) library! This month's session is all about **"Empower Elsa Workflows with AI in .NET + ABP Framework"**.
![](community-talk-2025-5.png)
Sipke will join us to demonstrate how you can leverage AI within Elsa Workflows using .NET and the ABP Framework. The session will explore practical techniques and showcase how to integrate AI capabilities to enhance and automate your business processes within the Elsa workflow engine.
> 👉 Don't miss this opportunity to learn directly from the creator of Elsa and see real-world examples of building intelligent, automated workflows! You can register from [here](https://kommunity.com/volosoft/events/abp-community-talks-202505empower-elsa-workflows-with-ai-in-netabp-framework-3965dd32).
### ABP Bootcamp: Mastering Infrastructure & Features
We are excited to announce the very first **ABP Bootcamp: Mastering Infrastructure & Features**! This is a live training program designed to give you hands-on, practical experience with ABP's core infrastructure and features.
![ABP Bootcamp: Mastering Infrastructure & Features](bootcamp.png)
Join the ABP Bootcamp to learn directly from the core team in a focused, hands-on program designed for busy developers. Over four days, you'll gain a deep understanding of ABP's infrastructure, best practices, and practical skills you can immediately apply to your projects.
> **Seats are limited!** Don't miss this opportunity to level up your ABP skills with direct guidance from the experts.
>
> 👉 [See full details and reserve your seat!](https://abp.io/bootcamp)
### New ABP Community Articles
There are exciting articles contributed by the ABP community as always. I will highlight some of them here:
* [Prabhjot Singh](https://abp.io/community/members/prabhjot) has published 3 new articles:
* [Accessing Multiple Remote ABP based Backends Using HttpApi.Client](https://abp.io/community/articles/consume-multi-backends-using-clients-6f4vcggh)
* [Adopting the new .slnx format to organize applications and services](https://abp.io/community/articles/adopting-the-new-.slnx-format-to-organize-applications-6cm3vl8k)
* [Replacing Dynamic client proxies with Static client proxies](https://abp.io/community/articles/replacing-dynamic-client-proxies-with-static-client-proxies-g30lf0vx)
* [Liming Ma](https://github.com/maliming) has published 2 new articles:
* [Resolving Tenant from Route in ABP Framework](https://abp.io/community/articles/resolving-tenant-from-route-in-abp-framework-ah7oru97)
* [Integrating .NET AI Chat Template with ABP Framework](https://abp.io/community/articles/integrating-.net-ai-chat-template-with-abp-framework-qavb5p2j)
* [Engincan Veske](https://engincanveske.substack.com/) has published 2 new articles:
* [Understanding HttpApi.Client Project & Remote Services in an ABP Based Application](https://abp.io/community/articles/http-api-client-and-remote-services-in-abp-based-application-xkknsp6m)
* [Using Elsa 3 with the ABP Framework: A Comprehensive Guide](https://abp.io/community/articles/using-elsa-3-workflow-with-abp-framework-usqk8afg)
* [Enis Necipoğlu](https://github.com/enisn) has published 2 new articles:
* [White Labeling in ABP Framework](https://abp.io/community/articles/white-labeling-in-abp-framework-5trwmrfm) by [Enis Necipoğlu](https://github.com/enisn)
* [You do it wrong! Customizing ABP Login Page Correctly](https://abp.io/community/articles/you-do-it-wrong-customizing-abp-login-page-correctly-bna7wzt5)
* [New in ABP Studio: Docker Container Management](https://abp.io/community/articles/abp-studio-docker-container-management-ex7r27y8) by [Yunus Emre Kalkan](https://github.com/yekalkan)
* [Solving MongoDB GUID Issues After an ABP Framework Upgrade](https://abp.io/community/articles/solving-mongodb-guid-issues-after-an-abp-framework-upgrade-tv8waw1n) by [Burak Demir](https://abp.io/community/members/burakdemir)
Thanks to the ABP Community for all the content they have published. You can also [post your ABP-related (text or video) content](https://abp.io/community/posts/create) to the ABP Community.
## Conclusion
This version comes with some new features and a lot of enhancements to the existing features. You can see the [Road Map](https://abp.io/docs/9.3/release-info/road-map) documentation to learn about the release schedule and planned features for the next releases. Please try ABP v9.3 RC and provide feedback to help us release a more stable version.
Thanks for being a part of this community!

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/abp-studio.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/audit-logs-export-to-excel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/bootcamp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/community-talk-2025-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/cover-image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/download-pdf-on-docs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/generate-pdf-docs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
docs/en/Blog-Posts/2025-06-18 v9_3_Preview/studio-switch-to-preview.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

250
docs/en/Community-Articles/2025-06-20-Using-Hangfire-Dashboard-in-ABP-API-website/POST.md

@ -0,0 +1,250 @@
# Using Hangfire Dashboard in ABP API Website 🚀
## Introduction
In this article, I'll show you how to integrate and use the Hangfire Dashboard in an ABP API website.
Typically, API websites use `JWT Bearer` authentication, but the Hangfire Dashboard isn't compatible with `JWT Bearer` authentication. Therefore, we need to implement `Cookies` and `OpenIdConnect` authentication for the Hangfire Dashboard access.
## Creating a New ABP Demo Project 🛠️
We'll create a new ABP Demo `Tiered` project that includes `AuthServer`, `API`, and `Web` projects.
```bash
abp new AbpHangfireDemoApp -t app --tiered
```
Now let's add the Hangfire Dashboard to the `API` project and configure it to use `Cookies` and `OpenIdConnect` authentication for accessing the dashboard.
## Adding a New Hangfire Application 🔧
We need to add a new Hangfire application to the `appsettings.json` file in the `DbMigrator` project:
> **Note:** Replace `44371` with your `API` project's port.
```json
"OpenIddict": {
"Applications": {
//...
"AbpHangfireDemoApp_Hangfire": {
"ClientId": "AbpHangfireDemoApp_Hangfire",
"RootUrl": "https://localhost:44371/"
}
//...
}
}
```
2. Update the `OpenIddictDataSeedContributor`'s `CreateApplicationsAsync` method in the `Domain` project to seed the new Hangfire application.
```csharp
//Hangfire Client
var hangfireClientId = configurationSection["AbpHangfireDemoApp_Hangfire:ClientId"];
if (!hangfireClientId.IsNullOrWhiteSpace())
{
var hangfireClientRootUrl = configurationSection["AbpHangfireDemoApp_Hangfire:RootUrl"]!.EnsureEndsWith('/');
await CreateApplicationAsync(
applicationType: OpenIddictConstants.ApplicationTypes.Web,
name: hangfireClientId!,
type: OpenIddictConstants.ClientTypes.Confidential,
consentType: OpenIddictConstants.ConsentTypes.Implicit,
displayName: "Hangfire Application",
secret: configurationSection["AbpHangfireDemoApp_Hangfire:ClientSecret"] ?? "1q2w3e*",
grantTypes: new List<string> //Hybrid flow
{
OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.Implicit
},
scopes: commonScopes,
redirectUris: new List<string> { $"{hangfireClientRootUrl}signin-oidc" },
postLogoutRedirectUris: new List<string> { $"{hangfireClientRootUrl}signout-callback-oidc" },
clientUri: hangfireClientRootUrl,
logoUri: "/images/clients/aspnetcore.svg"
);
}
```
3. Run the `DbMigrator` project to seed the new Hangfire application.
### Adding Hangfire Dashboard to the `API` Project 📦
1. Add the following packages and modules dependencies to the `API` project:
```bash
<PackageReference Include="Volo.Abp.BackgroundJobs.HangFire" Version="9.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.OpenIdConnect" Version="9.2.0" />
<PackageReference Include="Hangfire.SqlServer" Version="1.8.20" />
```
```cs
typeof(AbpBackgroundJobsHangfireModule),
typeof(AbpAspNetCoreAuthenticationOpenIdConnectModule)
```
2. Add the `HangfireClientId` and `HangfireClientSecret` to the `appsettings.json` file in the `API` project:
```csharp
"AuthServer": {
"Authority": "https://localhost:44358",
"RequireHttpsMetadata": true,
"MetaAddress": "https://localhost:44358",
"SwaggerClientId": "AbpHangfireDemoApp_Swagger",
"HangfireClientId": "AbpHangfireDemoApp_Hangfire",
"HangfireClientSecret": "1q2w3e*"
}
```
3. Add the `ConfigureHangfire` method to the `API` project to configure Hangfire:
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment();
//...
//Add Hangfire
ConfigureHangfire(context, configuration);
//...
}
private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddHangfire(config =>
{
config.UseSqlServerStorage(configuration.GetConnectionString("Default"));
});
}
```
4. Modify the `ConfigureAuthentication` method to add new `Cookies` and `OpenIdConnect` authentication schemes:
```csharp
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddAbpJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
options.Audience = "AbpHangfireDemoApp";
options.ForwardDefaultSelector = httpContext => httpContext.Request.Path.StartsWithSegments("/hangfire", StringComparison.OrdinalIgnoreCase)
? CookieAuthenticationDefaults.AuthenticationScheme
: null;
})
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
.AddAbpOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.ResponseType = OpenIdConnectResponseType.Code;
options.ClientId = configuration["AuthServer:HangfireClientId"];
options.ClientSecret = configuration["AuthServer:HangfireClientSecret"];
options.UsePkce = true;
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("roles");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("AbpHangfireDemoApp");
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
});
//...
}
```
5. Add a custom middleware and `UseAbpHangfireDashboard` after `UseAuthorization` in the `OnApplicationInitialization` method:
```csharp
//...
app.UseAuthorization();
app.Use(async (httpContext, next) =>
{
if (httpContext.Request.Path.StartsWithSegments("/hangfire", StringComparison.OrdinalIgnoreCase))
{
var authenticateResult = await httpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);
if (!authenticateResult.Succeeded)
{
await httpContext.ChallengeAsync(
OpenIdConnectDefaults.AuthenticationScheme,
new AuthenticationProperties
{
RedirectUri = httpContext.Request.Path + httpContext.Request.QueryString
});
return;
}
}
await next.Invoke();
});
app.UseAbpHangfireDashboard("/hangfire", options =>
{
options.AsyncAuthorization = new[]
{
new AbpHangfireAuthorizationFilter()
};
});
//...
```
Perfect! 🎉 Now you can run the `AuthServer` and `API` projects and access the Hangfire Dashboard at `https://localhost:44371/hangfire`.
> **Note:** Replace `44371` with your `API` project's port.
The first time you access the Hangfire Dashboard, you'll be redirected to the login page of the `AuthServer` project. After you log in, you'll be redirected back to the Hangfire Dashboard.
![Hangfire Dashboard](gif.gif)
## Key Points 🔑
### 1. Authentication Scheme Selection
The default authentication scheme in API websites is `JWT Bearer`. We've implemented `Cookies` and `OpenIdConnect` specifically for the Hangfire Dashboard.
We've configured the `JwtBearerOptions`'s `ForwardDefaultSelector` to use `CookieAuthenticationDefaults.AuthenticationScheme` for Hangfire Dashboard requests.
This means that if the request path starts with `/hangfire`, the request will be authenticated using the `Cookies` authentication scheme; otherwise, it will use the `JwtBearer` authentication scheme.
```csharp
options.ForwardDefaultSelector = httpContext => httpContext.Request.Path.StartsWithSegments("/hangfire", StringComparison.OrdinalIgnoreCase)
? CookieAuthenticationDefaults.AuthenticationScheme
: null;
```
### 2. Custom Middleware for Authentication
We've also implemented a custom middleware to handle `Cookies` authentication for the Hangfire Dashboard. If the current request isn't authenticated with the `Cookies` authentication scheme, it will be redirected to the login page.
```csharp
app.Use(async (httpContext, next) =>
{
if (httpContext.Request.Path.StartsWithSegments("/hangfire", StringComparison.OrdinalIgnoreCase))
{
var authenticateResult = await httpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);
if (!authenticateResult.Succeeded)
{
await httpContext.ChallengeAsync(
OpenIdConnectDefaults.AuthenticationScheme,
new AuthenticationProperties
{
RedirectUri = httpContext.Request.Path + httpContext.Request.QueryString
});
return;
}
}
await next.Invoke();
});
```
## References 📚
- [ABP Hangfire Background Job Manager](https://abp.io/docs/latest/framework/infrastructure/background-jobs/hangfire)
- [Use cookie authentication in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/cookie?view=aspnetcore-9.0)

BIN
docs/en/Community-Articles/2025-06-20-Using-Hangfire-Dashboard-in-ABP-API-website/gif.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

63
docs/en/framework/infrastructure/background-jobs/hangfire.md

@ -159,14 +159,24 @@ app.UseAbpHangfireDashboard("/hangfire", options =>
`AbpHangfireAuthorizationFilter` class has the following fields:
* **`enableTenant` (`bool`, default: `false`):** Enables/disables accessing the Hangfire dashboard on tenant users.
* **`requiredPermissionName` (`string`, default: `null`):** Hangfire dashboard is accessible only if the current user has the specified permission. In this case, if we specify a permission name, we don't need to set `enableTenant` `true` because the permission system already does it.
* **`requiredPermissionName` (`string`, default: `null`):** Hangfire dashboard is accessible only if the current user has the specified permission.
* **`requiredRoleNames` (`string[]`, default: `[]`):** Hangfire dashboard is accessible only if the current user has one of the specified roles.
If you want to require an additional permission, you can pass it into the constructor as below:
If you want to require more policies, you can use the `PolicyBuilder` property of the `AbpHangfireAuthorizationFilter` class.
```csharp
app.UseAbpHangfireDashboard("/hangfire", options =>
{
options.AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(requiredPermissionName: "MyHangFireDashboardPermissionName") };
var hangfireAuthorizationFilter = new AbpHangfireAuthorizationFilter(requiredPermissionName: "MyHangFireDashboardPermissionName");
//hangfireAuthorizationFilter.PolicyBuilder.AddRequirements(new PermissionRequirement("YourPermissionName"));
//hangfireAuthorizationFilter.PolicyBuilder.RequireRole("YourCustomRole");
//hangfireAuthorizationFilter.PolicyBuilder.Requirements.Add(new YourCustomRequirement());
options.AsyncAuthorization = new[]
{
hangfireAuthorizationFilter
};
});
```
@ -190,18 +200,20 @@ private void ConfigureAuthentication(ServiceConfigurationContext context, IConfi
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
options.Audience = "MyProjectName";
});
context.Services.AddAuthentication()
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
options.ForwardDefaultSelector = httpContext => httpContext.Request.Path.StartsWithSegments("/hangfire", StringComparison.OrdinalIgnoreCase)
? CookieAuthenticationDefaults.AuthenticationScheme
: null;
})
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
.AddAbpOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.ResponseType = OpenIdConnectResponseType.Code;
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.ClientId = configuration["AuthServer:HangfireClientId"];
options.ClientSecret = configuration["AuthServer:HangfireClientSecret"];
options.UsePkce = true;
options.SaveTokens = true;
@ -211,6 +223,8 @@ private void ConfigureAuthentication(ServiceConfigurationContext context, IConfi
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("MyProjectName");
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
});
}
```
@ -218,26 +232,27 @@ private void ConfigureAuthentication(ServiceConfigurationContext context, IConfi
```csharp
app.Use(async (httpContext, next) =>
{
if (httpContext.Request.Path.StartsWithSegments("/hangfire"))
if (httpContext.Request.Path.StartsWithSegments("/hangfire", StringComparison.OrdinalIgnoreCase))
{
var result = await httpContext.AuthenticateAsync("Cookies");
if (result.Succeeded)
var authenticateResult = await httpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);
if (!authenticateResult.Succeeded)
{
httpContext.User = result.Principal;
await next(httpContext);
await httpContext.ChallengeAsync(
OpenIdConnectDefaults.AuthenticationScheme,
new AuthenticationProperties
{
RedirectUri = httpContext.Request.Path + httpContext.Request.QueryString
});
return;
}
await httpContext.ChallengeAsync("oidc");
}
else
{
await next(httpContext);
}
await next.Invoke();
});
app.UseAbpHangfireDashboard("/hangfire", options =>
{
options.AsyncAuthorization = new[] {new AbpHangfireAuthorizationFilter()};
options.AsyncAuthorization = new[]
{
new AbpHangfireAuthorizationFilter()
};
});
```

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/JQueryValidation/JQueryValidationScriptContributor.cs

@ -15,6 +15,10 @@ public class JQueryValidationScriptContributor : BundleContributor
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/jquery-validation/jquery.validate.js");
if (context.FileProvider.GetFileInfo("/libs/jquery-validation/abp.jquery.validate.js").Exists)
{
context.Files.AddIfNotContains("/libs/jquery-validation/abp.jquery.validate.js");
}
}
public override void ConfigureDynamicResources(BundleConfigurationContext context)

50
framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireAuthorizationFilter.cs

@ -1,53 +1,49 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Hangfire.Dashboard;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Users;
using Volo.Abp.Authorization;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Hangfire;
public class AbpHangfireAuthorizationFilter : IDashboardAsyncAuthorizationFilter
{
private readonly bool _enableTenant;
private readonly string? _requiredPermissionName;
private readonly AuthorizationPolicyBuilder _policyBuilder;
public AbpHangfireAuthorizationFilter(bool enableTenant = false, string? requiredPermissionName = null)
{
_enableTenant = requiredPermissionName.IsNullOrWhiteSpace() ? enableTenant : true;
_requiredPermissionName = requiredPermissionName;
}
public virtual AuthorizationPolicyBuilder PolicyBuilder => _policyBuilder;
public async Task<bool> AuthorizeAsync(DashboardContext context)
public AbpHangfireAuthorizationFilter(bool enableTenant = false, string? requiredPermissionName = null, params string[]? requiredRoleNames)
{
if (!IsLoggedIn(context, _enableTenant))
_enableTenant = enableTenant;
_policyBuilder = new AuthorizationPolicyBuilder().RequireAuthenticatedUser();
if (!requiredPermissionName.IsNullOrWhiteSpace())
{
return false;
_policyBuilder.Requirements.Add(new PermissionRequirement(requiredPermissionName));
}
if (_requiredPermissionName.IsNullOrEmpty())
if (!requiredRoleNames.IsNullOrEmpty())
{
return true;
foreach (var roleName in requiredRoleNames!)
{
_policyBuilder.RequireRole(roleName);
}
}
return await IsPermissionGrantedAsync(context, _requiredPermissionName!);
}
private static bool IsLoggedIn(DashboardContext context, bool enableTenant)
public virtual async Task<bool> AuthorizeAsync(DashboardContext context)
{
var currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
if (!enableTenant)
var currentTenant = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentTenant>();
if (currentTenant.IsAvailable && !_enableTenant)
{
return currentUser.IsAuthenticated && !currentUser.TenantId.HasValue;
return false;
}
return currentUser.IsAuthenticated;
}
private static async Task<bool> IsPermissionGrantedAsync(DashboardContext context, string requiredPermissionName)
{
var permissionChecker = context.GetHttpContext().RequestServices.GetRequiredService<IPermissionChecker>();
return await permissionChecker.IsGrantedAsync(requiredPermissionName);
var authorizationService = context.GetHttpContext().RequestServices.GetRequiredService<IAuthorizationService>();
var authorizationPolicy = _policyBuilder.Build();
return (await authorizationService.AuthorizeAsync(context.GetHttpContext().User, authorizationPolicy)).Succeeded;
}
}

3
npm/packs/jquery-validation/abp.resourcemapping.js

@ -1,6 +1,7 @@
module.exports = {
mappings: {
"@node_modules/jquery-validation/dist/jquery.validate.js": "@libs/jquery-validation/",
"@node_modules/jquery-validation/dist/localization/*.*": "@libs/jquery-validation/localization/"
"@node_modules/jquery-validation/dist/localization/*.*": "@libs/jquery-validation/localization/",
"@node_modules/@abp/jquery-validation/src/*.*": "@libs/jquery-validation/"
}
}

27
npm/packs/jquery-validation/src/abp.jquery.validate.js

@ -0,0 +1,27 @@
$.validator.methods.range = function (value, element, param) {
if (this.optional(element)) {
return true;
}
// Remove thousands separators and convert decimal separators
var cleanValue = value.replace(/[.,](?=.*[.,])/g, '').replace(/[.,](?!.*[.,])/g, '.');
var numericValue = parseFloat(cleanValue);
// Check if conversion was successful and value is within range
return !isNaN(numericValue) && (numericValue >= param[0] && numericValue <= param[1]);
};
$.validator.methods.number = function (value, element) {
if (this.optional(element)) {
return true;
}
// 1. Period as decimal separator, comma as thousands separator (e.g., 1,234.56 or -1,234.56)
// 2. Comma as decimal separator, period as thousands separator (e.g., 1.234,56 or -1.234,56)
// 3. Pure numbers (integers)
var pattern1 = /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/;
var pattern2 = /^(?:-?\d+|-?\d{1,3}(?:\.\d{3})+)?(?:-?,\d+)?$/;
var pattern3 = /^-?\d+$/;
return pattern1.test(value) || pattern2.test(value) || pattern3.test(value);
}
Loading…
Cancel
Save