Esempio n. 1
0
        public static List <AttributeEntry> Load()
        {
            string[] values = Settings.Store.ChangePasswordAttributes;
            List <AttributeEntry> result = new List <AttributeEntry>();

            foreach (string entry in values)
            {
                AttributeEntry pae = new AttributeEntry();
                pae.FromRegistryString(entry);
                result.Add(pae);
            }
            return(result);
        }
Esempio n. 2
0
        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.UseTls         = (useTlsCheckBox.CheckState == CheckState.Checked);
            Settings.Store.RequireCert    = (validateServerCertCheckBox.CheckState == CheckState.Checked);
            Settings.Store.ServerCertFile = sslCertFileTextBox.Text.Trim();
            Settings.Store.UseAuthBindForAuthzAndGateway = (useAuthBindForAuthzAndGatewayCb.CheckState == CheckState.Checked);
            Settings.Store.SearchDN = searchDnTextBox.Text.Trim();
            Settings.Store.SetEncryptedSetting("SearchPW", searchPassTextBox.Text);

            // 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*");
            Settings.Store.AuthzDefault        = this.authzDefaultAllowRB.Checked;

            List <string> AttribConv = new List <string>();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[0].Value != null && row.Cells[1].Value != null)
                {
                    AttribConv.Add(row.Cells[0].Value.ToString() + "\t" + row.Cells[1].Value.ToString().Trim());
                }
            }
            if (AttribConv.Count > 0)
            {
                Settings.Store.AttribConv = AttribConv.ToArray();
            }
            else
            {
                Settings.Store.AttribConv = new string[] { }
            };

            // Authorization
            Settings.Store.AuthzRequireAuth  = this.authzRequireAuthCB.Checked;
            Settings.Store.AuthzAllowOnError = this.authzAllowOnErrorCB.Checked;
            Settings.Store.AuthzDefault      = this.authzDefaultAllowRB.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);
            }
            string SaveAuthzRules_ret = GroupRuleLoader.SaveAuthzRules(lst);

            if (!string.IsNullOrEmpty(SaveAuthzRules_ret))
            {
                MessageBox.Show("There was an error in saving your authorization rules.\n" + SaveAuthzRules_ret);
            }

            // 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);
            }
            string SaveGatewayRules_ret = GroupRuleLoader.SaveGatewayRules(gwList);

            if (!string.IsNullOrEmpty(SaveGatewayRules_ret))
            {
                MessageBox.Show("There was an error in saving your gateway rules.\n" + SaveGatewayRules_ret);
            }

            // Change Password
            List <AttributeEntry> entries = new List <AttributeEntry>();

            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))
                    {
                        AttributeEntry entry = new AttributeEntry
                        {
                            Name   = attribName,
                            Method = (Methods)(row.Cells[1].Value)
                        };
                        entries.Add(entry);
                    }
                }
            }
            CPAttributeSettings.Save(entries);
        }
Esempio n. 3
0
        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.UseTls = (useTlsCheckBox.CheckState == CheckState.Checked);
            Settings.Store.RequireCert = (validateServerCertCheckBox.CheckState == CheckState.Checked);
            Settings.Store.ServerCertFile = sslCertFileTextBox.Text.Trim();
            Settings.Store.UseAuthBindForAuthzAndGateway = (useAuthBindForAuthzAndGatewayCb.CheckState == CheckState.Checked);
            Settings.Store.SearchDN = searchDnTextBox.Text.Trim();
            Settings.Store.SetEncryptedSetting("SearchPW", searchPassTextBox.Text);

            // 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*");
            Settings.Store.AuthzDefault = this.authzDefaultAllowRB.Checked;

            List<string> AttribConv = new List<string>();
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[0].Value != null && row.Cells[1].Value != null)
                {
                    AttribConv.Add(row.Cells[0].Value.ToString() + "\t" + row.Cells[1].Value.ToString().Trim());
                }
            }
            if (AttribConv.Count > 0)
                Settings.Store.AttribConv = AttribConv.ToArray();
            else
                Settings.Store.AttribConv = new string[] { };

            // Authorization
            Settings.Store.AuthzRequireAuth = this.authzRequireAuthCB.Checked;
            Settings.Store.AuthzAllowOnError = this.authzAllowOnErrorCB.Checked;
            Settings.Store.AuthzDefault = this.authzDefaultAllowRB.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);
            }
            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<AttributeEntry> entries = new List<AttributeEntry>();
            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))
                    {
                        AttributeEntry entry = new AttributeEntry
                        {
                            Name = attribName,
                            Method = (Methods)(row.Cells[1].Value)
                        };
                        entries.Add(entry);
                    }
                }

            }
            CPAttributeSettings.Save(entries);
        }
Esempio n. 4
0
 public static List<AttributeEntry> Load()
 {
     string[] values = Settings.Store.ChangePasswordAttributes;
     List<AttributeEntry> result = new List<AttributeEntry>();
     foreach (string entry in values)
     {
         AttributeEntry pae = new AttributeEntry();
         pae.FromRegistryString(entry);
         result.Add(pae);
     }
     return result;
 }