public LoginResponse Login(LoginRequest loginRequest) { Log(Logger.LogMessageType.Info, "-> -------------------- Comienza la ejecución del método Registration.Login", Logger.LoggingLevelType.Medium); Log(Logger.LogMessageType.Info, String.Format("Llamando a Registration.Login con los parametros: User={0}, Password={1}, DeviceType={2}", loginRequest.Request.AccessId, loginRequest.Request.Password, loginRequest.Request.AccessType), Logger.LoggingLevelType.Low); return(AuthenticationProvider.Login(loginRequest)); //Log(Logger.LogMessageType.Info, "-> -------------------- Termina la ejecución del método Sales.Login", Logger.LoggingLevelType.Medium); }
public ActionResult Login(LoginViewModel model) { var authprovider = new AuthenticationProvider(); if (authprovider.Login(model.UserName, model.Password)) { return(RedirectToAction("Index", "Home")); } else { return(View()); } }
public ActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { var msgErr = string.Empty; if (!AuthenticationProvider.Login(model, out msgErr)) { TempData["MsgErr"] = msgErr; return(View(model)); } return(Redirect("#Empresa")); } return(View(model)); }
public LoginResponse Login(LoginRequest loginRequest) { Log(Logger.LogMessageType.Info, "-> -------------------- Comienza la ejecución del método MoviPin.Login", Logger.LoggingLevelType.Medium); LoginResponse response = null; try { Log(Logger.LogMessageType.Info, String.Format("Llamando a IMoviPin.Login con los parametros: User={0}, Password={1}, DeviceType={2}", loginRequest.Request.AccessId, loginRequest.Request.Password, loginRequest.Request.AccessType), Logger.LoggingLevelType.Low); response = AuthenticationProvider.Login(loginRequest); Log(Logger.LogMessageType.Info, String.Format("Parametros de respuesta de IMoviPin.Login: LoginResult={0}, Message={1} ", response.Response.LoginResult, response.Response.Message), Logger.LoggingLevelType.Low); } catch (Exception e) { Log(Logger.LogMessageType.Error, "Excepcion en el metodo IMoviPin.Login: "******"-> -------------------- Termina la ejecución del método MoviPin.Login", Logger.LoggingLevelType.Medium); return(response); }
public void Login_NotLoggedInUser_ShouldNotTrackLoginEvents(FakeMembershipUser user, [Frozen] IAccountTrackerService accountTrackerService, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any <string>(), Arg.Any <bool>()).Returns(false); var context = new FakeSiteContext(new StringDictionary { { "domain", "somedomain" } }); using (new Switcher <Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { repo.Login("John", "somepassword"); accountTrackerService.DidNotReceive().TrackLogin(Arg.Any <string>()); } } }
public void Login_UserIsNotLoggedIn_ShouldReturnFalse(FakeMembershipUser user, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any <string>(), Arg.Any <bool>()).Returns(false); var context = new FakeSiteContext(new StringDictionary { { "domain", "somedomain" } }); using (new Switcher <Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { var loginResult = repo.Login("John", "somepassword"); loginResult.Should().BeNull(); } } }
public void User_is_fetched_when_user_is_authenticated() { // arrange new AuthenticationInstaller().Install(); var authentication = TinyIoCContainer.Current.Resolve <IAuthentication>(); var repo = new Mock <IRepository <User> >(); repo.Setup(x => x.Get("foo")).Returns(new User()); var authenticationProvider = new AuthenticationProvider(authentication, repo.Object); // act authenticationProvider.Login("foo", "bar"); // assert repo.Verify(x => x.Get("foo"), Times.Once); }
public void LoginShouldTriggerLoginEventIfUserIsLoggedIn(FakeMembershipUser user, [Frozen]IAccountTrackerService accountTrackerService, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(true); var context = new FakeSiteContext(new StringDictionary { { "domain", "somedomain" } }); using (new Switcher<Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { var loginResult = repo.Login("John", "somepassword"); accountTrackerService.Received(1).TrackLogin(); } } }
public void LoginShouldReturnTrueIfUserIsLoggedIn(FakeMembershipUser user, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(true); var context = new FakeSiteContext(new StringDictionary { { "domain", "somedomain" } }); using (new Switcher<Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { var loginResult = repo.Login("John", "somepassword"); loginResult.Should().BeTrue(); } } }
public void Login_NotLoggedInUser_ShouldNotTrackLoginEvents(FakeMembershipUser user, [Frozen] IAccountTrackerService accountTrackerService, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(false); var context = new FakeSiteContext(new StringDictionary { {"domain", "somedomain"} }); using (new Switcher<Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { repo.Login("John", "somepassword"); accountTrackerService.DidNotReceive().TrackLogin(Arg.Any<string>()); } } }