public void ValidateUser_ValidParams_ReturnsResponse() { var test = orchestrator.ValidateUser(validValidateUserRequest).Result; Assert.IsNotNull(test); Assert.IsInstanceOf <ValidateUserResponse>(test); Assert.True(test.LoginSuccess); }
public void ValidateUser_InvalidRequest_ReturnsError() { var task = orchestrator.ValidateUser(invalidLoginViewModel); task.Wait(); var test = task.Result; Assert.IsNotNull(test); Assert.IsInstanceOf <OrchestratorResponseWrapper <ClaimsIdentity> >(test); Assert.AreEqual(1, test.Errors.Count); Assert.AreEqual(0, test.Warnings.Count); Assert.IsFalse(test.Success); Assert.IsNull(test.Model); }
public async Task <ActionResult> Login(LoginViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var loginResponse = await orchestrator.ValidateUser(model); if (!loginResponse.Success) { AddModelErrors(loginResponse.Errors); return(View(model)); } var authManager = GetAuthenticationManager(); authManager.SignIn(loginResponse.Model); authManager.SignOut("ApplicationCookie"); authManager.SignIn(loginResponse.Model); if (string.IsNullOrEmpty(model.ReturnUrl)) { return(RedirectToAction("BudgetOverview", "Budget", new { area = "Dashboard" })); } return(Redirect(model.ReturnUrl)); }
public async Task <IHttpActionResult> ValidateUser([FromBody] ValidateUserRequest request) { var response = await orchestrator.ValidateUser(request); return(Ok(response)); }