CustomAuthorizeFilter
:
public class CustomAuthorizeFilter : IDashboardAuthorizationFilter { public bool Authorize([NotNull] DashboardContext context) { return true; } public CustomAuthorizeFilter() { } }新增类
Configure
增加配置,代码也可以其他地方,用下面代码替换原先 app.UseHangfireDashboard() 即可。
:
app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new CustomAuthorizeFilter() } });