public static void AuthenticateIfBasicAuth(IRequest req, IResponse res) { //Need to run SessionFeature filter since its not executed before this attribute (Priority -100) SessionFeature.AddSessionIdToRequestFilter(req, res, null); //Required to get req.GetSessionId() var userPass = req.GetBasicAuthUserAndPassword(); if (userPass != null) { AuthenticateService authService = req.TryResolve <AuthenticateService>(); //authService.Request = new HttpRequestContext(req, res, null); //var response = authService.Post(new Authenticate authService.Post(new Authenticate { provider = "credentials", UserName = userPass.Value.Key, Password = userPass.Value.Value }); } }