I am trying to allow access to HangFire Dashboard from any location. I have added the following code:
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[]
{
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
{
RequireSsl = false,
SslRedirect = false,
LoginCaseSensitive = false,
Users = new[]
{
new BasicAuthAuthorizationUser
{
Login = "admin",
PasswordClear = "test",
},
},
}),
},
IsReadOnlyFunc = (DashboardContext context) => true,
});
But I am getting an error:
Error CS7069 Reference to type 'IAuthorizationFilter' claims it is defined in 'Hangfire.Core', but it could not be found
How can I configure the dashboard with simple user access?
Hangfire.Dashboard.Authorization
is only compatible with .NET Framework.
For .NET Core you should use Hangfire.Dashboard.BasicAuthorization
It only supports the basic authorization, but your piece of code will work as is.