Web API custom authentication filter
<p>I am trying to make a custom filter for my web api controllers part of a ASP.NET MVC 5 website/application to check the requests headers for a specific token which i have stored in the database. Most examples I found were containing user credentials and then the user was authenticated using identity. Not exactly what I am looking for. </p>

<p>This is the <a href="http://www.codeproject.com/Articles/1005485/RESTful-Day-sharp-Security-in-Web-APIs-Basic" rel="noreferrer">tutorial</a> I found and am currently following.</p>

<p>The web API should only handle "external" HTTP calls, the website side will have its own controllers presently (but may be subject to change).</p>

<p>This filter should interface with identity 2 system already present if possible.</p>

<p>What I do is that I send user credentials then, assign a token to the user and then I want to use that token to authenticate the request. Is there a way I can just filter the request based on the token or do I need to use Owin identity and their token management. I am using a mobile client (currently iOS, will include android too) to make the calls. Any example or tutorial I could refer to ?</p>

<p>The token is currently a random combination of alphanumeric characters and symbols.</p>

<p>Thank you.</p>

<p>P.S. I can post code snippets and stuff where needed.</p>

<p>Edit: The HTTPRequests will be filtered based on whether they contain a token present within our database/system. Requests that do contain a token or are not present within our system will receive unauthorised error (401?)</p>