不使用身份验证即可进行Hangfire [英] Exposing hangfire without auth

查看:284
本文介绍了不使用身份验证即可进行Hangfire的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种无需配置授权即可在IIS中公开Hangfire的方法?

Is there a way to expose Hangfire in IIS without having to configure authorization?

在这种特定情况下,仪表板应该处于打开状态,但是在访问它时(不在调试中)它将返回401代码.

In this specific case the dashboard should be open, but when accessing it (not in debug) it returns a 401 code.

推荐答案

我认为您应该能够按照

I think you should be able to write a custom implementation of IDashboardAuthorizationFilter as described in the documentation. Be aware that the default is only local requests to the dashboard are allowed. It's also recommended that you really use authorization and do not publish unauthorized dashboards as it contains sensitive information.

如果您仍然想要这样做,请尝试:

If you still want to do it, try:

自定义DashboardAuthorizationFilter

public class MyAuthorizationFilter : IDashboardAuthorizationFilter
{
    public bool Authorize(DashboardContext context)
    {
        return true;
    }
}

在hangfire的配置中使用它

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

这篇关于不使用身份验证即可进行Hangfire的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆