/// <summary>
 /// Checks basic authentication request
 /// </summary>
 /// <param name="filterContext"></param>
 /// <exception cref="SecurityException">The caller does not have the permission required to set the principal. </exception>
 public override void OnAuthorization(HttpActionContext filterContext)
 {
     if (!_isActive) return;
     var identity = filterContext.GetIdentity();
     if (identity == null)
     {
         ChallengeAuthRequest(filterContext);
         return;
     }
     var genericPrincipal = new GenericPrincipal(identity, null);
     Thread.CurrentPrincipal = genericPrincipal;
     filterContext.RequestContext.Principal = genericPrincipal;
     if (!OnAuthorizeUser(identity.Name, identity.Password, filterContext))
     {
         ChallengeAuthRequest(filterContext);
         return;
     }
     base.OnAuthorization(filterContext);
 }