title: How do I override OnAuthorization in net core web api?
body: <p>Earlier I achieved something like this in asp.net</p>
  
  <pre><code>public class Authentication : AuthorizationFilterAttribute
  {
      public override void OnAuthorization(HttpActionContext actionContext)
      {
          if (actionContext.Request.Headers.Authorization == null)
          {
              actionContext.Response = actionContext.Request
                  .CreateResponse(HttpStatusCode.Unauthorized);
          } else
          {
              var authenticationToken = actionContext.Request.Headers
                  .Authorization.Parameter;
              var decodedAuthenticationToken = Encoding.UTF8.GetString(
                  Convert.FromBase64String(authenticationToken));
              var usernamePasswordArray = decodedAuthenticationToken.Split(':');
              var username = usernamePasswordArray[0];
              var password = usernamePasswordArray[1];
  
              if (GetUsers.GetDatabaseUsers.CheckCredentials(username, password))
              {// logic}
  </code></pre>
  
  <p>Now this doesn't seem to work in net core, the goal is to read the Authorization header and de-serialize it so i can pass it to my database logic that goes something like this</p>
  
  <pre><code>public static bool CheckCredentials(string username, string password)
          {
              try
              {
                  var databaseConnection = new MySqlConnection(ConnectionString);
                  var queryCommand =
                      new MySqlCommand(
                          "SELECT COUNT(*) FROM users WHERE username LIKE @username AND password LIKE @password",
                          databaseConnection);// more code
  </code></pre>
  
  <p>Then in my ValuesController i had something as such</p>
  
  <pre><code>[Authentication]
   public HttpResponseMessage Get()
      {
  
          var returnData = string.Format("database model logic{0}",mydatabasehandler.sologic,
          return Request.CreateResponse(HttpStatusCode.OK, returnData);
      }
  </code></pre>
  
  <p>Now this code might be ugly but I hope it makes sense enough for readers to understand what I want to achieve.</p>
  
  <p>The base idea for this is that it will be an API for my desktop app to communicate with a MySql database only. Let me know if I should clarify something!</p>
  
  <p>Extra question, i can't seem to make IntelliSense work at all when using netcore is there a way to enable this or is it lacking because it's beta?</p>