I have mini-profiler working, but now I am trying to restrict access by setting functions as described under "Profiler Security" at http://miniprofiler.com/
MiniProfiler.Settings.Results_Authorize = IsUserAllowedToSeeMiniProfilerUI;
MiniProfiler.Settings.Results_List_Authorize = IsUserAllowedToSeeMiniProfilerUI;
My IsUserAllowedToSeeMiniProfilerUI
function needs to look at the results of the ClaimsPrincipal, which is modified by a custom globally registered Authorization filter.
When I watch the calls, the primary request is authorized as expected, and IsUserAllowedToSeeMiniProfilerUI
returns true. However, the http request that retrieves the profiler results (~/mini-profiler-resources/results
or ~/mini-profiler-resources/results-index
) bypasses my global authorization filter, so the ClaimsPrincipal isn't correctly modified for that request, and IsUserAllowedToSeeMiniProfilerUI
incorrectly returns false
due to that.
I register mini-profiler's filter as GlobalFilters.Filters.Add(new ProfilingActionFilter())
, and also have the handler registered in the web.config as
<system.webServer>
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*"
type="System.Web.Routing.UrlRoutingModule"
resourceType="Unspecified" preCondition="integratedMode" />
<!-- ... -->
</handlers>
My custom authorization filter is registered in the Global.asax by adding it as GlobalFilters.Filters.Add(new MyAuthorizationFilter())
Why is mini-profiler bypassing my authorization filter?