public ActionResult Manage() { string EmailId = HttpContext.Request.Cookies["EmailId"] ?? ckUserEmailId; ManageViewModel manageViewModel = new ManageViewModel(); LoginProviders objLoginProvider = new LoginProviders(_configuration); UserDetailsRequest objUserDetailsRequest = new UserDetailsRequest(); objUserDetailsRequest.UserName = EmailId; UserDetailsResponse objUserDetailsResponse = objLoginProvider.GetUserDetails(objUserDetailsRequest, token).Result; ContactDetailsRequest req1 = new ContactDetailsRequest() { Email = EmailId, Users = new mUsers { VoyagerUser_Id = ckLoginUser_Id } }; ContactDetailsResponse res1 = objLoginProvider.GetContactDetails(req1, token).Result; manageViewModel.Telephone = res1.Contacts.TEL; manageViewModel.MobileNumber = res1.Contacts.MOBILE; manageViewModel.FaxNumber = res1.Contacts.FAX; manageViewModel.WebSite = res1.Contacts.WEB; manageViewModel.VoyagerUser_Id = objUserDetailsResponse.VoyagerUser_Id; //manageViewModel.PhotoPath = _configuration.GetValue<string>("SystemSettings:CountryImageInitial") + objUserDetailsResponse.Photo; manageViewModel.PhotoPath = _configuration.GetValue <string>("UIBaseUrl") + objUserDetailsResponse.Photo; return(View(manageViewModel)); }
private async Task DoAuthentication(LoginProviders provider) { var identity = await App.Authenticator.Authenticate(provider); Csla.ApplicationContext.User = new Models.AppPrincipal(identity); if (Csla.ApplicationContext.User.Identity.IsAuthenticated) await App.RootPage.Navigation.PopModalAsync(); }
public bool Authenticate(User user) { loginProvider = LoginProviders.Google; GetConnectionString(); Console.WriteLine(" Assuming it passed Google's auth API."); return(true); }
public AccountController(IHostingEnvironment env, IConfiguration configuration) : base(env, configuration) { _env = env; _configuration = configuration; loginProviders = new LoginProviders(_configuration); cOCommonLibrary = new COCommonLibrary(configuration); agentProviders = new AgentProviders(_configuration); operationsProviders = new OperationsProviders(_configuration); }
private async Task DoAuthentication(LoginProviders provider) { var identity = await App.Authenticator.Authenticate(provider); Csla.ApplicationContext.User = new Models.AppPrincipal(identity); if (Csla.ApplicationContext.User.Identity.IsAuthenticated) { await App.RootPage.Navigation.PopModalAsync(); } }
public UserAndRoleMgmtController(IHostingEnvironment env, IConfiguration configuration) : base(env, configuration) { _env = env; _configuration = configuration; loginProviders = new LoginProviders(_configuration); agentProviders = new AgentProviders(_configuration); userAndRoleMgmtProviders = new UserAndRoleMgmtProviders(_configuration); objSalesProvider = new SalesProviders(_configuration); objMISProviders = new MISProviders(_configuration); }
public virtual void AddLogin(UserLoginInfo loginInfo) { if (loginInfo == null) { throw new ArgumentNullException(nameof(loginInfo)); } LoginProviders.Add(loginInfo.LoginProvider); LoginProviderKeys.Add(loginInfo.ProviderKey); LoginProviderDisplayNames.Add(loginInfo.ProviderDisplayName ?? loginInfo.LoginProvider); }
public ProposalController(IConfiguration configuration) : base(configuration) { _configuration = configuration; cOCommonLibrary = new COCommonLibrary(configuration); coProviders = new COProviders(_configuration); positionProviders = new PositionProviders(_configuration); itineraryMapper = new ItineraryMapper(_configuration); loginProviders = new LoginProviders(_configuration); agentProviders = new AgentProviders(_configuration); objSalesProvider = new SalesProviders(_configuration); operationsProviders = new OperationsProviders(_configuration); }
public virtual void RemoveLogin(UserLoginInfo loginInfo) { if (loginInfo == null) { throw new ArgumentNullException(nameof(loginInfo)); } var providerIndex = LoginProviders.IndexOf(loginInfo.LoginProvider); LoginProviders.Remove(loginInfo.LoginProvider); LoginProviderKeys.RemoveAt(providerIndex); LoginProviderDisplayNames.RemoveAt(providerIndex); }
void Start() { Dispatcher = GetComponent <UnityMainThreadDispatcher>(); Logger = new UnityAADLogger(this); _scrollRect = ScrollView.GetComponent <ScrollRect>(); if (AppSettings) { Settings = (AccountSettings)JsonUtility.FromJson(AppSettings.text, typeof(AccountSettings)); } else { Logger.Log("Error: no app settings file - please create an app-settings.json file in your assets folder!"); } LoginProviders.RegisterProviders(Logger, UserStore, Settings.ClientId, Settings.Authority, Settings.TenantId); }
public async Task <AppIdentity> Authenticate(LoginProviders provider) { Models.AppIdentity result = null; try { #if DEBUG if (provider == MobileKidsIdApp.Services.LoginProviders.Test) { result = await Models.AppIdentity.GetAppIdentityAsync("test:1", "blahblahblah"); return(result); } #endif var client = new MobileServiceClient("https://mobilekidsidapp.azurewebsites.net"); MobileServiceUser authnResult = null; switch (provider) { case MobileKidsIdApp.Services.LoginProviders.Google: authnResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Google); break; case MobileKidsIdApp.Services.LoginProviders.Microsoft: authnResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.MicrosoftAccount); break; case MobileKidsIdApp.Services.LoginProviders.Facebook: authnResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Facebook); break; default: throw new ArgumentException("LoginProvider"); } result = await Models.AppIdentity.GetAppIdentityAsync(authnResult.UserId, authnResult.MobileServiceAuthenticationToken); } catch { result = new Models.AppIdentity(); } return(result); }
public async Task <AppIdentity> Authenticate(LoginProviders provider) { Models.AppIdentity result = null; try { #if DEBUG if (provider == MobileKidsIdApp.Services.LoginProviders.Test) { result = await Models.AppIdentity.GetAppIdentityAsync("test:1", "blahblahblah"); return(result); } #endif //TODO: switch to latest authentication model //var client = new MobileServiceClient("https://mobilekidsidapp.azurewebsites.net"); //MobileServiceUser authnResult = null; //switch (provider) //{ // case MobileKidsIdApp.Services.LoginProviders.Google: // authnResult = await client.LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController, MobileServiceAuthenticationProvider.Google); // break; // case MobileKidsIdApp.Services.LoginProviders.Microsoft: // authnResult = await client.LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController, MobileServiceAuthenticationProvider.MicrosoftAccount); // break; // case MobileKidsIdApp.Services.LoginProviders.Facebook: // authnResult = await client.LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController, MobileServiceAuthenticationProvider.Facebook); // break; // default: // throw new ArgumentException("LoginProvider"); //} //result = await Models.AppIdentity.GetAppIdentityAsync(authnResult.UserId, authnResult.MobileServiceAuthenticationToken); } catch { result = new Models.AppIdentity(); } return(result); }
public JsonResult ForgetPassword(LoginViewModel model) { try { LoginRequest objLoginRequest = new LoginRequest(); objLoginRequest.UserName = model.Email; LoginProviders objLoginProvider = new LoginProviders(_configuration); bool tskCheckUser = objLoginProvider.UserPasswordRecover(objLoginRequest).Result; if (tskCheckUser) { return(Json(new { msg = "Password changed." })); } else { return(Json(new { msg = "Invalid" })); } } catch (Exception ex) { throw ex; } }
public async Task<AppIdentity> Authenticate(LoginProviders provider) { Models.AppIdentity result = null; try { #if DEBUG if (provider == MobileKidsIdApp.Services.LoginProviders.Test) { result = await Models.AppIdentity.GetAppIdentityAsync("test:1", "blahblahblah"); return result; } #endif var client = new MobileServiceClient("https://mobilekidsidapp.azurewebsites.net"); MobileServiceUser authnResult = null; switch (provider) { case MobileKidsIdApp.Services.LoginProviders.Google: authnResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Google); break; case MobileKidsIdApp.Services.LoginProviders.Microsoft: authnResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.MicrosoftAccount); break; case MobileKidsIdApp.Services.LoginProviders.Facebook: authnResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Facebook); break; default: throw new ArgumentException("LoginProvider"); } result = await Models.AppIdentity.GetAppIdentityAsync(authnResult.UserId, authnResult.MobileServiceAuthenticationToken); } catch { result = new Models.AppIdentity(); } return result; }
//ServiceProxy serviceProxy; #endregion public AgentController(IConfiguration configuration) { _configuration = configuration; loginProviders = new LoginProviders(_configuration); agentProviders = new AgentProviders(_configuration); }
public ActionResult Manage(ManageViewModel manageViewModel, string command, IFormFile file) { string rootPath = _configuration.GetValue <string>("SystemSettings:UserImagePath"); //string pathIntial = _configuration.GetValue<string>("SystemSettings:CountryImageInitial"); string pathIntial = _configuration.GetValue <string>("UIBaseUrl"); string imgDbPath = _configuration.GetValue <string>("SystemSettings:UserImageDbPath"); //string rootPath = _configuration.GetValue<string>("UserImagePath"); //string destPath = _env.WebRootPath + @"\resources\DeleteImages"; ManageViewModel manageViewModel1 = manageViewModel; string EmailId = HttpContext.Request.Cookies["EmailId"] ?? ckUserEmailId; LoginProviders objLoginProvider = new LoginProviders(_configuration); string SuccessMessage = ""; string ErrorMessage = ""; switch (command.ToLower()) { case "update": ContactDetailsRequest req1 = new ContactDetailsRequest() { Email = EmailId, FAX = manageViewModel.FaxNumber, TEL = manageViewModel.Telephone, MOBILE = manageViewModel.MobileNumber, //WEB = manageViewModel.WebSite, Users = new mUsers { Password = manageViewModel.Password, VoyagerUser_Id = manageViewModel.VoyagerUser_Id } }; ContactDetailsResponse res1 = objLoginProvider.UpdateContactDetails(req1, token).Result; ContactDetailsResponse res2 = null; ResponseStatus resultusepwd = new ResponseStatus(); if (manageViewModel.IsPasswordEnabled) { req1.IsUpdateCompany = true; res2 = objLoginProvider.UpdateUserPassword(req1, token).Result; if (res2 != null && res2.Status == "Sucess" && res2.Contacts != null && !string.IsNullOrEmpty(res2.Contacts.VoyagerContact_Id)) { // Call Bridge service to update User Password in SQL database UserRolesSetReq userreq = new UserRolesSetReq(); userreq.Contact_Id = res2.Contacts.VoyagerContact_Id; resultusepwd = agentProviders.SetUserPassword(userreq, token).Result; } else { res2 = res2 ?? new ContactDetailsResponse(); res2.Status = "Error"; } } if (res1 != null) { manageViewModel1.MobileNumber = res1.Contacts.MOBILE; manageViewModel1.Telephone = res1.Contacts.TEL; manageViewModel1.WebSite = res1.Contacts.WEB; manageViewModel1.FaxNumber = res1.Contacts.FAX; } if (res2 != null && res1 != null) { if (res2.Status == "Sucess" && res1.Status == "Sucess" && resultusepwd.Status.ToLower() != "success") { SuccessMessage = "Data updated successfully."; } else { if (resultusepwd != null && !string.IsNullOrEmpty(resultusepwd.Status) && resultusepwd.Status.ToLower() != "success") { ErrorMessage = resultusepwd.Status; } else if (res2.Status != "Sucess") { ErrorMessage = res2.Status; } else if (res1.Status != "Sucess") { ErrorMessage = res2.Status; } } } else if (res1 != null) { if (res1.Status == "Sucess") { SuccessMessage = "Data updated successfully."; } else if (res1.Status != "Sucess") { ErrorMessage = res1.Status; } } break; case "upload": if (file != null) { string _FileName = Path.GetFileName(file.FileName); string oldFilePath = Request.Cookies["Photo"]; string oldfileName = Path.GetFileName(oldFilePath); string oldFilePathURL = Path.Combine(rootPath, oldfileName); string extension = Path.GetExtension(file.FileName); //Guid g = Guid.NewGuid(); string _path = Path.Combine(rootPath, manageViewModel.VoyagerUser_Id + extension); //var savePath = "~/resources/UserImages/" + manageViewModel.VoyagerUser_Id + extension; var savePath = imgDbPath + manageViewModel.VoyagerUser_Id + extension; using (var fileStream = new FileStream(_path, FileMode.OpenOrCreate)) { manageViewModel1.PhotoPath = _path; file.CopyTo(fileStream); fileStream.Flush(); fileStream.Close(); } ContactDetailsRequest request = new ContactDetailsRequest() { //WEB = manageViewModel.WebSite, Users = new mUsers { Photo = savePath, VoyagerUser_Id = manageViewModel.VoyagerUser_Id } }; string imgLocation = pathIntial + savePath; ContactDetailsResponse response = objLoginProvider.UpdateUserDetails(request, token).Result; Response.Cookies.Append("Photo", imgLocation); //if (System.IO.File.Exists(oldFilePathURL)) //{ // FileInfo fileInfo = new FileInfo(oldFilePathURL); // fileInfo.MoveTo(Path.Combine(destPath, oldfileName)); //} if (response.Status == "Sucess") { SuccessMessage = "Photo Uploaded Successfully."; } else { ErrorMessage = response.Status; } } break; case "cancel": break; default: break; } if (!(string.IsNullOrEmpty(SuccessMessage))) { TempData["success"] = SuccessMessage; } if (!(string.IsNullOrEmpty(ErrorMessage))) { TempData["error"] = ErrorMessage; } //return View(manageViewModel1); return(RedirectToAction("Manage")); }
public virtual IList <UserLoginInfo> GetLogins() { return (LoginProviders.Select((t, i) => new UserLoginInfo(t, LoginProviderKeys[i], LoginProviderDisplayNames[i])).ToList()); }
public QuoteController(IConfiguration configuration) { _configuration = configuration; loginProviders = new LoginProviders(configuration); quoteProviders = new QuoteProviders(configuration); }
public void SetCurrentLoginProvider(string id) { CurrentLoginProvider = LoginProviders.GetProvider(id); UpdateUI(); }