public override void Validate(string username, string password)
 {
     if (!AuthWorker.IsValidCredentials(username, password))
     {
         throw new AuthenticationException($"Invalid login details provided. Username [{username}]");
     }
 }
        public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            if (actionContext.Request.Headers.Authorization == null)
            {
                actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
            }
            else
            {
                var authenticationString = actionContext.Request.Headers.Authorization.Parameter;
                var originalString       = Encoding.UTF8.GetString(Convert.FromBase64String(authenticationString));

                var username = originalString.Split(':')[0];
                var password = originalString.Split(':')[1];

                if (!AuthWorker.IsValidCredentials(username, password))
                {
                    actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
                }
            }

            base.OnAuthorization(actionContext);
        }