public static List<PasswordAttributeEntry> Load() { string[] values = Settings.Store.ChangePasswordAttributes; List<PasswordAttributeEntry> result = new List<PasswordAttributeEntry>(); foreach (string entry in values) { PasswordAttributeEntry pae = new PasswordAttributeEntry(); pae.FromRegistryString(entry); result.Add(pae); } return result; }
public static List <PasswordAttributeEntry> Load() { string[] values = Settings.Store.ChangePasswordAttributes; List <PasswordAttributeEntry> result = new List <PasswordAttributeEntry>(); foreach (string entry in values) { PasswordAttributeEntry pae = new PasswordAttributeEntry(); pae.FromRegistryString(entry); result.Add(pae); } return(result); }
private void StoreSettings() { Settings.Store.LdapHost = Regex.Split(ldapHostTextBox.Text.Trim(), @"\s+"); Settings.Store.LdapPort = Convert.ToInt32(ldapPortTextBox.Text.Trim()); Settings.Store.LdapTimeout = Convert.ToInt32(timeoutTextBox.Text.Trim()); Settings.Store.UseSsl = (useSslCheckBox.CheckState == CheckState.Checked); Settings.Store.RequireCert = (validateServerCertCheckBox.CheckState == CheckState.Checked); Settings.Store.ServerCertFile = sslCertFileTextBox.Text.Trim(); Settings.Store.SearchDN = searchDnTextBox.Text.Trim(); Settings.Store.SetEncryptedSetting("SearchPW", searchPassTextBox.Text); Settings.Store.GroupDnPattern = this.groupDNPattern.Text.Trim(); Settings.Store.GroupMemberAttrib = this.groupMemberAttrTB.Text.Trim(); Settings.Store.Dereference = this.DereferenceComboBox.SelectedIndex; // Authentication Settings.Store.AllowEmptyPasswords = this.allowEmptyPwCB.Checked; Settings.Store.DnPattern = dnPatternTextBox.Text.Trim(); Settings.Store.DoSearch = (searchForDnCheckBox.CheckState == CheckState.Checked); Settings.Store.SearchFilter = searchFilterTextBox.Text.Trim(); Settings.Store.SearchContexts = Regex.Split(searchContextsTextBox.Text.Trim(), @"\s*\r?\n\s*"); // Authorization Settings.Store.AuthzRequireAuth = this.authzRequireAuthCB.Checked; Settings.Store.AuthzAllowOnError = this.authzAllowOnErrorCB.Checked; List<GroupAuthzRule> lst = new List<GroupAuthzRule>(); foreach (Object item in this.authzRulesListBox.Items) { lst.Add(item as GroupAuthzRule); m_logger.DebugFormat("Saving rule: {0}", item); } // Add the default as the last rule in the list lst.Add(new GroupAuthzRule(this.authzDefaultAllowRB.Checked)); GroupRuleLoader.SaveAuthzRules(lst); // Gateway List<GroupGatewayRule> gwList = new List<GroupGatewayRule>(); foreach (Object item in this.gatewayRulesListBox.Items) { gwList.Add(item as GroupGatewayRule); m_logger.DebugFormat("Saving rule: {0}", item); } GroupRuleLoader.SaveGatewayRules(gwList); // Change Password List<PasswordAttributeEntry> entries = new List<PasswordAttributeEntry>(); foreach (DataGridViewRow row in this.passwordAttributesDGV.Rows) { if (row.Cells[0].Value != null && row.Cells[1].Value != null) { string attribName = row.Cells[0].Value.ToString(); if (!string.IsNullOrEmpty(attribName)) { PasswordAttributeEntry entry = new PasswordAttributeEntry { Name = attribName, Method = (HashMethod)(row.Cells[1].Value) }; entries.Add(entry); } } } CPAttributeSettings.Save(entries); }
private void StoreSettings() { Settings.Store.LdapHost = Regex.Split(ldapHostTextBox.Text.Trim(), @"\s+"); Settings.Store.LdapPort = Convert.ToInt32(ldapPortTextBox.Text.Trim()); Settings.Store.LdapTimeout = Convert.ToInt32(timeoutTextBox.Text.Trim()); Settings.Store.EncryptionMethod = (int)(GetEncryptionMethodSelection()); Settings.Store.RequireCert = (validateServerCertCheckBox.CheckState == CheckState.Checked); Settings.Store.ServerCertFile = sslCertFileTextBox.Text.Trim(); Settings.Store.SearchDN = searchDnTextBox.Text.Trim(); Settings.Store.SetEncryptedSetting("SearchPW", searchPassTextBox.Text); Settings.Store.GroupDnPattern = this.groupDNPattern.Text.Trim(); Settings.Store.GroupMemberAttrib = this.groupMemberAttrTB.Text.Trim(); Settings.Store.GroupGidAttrib = this.groupGidAttr.Text.Trim(); Settings.Store.GroupGidAttribIU = this.groupGidAttrIU.Text.Trim(); Settings.Store.Dereference = this.DereferenceComboBox.SelectedIndex; Settings.Store.UseAuthBindForAuthzAndGateway = this.m_useAuthBindForAuthzAndGatewayCb.Checked; // Authentication Settings.Store.AllowEmptyPasswords = this.allowEmptyPwCB.Checked; Settings.Store.DnPattern = dnPatternTextBox.Text.Trim(); Settings.Store.DoSearch = (searchForDnCheckBox.CheckState == CheckState.Checked); Settings.Store.SearchFilter = searchFilterTextBox.Text.Trim(); Settings.Store.SearchContexts = Regex.Split(searchContextsTextBox.Text.Trim(), @"\s*\r?\n\s*"); // Authorization Settings.Store.AuthzRequireAuth = this.authzRequireAuthCB.Checked; Settings.Store.AuthzAllowOnError = this.authzAllowOnErrorCB.Checked; Settings.Store.AuthzApplyToAllUsers = this.authzApplyToAllUsersCB.Checked; List <GroupAuthzRule> lst = new List <GroupAuthzRule>(); foreach (Object item in this.authzRulesListBox.Items) { lst.Add(item as GroupAuthzRule); m_logger.DebugFormat("Saving rule: {0}", item); } // Add the default as the last rule in the list lst.Add(new GroupAuthzRule(this.authzDefaultAllowRB.Checked)); GroupRuleLoader.SaveAuthzRules(lst); // Gateway List <GroupGatewayRule> gwList = new List <GroupGatewayRule>(); foreach (Object item in this.gatewayRulesListBox.Items) { gwList.Add(item as GroupGatewayRule); m_logger.DebugFormat("Saving rule: {0}", item); } GroupRuleLoader.SaveGatewayRules(gwList); // Change Password List <PasswordAttributeEntry> entries = new List <PasswordAttributeEntry>(); foreach (DataGridViewRow row in this.passwordAttributesDGV.Rows) { if (row.Cells[0].Value != null && row.Cells[1].Value != null) { string attribName = row.Cells[0].Value.ToString(); if (!string.IsNullOrEmpty(attribName)) { PasswordAttributeEntry entry = new PasswordAttributeEntry { Name = attribName, Method = (HashMethod)(row.Cells[1].Value) }; entries.Add(entry); } } } CPAttributeSettings.Save(entries); // Login Script SFTP Settings.Store.SFTPServerURL = txt_script_serverurl.Text; Settings.Store.SFTPUser = txt_script_user.Text; Settings.Store.SFTPPassword = txt_script_password.Text; Settings.Store.SFTPFingerprint = txt_script_fingerprint.Text; Settings.Store.SFTPScriptPath = txt_script_path.Text; Settings.Store.SFTPScriptPath2 = txt_script_path_2.Text; Settings.Store.SFTPGroupListPath = txt_script_group_list_path.Text; Settings.Store.CMDLoginScript = txt_script_cmd_login.Text; Settings.Store.CMDLogoffScript = txt_script_cmd_logoff.Text; }