Handle(LoginSubmit command, TypedMessageResponse <string> response) { //var authenticated = _userCredentialRepository.Authenticate(command.UserName, command.Password); //if (authenticated) if (command.UserName.Equals("admin", StringComparison.OrdinalIgnoreCase) && command.Password.Equals("admin")) { var factory = new CorePrincipalFactory(); var principal = factory.CreatePrincipal(command.UserName); CorePrincipal.CurrentPrincipal = principal; new CoreFormsAuthentication().SetCookieFromPrincipal(principal); response.Data = "Thanks for logging in " + command.UserName; } else { string message = "Invalid username or password"; var loginFailedEvent = new LoginFailed { OccurredAt = DateTime.Now, PasswordSupplied = command.Password, UserNameSupplied = command.UserName, ResponseText = message }; EventAggregator.Instance.Publish <LoginFailed>(loginFailedEvent); response.Data = message; } return(response); }
public TypedMessageResponse <string> Handle(UserProfileEdit message) { var response = new TypedMessageResponse <string>(); if (CorePrincipal.CurrentPrincipal.Identity.Name.Equals(message.UserName, StringComparison.OrdinalIgnoreCase)) { response.Data = "Welcome " + CorePrincipal.CurrentPrincipal.Identity.Name; } else { response.Data = "You are not authorized for this action"; } return(response); }
Handle(LoginSubmit command, TypedMessageResponse <string> response) { //var authenticated = _userCredentialRepository.Authenticate(command.UserName, command.Password); //if (authenticated) if (command.UserName.Equals("admin", StringComparison.OrdinalIgnoreCase) && command.Password.Equals("lockheed101#")) { var factory = new FieldReportingPrincipalFactory(); var principal = factory.CreatePrincipal(command.UserName); FieldReportingPrincipal.CurrentPrincipal = principal; new FieldReportingFormsAuthentication().SetCookieFromPrincipal(principal); response.Data = "Thanks for logging in " + command.UserName; } else { response.Data = "Invalid username or password"; } return(response); }
HandleCommand(LoginSubmit command, TypedMessageResponse <string> response) { response.Data = "Hello there " + command.UserName; return(response); }