我已经下码绕过增加认证在地方发展,我是使用广告.净的核心。
#if !DEBUG
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(Configuration.GetSection("AzureAd"));
#endif
然而,因为我有我的控制器的保护授权的属性,我怎么绕过授权的属性内部控制器在地方发展:
[Authorize(Roles = "Buyer")]
public class ProductController : ApiBaseController
{
}
中。净框架,我有如下代码复盖的授权属性:
public class MyAuthorizeAttribute : AuthorizeAttribute
{
#if DEBUG
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
return true;
}
#endif
}
什么是等效的代码。净核心? 或是有任何其他方式,我们可以复盖授权的属性在启动。cs类?