protected async void OnInitializedAsync(object sender, EventArgs e) { Globals.AadInstance = GetConfigValue("b2c:AADInstance"); Globals.RedirectUri = GetConfigValue("b2c:RedirectUri"); Globals.Tenant = GetConfigValue("b2c:Tenant"); Globals.ClientId = GetConfigValue("b2c:ClientId"); Globals.SignInPolicy = GetConfigValue("b2c:SignInPolicy"); Globals.SignUpPolicy = GetConfigValue("b2c:SignUpPolicy"); Globals.SignUpOrSignInPolicy = GetConfigValue("b2c:SignUpOrSignInPolicy"); Globals.EditProfilePolicy = GetConfigValue("b2c:ProfilePolicy"); b2cUser = new B2CUser(); int result = await b2cUser.InitializeAsync(); if (b2cUser.IsSignedIn()) { SignInButton.Content = "Clear Cache"; UserName.Text = b2cUser.Username; UserId.Text = b2cUser.UserId; GetTodoList(true); } else { UserName.Text = "Sign In to get ToDo items"; UserId.Text = String.Empty; } }
public async Task SigningInShouldIdentifyMeAsAUserInThePlatformAsync() { testUser = new B2CUser("*****@*****.**", "carlosIsGreat123", "Carlos Quintero"); await testUser.RegisterAsync(); var loginPage = new LoginPage(webDriver); loginPage.Login(testUser); }
public async Task TheGalleryForANewUserMustShowAnEmptyMessage() { testUser = new B2CUser("*****@*****.**", "carlosIsGreat123", "Carlos Quintero"); await testUser.RegisterAsync(); var loginPage = new LoginPage(webDriver); loginPage.Login(testUser); webDriver.FindElement(By.LinkText("My files")).Click(); webDriver.FindElementByText("You have no files right now"); webDriver.FindElementByText("Get started with the upload button"); }
public void Login(B2CUser user) { if (user == null) { throw new ArgumentNullException(nameof(user)); } var emailInput = webDriver.FindElement(By.CssSelector("input#logonIdentifier")); var passwordInput = webDriver.FindElement(By.CssSelector("input#password")); var submitButton = webDriver.FindElement(By.CssSelector("button#next")); emailInput.SendKeys(user.EmailAddress); passwordInput.SendKeys(user.Password); submitButton.Click(); wait.Until(driver => driver.FindElement(By.LinkText("Hello " + user.Name + "!"))); }
public async Task UploadingAPhotoMustShowItInTheGallery() { testUser = new B2CUser("*****@*****.**", "carlosIsGreat123", "Carlos Quintero"); await testUser.RegisterAsync(); var loginPage = new LoginPage(webDriver); loginPage.Login(testUser); var sourceFile = Path.Combine("Assets", "EafitLogo.jpg"); var filePath = Path.GetFullPath(sourceFile); webDriver.FindElement(By.LinkText("My files")).Click(); webDriver.FindElement(By.Id("Upload File")).Click(); webDriver.FindElement(By.Id("upload-modal")); webDriver.FindElement(By.Id("title-input")).SendKeys("Universidad EAFIT"); webDriver.FindElement(By.Id("description-input")).SendKeys("Abierta al mundo"); webDriver.FindElement(By.Id("file-picker")).SendKeys(filePath); webDriver.FindElementByText("Upload File").Click(); webDriver.FindElement(By.Id("upload-progress")); var wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(5)); wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.Id("upload-modal"))); Check.That(webDriver.Title).IsEqualTo("Universidad EAFIT - UHost"); webDriver.FindElementByText("Universidad EAFIT"); webDriver.FindElementByText("Abierta al mundo"); webDriver.FindElement(By.LinkText("My files")).Click(); wait.Until(webDriver => webDriver.Title == "My files - UHost"); var emptyMessageExists = !ExpectedConditions.InvisibilityOfElementLocated(By.LinkText("You have no files right now")).Invoke(webDriver) || !ExpectedConditions.InvisibilityOfElementLocated(By.LinkText("Get started with the upload button")).Invoke(webDriver); Check.That(emptyMessageExists).IsFalse(); webDriver.FindElementByText("Universidad EAFIT"); webDriver.FindElementByText("Abierta al mundo"); }
public async Task <ResponseMessage <B2CUser> > AddNewUserAsync(B2CUser newUser) { var json = JsonConvert.SerializeObject(newUser, jsonSerializerSettings); var responseMessage = new ResponseMessage <B2CUser>(); try { var result = await b2cClient.AddNewUserAsync(json); responseMessage.Data = JsonConvert.DeserializeObject <B2CUser>(result); responseMessage.HttpStatusCode = HttpStatusCode.Created; } catch (HttpClientException hce) { responseMessage.HttpStatusCode = hce.StatusCode; responseMessage.ErrorMessage = hce.Message; } return(responseMessage); }
internal void SendNewUserEmail(B2CUser NewUser) { try { MailMessage m = new MailMessage(); SmtpClient sc = new SmtpClient(); m.From = new MailAddress("*****@*****.**", "Beam Suntory Connect"); m.To.Add(new MailAddress("*****@*****.**", "Someones Name")); m.Subject = "New User Pending Approval in Connect - " + NewUser.mail; m.Body = ""; m.IsBodyHtml = true; string html = ""; AlternateView av = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html); m.AlternateViews.Add(av); sc.Host = "smtp.beamsuntory.com"; sc.Port = 587; sc.Credentials = new System.Net.NetworkCredential("*****@*****.**", "password"); sc.EnableSsl = true; sc.Send(m); } catch (Exception) { /* expected until we get full email login details */ } }
internal Dictionary <string, string> GetUserDictionary(B2CUser User) { Dictionary <string, string> details = new Dictionary <string, string>(); details.Add("preferredName", User.displayName); details.Add("country", User.country); details.Add("state", User.state); details.Add("FirstName", firstNameTxt.Text); details.Add("LastName", lastNameTxt.Text); //#if DEV if (User.extension_a67c327875c34024bd4523a3d66619ba_Birthdate != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_Birthdate", User.extension_a67c327875c34024bd4523a3d66619ba_Birthdate); } if (User.extension_a67c327875c34024bd4523a3d66619ba_Email != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_Email", User.extension_a67c327875c34024bd4523a3d66619ba_Email); } if (User.extension_a67c327875c34024bd4523a3d66619ba_Employer != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_Employer", User.extension_a67c327875c34024bd4523a3d66619ba_Employer); } if (User.extension_a67c327875c34024bd4523a3d66619ba_TradeEmployer != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_TradeEmployer", User.extension_a67c327875c34024bd4523a3d66619ba_TradeEmployer); } if (User.extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsRoleID != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsRoleID", User.extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsRoleID); } if (User.extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsID != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsID", User.extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsID); } /*#endif #if PROD * if (User.extension_be6dc6c96b4c411780751b4231962926_Birthdate != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_Birthdate", User.extension_be6dc6c96b4c411780751b4231962926_Birthdate); * if (User.extension_be6dc6c96b4c411780751b4231962926_Email != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_Email", User.extension_be6dc6c96b4c411780751b4231962926_Email); * if (User.extension_be6dc6c96b4c411780751b4231962926_Employer != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_Employer", User.extension_be6dc6c96b4c411780751b4231962926_Employer); * if (User.extension_be6dc6c96b4c411780751b4231962926_TradeEmployer != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_TradeEmployer", User.extension_be6dc6c96b4c411780751b4231962926_TradeEmployer); * if (User.extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsRoleID != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsRoleID", User.extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsRoleID); * if (User.extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsID != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsID", User.extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsID); #endif*/ if (distributeChk.Checked) { //#if DEV if (User.extension_a67c327875c34024bd4523a3d66619ba_Region != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_Region", User.extension_a67c327875c34024bd4523a3d66619ba_Region); } if (!String.IsNullOrEmpty(beamSuntorySponsorTxt.Text)) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_BeamSuntorySponsor", beamSuntorySponsorTxt.Text); } if (User.extension_a67c327875c34024bd4523a3d66619ba_Area != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_Area", User.extension_a67c327875c34024bd4523a3d66619ba_Area); } if (User.extension_a67c327875c34024bd4523a3d66619ba_OnOffPremise != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_OnOffPremise", User.extension_a67c327875c34024bd4523a3d66619ba_OnOffPremise); } if (!String.IsNullOrEmpty(GetCommercialRegion())) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_CommercialRegion", GetCommercialRegion()); } if (User.extension_a67c327875c34024bd4523a3d66619ba_Division != null) { details.Add("extension_a67c327875c34024bd4523a3d66619ba_Division", User.extension_a67c327875c34024bd4523a3d66619ba_Division); } /*#endif #if PROD * if (User.extension_be6dc6c96b4c411780751b4231962926_Region != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_Region", User.extension_be6dc6c96b4c411780751b4231962926_Region); * if (!String.IsNullOrEmpty(beamSuntorySponsorTxt.Text)) * details.Add("extension_be6dc6c96b4c411780751b4231962926_BeamSuntorySponsor", beamSuntorySponsorTxt.Text); * if (User.extension_be6dc6c96b4c411780751b4231962926_Area != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_Area", User.extension_be6dc6c96b4c411780751b4231962926_Area); * if (User.extension_be6dc6c96b4c411780751b4231962926_OnOffPremise != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_OnOffPremise", User.extension_be6dc6c96b4c411780751b4231962926_OnOffPremise); * if (!String.IsNullOrEmpty(GetCommercialRegion())) * details.Add("extension_be6dc6c96b4c411780751b4231962926_CommercialRegion", GetCommercialRegion()); * if (User.extension_be6dc6c96b4c411780751b4231962926_Division != null) * details.Add("extension_be6dc6c96b4c411780751b4231962926_Division", User.extension_be6dc6c96b4c411780751b4231962926_Division); #endif*/ } return(details); }
/// <summary> /// Returns a blank instance of the B2CUser with any extension properties required added to the /// NonDeclaredProperties collection. /// </summary> /// <returns>An instance of B2CUser</returns> public B2CUser GetBlankNewB2CUser() { var newUser = new B2CUser(ExtensionProperties.Where(x => !x.Name.Contains("group")).ToList()); return(newUser); }
static void PrintUser(B2CUser User) { string output = "User Details for: " + User.displayName; output += "\nAccountEnabled: " + User.accountEnabled; output += "\nCity: " + User.city; output += "\ndisplayName: " + User.displayName; output += "\ncreationType: " + User.creationType; output += "\ndepartment: " + User.department; output += "\nobjectType: " + User.objectType; output += "\nobjectId: " + User.objectId; output += "\nuserPrincipalName: " + User.userPrincipalName; output += "\ncountry: " + User.country; output += "\nstate: " + User.state; if (User.deletionTimestamp.HasValue) { output += "\ndeletionTimestamp: " + User.deletionTimestamp.Value.ToLongDateString(); } output += "\ndirSyncEnabled: " + User.dirSyncEnabled; output += "\nimmutableId: " + User.immutableId; output += "\npreferredLanguage: " + User.preferredLanguage; output += "\nfacsimileTelephoneNumber: " + User.facsimileTelephoneNumber; output += "\ngivenName: " + User.givenName; output += "\njobTitle: " + User.jobTitle; output += "\nmailNickname: " + User.mailNickname; output += "\nmail: " + User.mail; output += "\nmobile: " + User.mobile; output += "\nPasswordPolicies: " + User.passwordPolicies; output += "\nphysicalDeliveryOfficeName: " + User.physicalDeliveryOfficeName; output += "\npostalCode: " + User.postalCode; output += "\nstreetAddress: " + User.streetAddress; output += "\nsurname: " + User.surname; output += "\ntelephoneNumber: " + User.telephoneNumber; output += "\nusageLocation: " + User.usageLocation; output += "\nuserType: " + User.userType; #if DEV output += "\next_Area: " + User.extension_a67c327875c34024bd4523a3d66619ba_Area; output += "\next_BeamSuntorySponsor: " + User.extension_a67c327875c34024bd4523a3d66619ba_BeamSuntorySponsor; output += "\next_Birthdate: " + User.extension_a67c327875c34024bd4523a3d66619ba_Birthdate; output += "\next_CommercialRegion: " + User.extension_a67c327875c34024bd4523a3d66619ba_CommercialRegion; output += "\next_ConnectToolboxURL: " + User.extension_a67c327875c34024bd4523a3d66619ba_ConnectToolboxURL; output += "\next_Email: " + User.extension_a67c327875c34024bd4523a3d66619ba_Email; output += "\next_Employer: " + User.extension_a67c327875c34024bd4523a3d66619ba_Employer; output += "\next_OnOffPremise: " + User.extension_a67c327875c34024bd4523a3d66619ba_OnOffPremise; output += "\next_Region: " + User.extension_a67c327875c34024bd4523a3d66619ba_Region; output += "\next_SuccessFactorsID: " + User.extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsID; output += "\next_SuccessFactorsRoleID: " + User.extension_a67c327875c34024bd4523a3d66619ba_SuccessFactorsRoleID; output += "\next_telephoneNumber: " + User.extension_a67c327875c34024bd4523a3d66619ba_telephoneNumber; #endif #if PROD output += "\next_Area: " + User.extension_be6dc6c96b4c411780751b4231962926_Area; output += "\next_BeamSuntorySponsor: " + User.extension_be6dc6c96b4c411780751b4231962926_BeamSuntorySponsor; output += "\next_Birthdate: " + User.extension_be6dc6c96b4c411780751b4231962926_Birthdate; output += "\next_CommercialRegion: " + User.extension_be6dc6c96b4c411780751b4231962926_CommercialRegion; output += "\next_ConnectToolboxURL: " + User.extension_be6dc6c96b4c411780751b4231962926_ConnectToolboxURL; output += "\next_Email: " + User.extension_be6dc6c96b4c411780751b4231962926_Email; output += "\next_Employer: " + User.extension_be6dc6c96b4c411780751b4231962926_Employer; output += "\next_OnOffPremise: " + User.extension_be6dc6c96b4c411780751b4231962926_OnOffPremise; output += "\next_Region: " + User.extension_be6dc6c96b4c411780751b4231962926_Region; output += "\next_SuccessFactorsID: " + User.extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsID; output += "\next_SuccessFactorsRoleID: " + User.extension_be6dc6c96b4c411780751b4231962926_SuccessFactorsRoleID; output += "\next_telephoneNumber: " + User.extension_be6dc6c96b4c411780751b4231962926_telephoneNumber; #endif if (User.signInNames != null) { foreach (SignInName sin in User.signInNames) { output += "\nSignInName: " + sin.value; } } if (User.passwordProfile != null) { output += "\nForceChangePasswordNextLogin: " + User.passwordProfile.forceChangePasswordNextLogin; } }