有没有办法在asp.net核心中"绕过"授权?我注意到Authorize属性不再具有AuthorizeCore方法,您可以使用该方法来决定是否继续使用auth.
Pre .net核心你可以这样做:
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
// no auth in debug mode please
#if DEBUG
return true;
#endif
return base.AuthorizeCore(httpContext);
}
Run Code Online (Sandbox Code Playgroud)
我希望我不会错过任何明显的显而易见的东西,但如果需要的话,能够在DEBUG中跳过auth工作流程会更好.我只是无法找到.net核心