Dashboard Access with windows authentication

Tags: #<Tag:0x00007faff404b978> #<Tag:0x00007faff404b888> #<Tag:0x00007faff404b7c0>

After having issues accessing the dashboard, I found in the user guide that access by default is only for local requests

http://docs.hangfire.io/en/latest/users-guide/deployment-to-production/configuring-authorization.html

I’ve installed the NuGet package as per the guide

Install-Package Hangfire.Dashboard.Authorization

However, the site we’re using Hangfire on is an intranet site using windows authentication.

My question - is it possible to allow access to the dashboard using windows authentication? If so how would it need to be setup?

Hi @dohsan,

Please try it

public class HangfireAuthorizationFilter : IAuthorizationFilter
    {
        public bool Authorize(IDictionary<string, object> owinEnvironment)
        {
            var context = new OwinContext(owinEnvironment);
            return context.Authentication.User.Identity.IsAuthenticated && context.Authentication.User.IsInRole("Administrator");
        }
}


app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                AuthorizationFilters = new[] { new HangfireAuthorizationFilter() }
            });

My system also use windows authentication and it works well.