AllowAnonymous not working with Custom AuthorizationAttribute

后端 未结 8 656
一整个雨季
一整个雨季 2020-12-03 06:34

This has had me stumped for a while. None of the commonly encountered similar situations seem to apply here apparently. I\'ve probably missed something obvious but I can\'

8条回答
  •  没有蜡笔的小新
    2020-12-03 06:51

    In my case, none of the above solutions worked. I am using .Net Core 3.1 with a custom IAuthorizationFilter and I had to do the following:

    public void OnAuthorization(AuthorizationFilterContext context)
        {
            if (context.ActionDescriptor.EndpointMetadata.OfType().Any()) return;
    

提交回复
热议问题