Bypass Authorize Attribute in .Net Core for Release Version

前端 未结 6 1949
梦如初夏
梦如初夏 2020-12-07 02:20

Is there a way to \"bypass\" authorization in asp.net core? I noticed that the Authorize attribute no longer has a AuthorizeCore method with which you could use to make dec

6条回答
  •  自闭症患者
    2020-12-07 02:32

    Just add an anonymous filter could do the trick, simple and easy.

       services.AddMvc(opts =>
       {
          opts.Filters.Add(new AllowAnonymousFilter());
       });
    

    Ref: https://www.illucit.com/asp-net/asp-net-core-2-0-disable-authentication-development-environment/

提交回复
热议问题