title: Is there a way to secure static files using owin?
body: <p>I have a problem after implementing Owin and secured all controllers and webapi of a asp.net mvc site, using cookie and bearer token. All static files like javascripts , images and some html files are unsecured and can be downloaded without authorization.</p>
  
  <p>So far I have tried to implement, staticfiles (using Microsoft.Owin.StaticFiles) and setting static files for a request path but without any sucess. For example this?</p>
  
  <pre><code>app.UseStaticFiles("/Scripts");
  </code></pre>
  
  <p>And I have tried , using web.config settings like this wich is mentiond in katana documentation, but from this point to lets say roleX should have access to imagesX and roleY to imageY ? nothing is mention in the documentation about that or even how to control the files.</p>
  
  <pre><code>&lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>So question is how do i secure static files using owin and authorization cookie.
  Do i have to write a own middle ware , checking each request if it is a static file, or is there any recomended package on nuget that solves this?</p>