To properly check who can access the profiler results, I first need to authenticate the user, but the authentication API is async. That means I have to block the call in ResultsAuthorize, for example:
services.AddMiniProfiler(options =>
{
options.RouteBasePath = "/profiler";
options.ResultsAuthorize = request =>
{
var context = request.HttpContext;
// --> here, I'd like to write await context.AuthenticateAsync()
var authResult = context.AuthenticateAsync().Result;
if (!authResult.Succeeded)
return false;
var claimsPrincipal = authResult.Principal;
return claimsPrincipal.IsInRole("ProfilerContributor");
};
})
Do you think you could add an async version Func<HttpRequest, Task<bool>>? Or is there a better way to authenticate a user first?
To properly check who can access the profiler results, I first need to authenticate the user, but the authentication API is async. That means I have to block the call in
ResultsAuthorize, for example:Do you think you could add an async version
Func<HttpRequest, Task<bool>>? Or is there a better way to authenticate a user first?