-
-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Description
log in as an administrator
Startup.cs
...
services.AddHangfire(x => x.UseSQLiteStorage(_configuration.GetConnectionString("DefaultConnectionSqlite")));
services.AddHangfireServer();
...
...
app.UseHangfireDashboard("/jobs", new DashboardOptions
{
DashboardTitle = localizer["BlazorHero Jobs"],
Authorization = new[] { new HangfireAuthorizationFilter() }
});
...
public class HangfireAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
//TODO implement authorization logic
var httpContext = context.GetHttpContext();
// Allow all authenticated users to see the Dashboard (potentially dangerous).
var IsAuthenticated = httpContext.User.Identity.IsAuthenticated;
var IsInRole= httpContext.User.IsInRole(Permissions.Hangfire.View);
//return httpContext.User.Identity.IsAuthenticated;
//return httpContext.User.IsInRole(Permissions.Hangfire.View);
return true;
}
}
Metadata
Metadata
Assignees
Labels
No labels