protected override bool IsAuthorized(HttpActionContext actionContext) { var req = actionContext.Request; var auth = req.Headers.Authorization; if (auth != null) { if (auth.Scheme == "Basic" && !string.IsNullOrEmpty(auth.Parameter)) { string userName; string password; var gotIt = GetUserNameAndPassword(actionContext, out userName, out password); if (gotIt) { var alloTabibUserServices = (IAlloTabibUserAppServices) GlobalConfiguration.Configuration.DependencyResolver.GetService( typeof(IAlloTabibUserAppServices)); if (alloTabibUserServices != null) { UnityConfig.OnExecuting(); var isAuthenticated = alloTabibUserServices.IsPraticienAuthenticated(userName, password); UnityConfig.OnExecuted(); return(isAuthenticated); } } return(false); } } return(false); }