/// <summary> /// 跳过授权验证 /// </summary> /// <param name="actionContext"></param> /// <returns></returns> private bool SkipValidateAuthorize(HttpActionContext actionContext) { string ip = Utils.GetClientIp(); return(actionContext.ActionDescriptor.GetCustomAttributes <IgnoreAuthorizeAttribute>().Any() || actionContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes <IgnoreAuthorizeAttribute>().Any() || WhiteListHelper.IsWhiteIp(ip)); }
/// <summary> /// 验证内部接口访问权限 /// </summary> /// <param name="actionContext"></param> /// <returns></returns> private bool ValidateInnerService(HttpActionContext actionContext) { string ip = Utils.GetClientIp(); if (actionContext.ActionDescriptor.GetCustomAttributes <InnerServiceAttribute>().Any() || actionContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes <InnerServiceAttribute>().Any()) { return(WhiteListHelper.IsWhiteIp(ip)); } return(false); }