Skip to content

MiniProfileOptions.ResultsAuthorize cannot execute async code #417

@ChristopherHaws

Description

@ChristopherHaws

This is related to #354, however I am not able to use synchronous code here without duplicating the logic for the authorization. Specifically we are using policy based authorization using IAuthorizationService which only provides an async method. We are having to force the execution to be synchronous (which is working fine because behind the scenes there really isnt anything that requires the call to be async).

services
    .AddMiniProfiler(x =>
    {
        x.ResultsAuthorize = request => request.HttpContext.RequestServices.GetRequiredService<IAuthorizationService>().AuthorizeAsync(request.HttpContext.User, "CanProfile").Result.Succeeded;
    });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions