1 public class APIAuthFilter : Attribute, IAuthorizationFilter 2 { 3 private const string secretKey = ""; 8 public void OnAuthorization(AuthorizationFilterContext filterContext) 9 { 10 var controller = filterContext.RouteData.Values["controller"].ToString(); 11 var action = filterContext.RouteData.Values["action"].ToString(); 12 var authorzation = filterContext.HttpContext.Request.Headers["Authorization"].ToString(); 23 }
感谢:
https://blog.csdn.net/love_shang/article/details/108073917