Group = group;public class AdminClaimRequirementHandler : AuthorizationHandler这就是我在控制器中的用法 [ApiController]public class MyController : ControllerBase
} 我关注了这个Unit test AuthorizationHandler此http://blog.sto
我希望在AuthorizationHandler中执行一些自定义逻辑,如果逻辑要求重定向用户,这些逻辑将最终重定向,如下所示。除了重定向之外,一切都会正确执行。new SomeRequirement()));SomeAuthorizationHandler.cs
public class SomeAuthorizationHandler : AuthorizationHandler
如果有人告诉他们用户名/电子邮件是正确的,他们知道它存储在数据库中,现在他们只需要知道密码。在AuthorizationHandler Core3.0之前重定向到.Net内部时,我可以使用:
if (context.Resource is AuthorizationFilterContext那么,我的问题是,可以从AuthorizationHandler重定向吗?还是完全删除?我可以使用的一个解决方案是通过HttpContext.Items中的HttpContextAccessor将一些数据存储在Authorization