private bool ValidateserverUrl(Uri server, Uri client)
        {
            Domain domain = new Domain() { Server = server.Host, Client = client.Host };

            if (DomainHelper.IsDenied(domain))
            {
                return false;
            }
            else if (DomainHelper.IsAllowed(domain))
            {
                return true;
            }
            else
            {
                var toolTipForm = new ToolTipForm(domain);
                
                if (toolTipForm.ShowDialog() == DialogResult.OK)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
Example #2
0
        internal ToolTipForm(Domain domain)
        {
            InitializeComponent();

            BtnCertificateStatus.ImageAlign = ContentAlignment.TopLeft;
            BtnCertificateStatus.BackgroundImageLayout = ImageLayout.Stretch;
            BtnCertificateStatus.BackgroundImage = Resources.loading;

            _Domain = domain;
            LblMessage.Text = string.Format(Resources.SigningRequestMessage, _Domain.Client, _Domain.Server);

            CbSettings.LoadComboBoxItems();

            Shown += ToolTipForm_Shown;
            BtnSaveSettings.Click += new EventHandler(BtnSaveSettings_Click);

            _ToolTip = new ToolTip();

            VerifyCertificate(domain);
        }
Example #3
0
        private void VerifyCertificate(Domain domain)
        {
            try
            {
                _Certificate = HttpGet.GetCertificate(domain.Server);
                BtnCertificateStatus.Cursor = Cursors.Hand;

                if (_Certificate.Verify() == true)
                {
                    _CertificateStatus = Resources.CertificateStatusValid;
                    BtnCertificateStatus.BackgroundImage = Resources.certificate_valid;
                }
                else
                {
                    throw new Exception(Resources.CertificateStatusInvalid);
                }
            }
            catch (Exception ex)
            {
                _CertificateStatus = ex.Message;
                BtnCertificateStatus.BackgroundImage = Resources.certificate_invalid;
            }
        }
Example #4
0
        private void BtnAddWhiteList_Click(object sender, EventArgs e)
        {
            var domain = new Domain()
            {
                Client = TxtClientWhiteList.Text,
                Server = TxtServerWhiteList.Text
            };

            if (string.IsNullOrEmpty(domain.Client) == true)
            {
                TxtClientWhiteList.Focus();
            }
            else if (string.IsNullOrEmpty(domain.Server) == true)
            {
                TxtServerWhiteList.Focus();
            }
            else
            {
                DomainHelper.AllowAlways(domain);
                DomainHelper.UpdateDomains();
                RefreshWhiteList();
            }
        }
Example #5
0
 public static bool IsDenied(Domain domain)
 {
     return DeniedDomains.Any(o => o.Client == domain.Client && o.Server == domain.Server);
 }
Example #6
0
 private string GetDomainsDescription(Domain domain)
 {
     return string.Format(Resources.ManagerDomainsDescription, domain.Client, domain.Server);
 }
Example #7
0
 public static void RemoveDenied(Domain domain)
 {
     if (IsDenied(domain) == true)
     {
         _DeniedDomains.Remove(domain);
     }
 }
Example #8
0
 public static void RemoveAllowed(Domain domain)
 {
     if (IsAllowed(domain) == true)
     {
         _AllowedDomains.Remove(domain);
     }
 }
Example #9
0
        public static bool DenyAlways(Domain domain)
        {
            if (IsAllowed(domain) == true)
            {
                _AllowedDomains.Remove(domain);
            }

            if (IsDenied(domain) == false)
            {
                _AllowedDomains.Add(domain);
            }

            return false;
        }
Example #10
0
 public static bool DenyOnce(Domain domain)
 {
     return false;
 }
Example #11
0
 public static bool AllowOnce(Domain domain)
 {
     return true;
 }