/// <summary> /// Authenticate Familytree Object. /// </summary> /// <returns> True if authentication was successful, false otherwise</returns> /// <param name="pUserID">User ID from input</param> /// <param name="pPassword">Password from user input</param> /// <param name="pDeveloperKey">Developer Key from user input</param> private bool authenticateMe(string pUserID, string pPassword, string pDeveloperKey) { //We start with Wait Cursor. Cursor.Current = Cursors.WaitCursor; //Initialize the Family Tree Objects. demoFamilyTree = new FamilySearchFamilyTree(useSandbox); try { //Try to authenticate. demoFamilyTree.AuthenticateViaOAuth2Password(pUserID, pPassword, pDeveloperKey); //Switch on buttons. EnableButtons(); //Indicate success. return(true); } catch (Exception myError) { //Display Error Message. txtToken.Text = "Error " + myError.Message.ToString(); //Indicate authentication unsuccessful. return(false); } finally { //Restore cursor. Cursor.Current = Cursors.Default; } }
public void TestReadPersonWithMultiplePendingModificationsActivated() { // Make a separate copy from the main tree used in other tests var tempTree = new FamilySearchFamilyTree(true); var features = new List <Feature>(); tempTree.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId); // Get all the features that are pending IRestRequest request = new RedirectableRestRequest() .Accept(MediaTypes.APPLICATION_JSON_TYPE) .Build("https://sandbox.familysearch.org/platform/pending-modifications", Method.GET); IRestResponse response = tempTree.Client.Handle(request); // Get each pending feature features.AddRange(response.ToIRestResponse <FamilySearchPlatform>().Data.Features); // Add every pending feature to the tree's current client tempTree.Client.AddFilter(new ExperimentsFilter(features.Select(x => x.Name).ToArray())); var state = tempTree.AddPerson(TestBacking.GetCreateMalePerson()); cleanup.Add(state); // Ensure a response came back Assert.IsNotNull(state); var requestedFeatures = String.Join(",", state.Request.GetHeaders().Get("X-FS-Feature-Tag").Select(x => x.Value.ToString())); // Ensure each requested feature was found in the request headers Assert.IsTrue(features.TrueForAll(x => requestedFeatures.Contains(x.Name))); }
public void Initialize() { tree = new FamilySearchFamilyTree(true); tree.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId); Assert.DoesNotThrow(() => tree.IfSuccessful()); Assert.IsNotNullOrEmpty(tree.CurrentAccessToken); cleanup = new List <GedcomxApplicationState>(); }
//Setup Form and save Familytree object. public PersonById(FamilySearchFamilyTree originalFamilyTree) { InitializeComponent(); //Save originalFamilyTree for use in this form //Assumption: originalFamilyTree is initialized and ready to be used FamilyTree = originalFamilyTree; }
public void Initialize() { tree = new FamilySearchFamilyTree(true); tree.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId); memories = new FamilySearchMemories(true); memories = (FamilySearchMemories)memories.AuthenticateWithAccessToken(tree.CurrentAccessToken).Get(); cleanup = new List <GedcomxApplicationState>(); }
//Setup Form and save Familytree object. public CurrentUser(FamilySearchFamilyTree originalFamilyTree) { InitializeComponent(); //Save originalFamilyTree for use in this form. //Assumption: originalFamilyTree is initialized and ready to be used. FamilyTree = originalFamilyTree; }
public void Initialize() { collection = new CollectionState(new Uri(SANDBOX_URI)); collection.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId); tree = new FamilySearchFamilyTree(true); tree.AuthenticateWithAccessToken(collection.CurrentAccessToken); cleanup = new List <GedcomxApplicationState>(); Assert.DoesNotThrow(() => collection.IfSuccessful()); Assert.IsNotNullOrEmpty(collection.CurrentAccessToken); }
public void Initialize() { tree = new FamilySearchFamilyTree(true); tree.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId); cleanup = new List <GedcomxApplicationState>(); }