更新时间:2023-02-14 15:30:24
对于将您自己的授权逻辑与 IAuthorizationFilter
一起使用,您不应与 AuthorizeAttribute
一起使用,它会检查使用默认身份验证架构进行身份验证.
For using your own authorize logic with IAuthorizationFilter
, you should not use with AuthorizeAttribute
which will check the Authentication with default authentication schema.
尝试将 AuthorizeAttribute
更改为 Attribute
.
[AttributeUsage(AttributeTargets.Class)]
public class KeyAuthorizeAttribute : Attribute, IAuthorizationFilter
{