private ActionResult Authenticate(IAuthenticationClient client) { try { var auth = client.VerifyAuthentication(HttpContext); if (auth.IsSuccessful) { FormsAuthentication.SetAuthCookie(auth.UserName, false); } return RedirectToAction("Index", "Home"); } catch (InvalidOperationException) { // If the verification failed we have to redirect client.RequestAuthentication(HttpContext, Request.Url); return null; } }