title: Web Api Interceptor
body: <p>I have created a custom authorize attribute on my web api. My goal is to check if the user has permission to access the web api url  directly else redirect him to an unauthorized page.This process requires me to add [CustomAuthorize("modulename")] everywhere.Is there any other way I can do this? Probably by interceptors?.Any guidance would be greatly appreciated.</p>
  
  <pre><code>         Customised authorize attribute pseudo code snippet: 
  
          public override void OnAuthorization(HttpActionContext context){
                  var username = HttpContext.Current.Request.LogonUserIdentity.Name;
                   var  accesiblemodulelistforuser = GetPermissions(username );
  
                  if (user != null)
              {
                  if (modulename does not exist in list )
                  {
                  var response = 
                  context.Request.CreateResponse(HttpStatusCode.Forbidden);
                      context.Response = response;
  
                  }
             else{
            return;
  
                  }
  
                    }
                else{
                          //redirect to unauthorized page
                    }
                }
  </code></pre>