-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AllowAnonymousDashboardAuthorizationFilter for Hangfire Dashboard…
… access
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
TodoApi/Filters/AllowAnonymousDashboardAuthorizationFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Hangfire.Dashboard; | ||
|
||
namespace TodoApi.Filters; | ||
|
||
/// <summary> | ||
/// An authorization filter that allows all users to access the Hangfire dashboard. | ||
/// </summary> | ||
public class AllowAnonymousDashboardAuthorizationFilter : IDashboardAuthorizationFilter | ||
{ | ||
/// <summary> | ||
/// Authorizes access to the Hangfire dashboard. | ||
/// </summary> | ||
/// <param name="context">The dashboard context.</param> | ||
/// <returns>Always returns true, allowing all users to access the dashboard.</returns> | ||
public bool Authorize(DashboardContext context) | ||
{ | ||
return true; // Allow all users to access the dashboard | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters