Basic authentication does not work in production as explained in the example

My application does not use authentication, so I need a way to access the hangfire panel production, after searching the forum I saw the suggestion to use Basic authentication.

The problem is that it does not.

This is my class:

public partial class Startup
{
    public void Configuration(IAppBuilder app)
    {

        GlobalConfiguration.Configuration
            .UseSqlServerStorage("MY STRING");


        var filter = new BasicAuthAuthorizationFilter(
                        new BasicAuthAuthorizationFilterOptions
                        {
                            // Require secure connection for dashboard
                            RequireSsl = false,
                            SslRedirect = false,

                            // Case sensitive login checking
                            LoginCaseSensitive = true,
                            // Users
                            Users = new[]
                            {
                                new BasicAuthAuthorizationUser
                                {
                                    Login = "Ricardo",
                                    PasswordClear = "teste"
                                   
                                }
                            }
                        });

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

        app.UseHangfireServer();


        ConfigureAuth(app);
    }
}

This works on localhost, it requests User and password, authenticates and I have access. When this runs on the server it asks User and password, but do not know why, it is looped.

You enter User and Password and he asks again. You enter User and Password again, and this continues forever.

According to the example that should work in production, right?

Could someone show me where I went wrong?

Ty
Ricardo

I found the solution, you should disable all the authentication methods for your IIS Site App preserving just Anonymous Authentication in Active state.

1 Like

I am trying to use the same code for Basic Authentication and I am getting message “Authentication is Required.”

Can someone please help me here ?