private SetUserSettingsRequest CreateSetUserSettingsRequest(IDictionary <string, string> userSettings) { if (userSettings == null || userSettings.Count < 1) { throw new ArgumentNullException("userSettings cannot be null or empty.", "userSettings"); } EnsureUserAuthenticated(); List <MFAOptionType> settingsList = new List <MFAOptionType>(); foreach (KeyValuePair <string, string> setting in userSettings) { settingsList.Add(new MFAOptionType() { AttributeName = setting.Key, DeliveryMedium = setting.Value }); } SetUserSettingsRequest setUserSettingsRequest = new SetUserSettingsRequest() { AccessToken = SessionTokens.AccessToken, MFAOptions = settingsList }; return(setUserSettingsRequest); }
public PartialViewResult NavigationPanel(string accountID) { try { if (accountID != null && accountID != string.Empty) { UserDTO user = FormsAuthenticationWrapper.User; user.LastAccountID = accountID; FormsAuthenticationWrapper.User = user; var setUserSettingsRequest = new SetUserSettingsRequest { User = user, ApplicationID = null, CurrentPassword = null, NewPassword = null, EmailAddress = null }; ForesightService.SetUserSettings(setUserSettingsRequest); } return(PartialView("_NavigationPanel", GetNavigationViewModel())); } catch (Exception ex) { LoggingHelper.Logger.WriteException(ex); return(PartialView("_NavigationPanel", new NavigationViewModel { ErrorMessage = ex.Message })); } }
public void UpdateLastAccountID(string accountID) { try { if (!String.IsNullOrWhiteSpace(accountID)) { UserDTO user = FormsAuthenticationWrapper.User; user.LastAccountID = accountID; FormsAuthenticationWrapper.User = user; var setUserSettingsRequest = new SetUserSettingsRequest { User = user, ApplicationID = null, CurrentPassword = null, NewPassword = null, EmailAddress = null }; ForesightService.SetUserSettings(setUserSettingsRequest); } } catch (Exception ex) { LoggingHelper.Logger.WriteException(ex); } }
/// <summary> /// Sets the MFAOptions to be the settings desibed in the userSettings dictionary /// using an asynchronous call /// </summary> /// <param name="userSettings">Dictionary for the user MFA settings of the form [attribute, delivery medium]</param> public virtual async Task SetUserSettingsAsync(IDictionary <string, string> userSettings) { SetUserSettingsRequest setUserSettingsRequest = CreateSetUserSettingsRequest(userSettings); await Provider.SetUserSettingsAsync(setUserSettingsRequest).ConfigureAwait(false); //Update the local Settings property foreach (KeyValuePair <string, string> entry in userSettings) { Settings[entry.Key] = entry.Value; } }
/// <summary> /// Sets the MFAOptions to be the settings desibed in the userSettings dictionary /// using an asynchronous call /// </summary> /// <param name="userSettings">Dictionary for the user MFA settings of the form [attribute, delivery medium]</param> public void SetUserSettingsAsync(IDictionary <string, string> userSettings, AsyncCallback callback = null) { SetUserSettingsRequest setUserSettingsRequest = CreateSetUserSettingsRequest(userSettings); Provider.SetUserSettingsAsync(setUserSettingsRequest, r => { if (r.Exception == null) { //Update the local Settings property foreach (KeyValuePair <string, string> entry in userSettings) { Settings[entry.Key] = entry.Value; } } callback?.Invoke(new AsyncResult(r.Exception)); }); }
public void SetUserSettingsAsync(SetUserSettingsRequest request, AmazonServiceCallback <SetUserSettingsRequest, SetUserSettingsResponse> callback, AsyncOptions options = null) { throw new System.NotImplementedException(); }