Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm not able to see my dashboard in the production environment #3

Closed
flabioassuncao opened this issue Nov 26, 2020 · 5 comments
Closed

Comments

@flabioassuncao
Copy link

flabioassuncao commented Nov 26, 2020

In the local environment work fine, but when I try to see on Azure I receive the 401 error, the credentials dialog doesn't show up and I can't put username and password.

can you help me? Thanks

image

@yuzd
Copy link
Owner

yuzd commented Nov 27, 2020

@yuzd yuzd closed this as completed Nov 30, 2020
@night-king
Copy link

Me to,
It can work in debug or development env. but I receive the 401 error, the credentials dialog doesn't show up in PRODUCTION env.

@SamuelFormigheri
Copy link

@night-king I faced the same issue. In my case the error was occurring in production cause the library uses the header "WWW-Authenticate" and I think our production environment was blocking that. To resolve the issue I didn't use this library and implement an authentication using Jwt.

@srad
Copy link

srad commented Oct 30, 2023

Same issue as @night-king. Blank page in production. Would be rather strange if it's true what @SamuelFormigheri said.
Is anyone maintainnig this package?

@SamuelFormigheri
Copy link

SamuelFormigheri commented Oct 30, 2023

Same issue as @night-king. Blank page in production. Would be rather strange if it's true what @SamuelFormigheri said. Is anyone maintainnig this package?

I don't think it's currently active maintained. But the way I create a custom auth middleware was that. Hope it helps.

Program.cs:

app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
    AppPath = "#",
    IgnoreAntiforgeryToken = true,
    DashboardTitle = "Title",
    Authorization = new[] {
        new AuthMiddleware()
    }
});

AuthMiddlewareClass:

public class AuthMiddleware : IDashboardAuthorizationFilter
    {
        public AuthMiddleware() { }

        private bool ValidateToken(string token)
        {
            if (!JWT.IsValidToken(token)) // These was a custom implementation to validate my jwt
                return false;

            return true;
        }

        public bool Authorize(DashboardContext ctx)
        {

            HttpContext context = ctx.GetHttpContext();

            string? token = context.Request.Cookies["Token"];

            if (string.IsNullOrEmpty(token))
                return false;

            return ValidateToken(token);
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants