Is there a way to \"bypass\" authorization in asp.net core? I noticed that the Authorize attribute no longer has a AuthorizeCore method with which you could use to make dec
You can define your own handler that disables authorization:
public class DisableAuthorizationHandler : AuthorizationHandler
where TRequirement : IAuthorizationRequirement
{
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, TRequirement requirement)
{
context.Succeed(requirement);
return Task.CompletedTask;
}
}
and then register it:
public void ConfigureServices(IServiceCollection services)
{
//...
#if DEBUG
services.AddTransient>();
#endif
//...
}