我需要爲我的Hangfire儀表板創建一個AuthroizationFilter。檢查是一個請求來自服務器本地到OWIN
它在Azure虛擬機上運行,並通過設計應該只接受來自本地請求的請求。
我想創建一個AuthorizationFilter,它只驗證Web應用程序運行在同一虛擬機上的Web瀏覽器的請求。
我需要確定這種形式的OwinContext: -
public class MyRestrictiveAuthorizationFilter : IAuthorizationFilter
{
public bool Authorize(IDictionary<string, object> owinEnvironment)
{
// In case you need an OWIN context, use the next line,
// `OwinContext` class is the part of the `Microsoft.Owin` package.
var context = new OwinContext(owinEnvironment);
// Allow all local request to see the Dashboard
return true;
}
}