Beispiel #1
0
        public IFluentHpkpOptions ReportUri(string reportUri)
        {
            try
            {
                _validator.ValidateReportUri(reportUri);
            }
            catch (Exception e)
            {
                throw new ArgumentException(e.Message, nameof(reportUri));
            }

            Config.ReportUri = reportUri;
            return(this);
        }
        public override void Validate(object value)
        {
            var reportUri = (string)value;

            if (string.IsNullOrEmpty(reportUri))
            {
                return;
            }

            var validator = new HpkpConfigurationValidator();

            try
            {
                validator.ValidateReportUri(reportUri);
            }
            catch (Exception e)
            {
                throw new ConfigurationErrorsException("HPKP configuration error. Details: " + e.Message, e);
            }
        }
 public void ValidateReportUri_AbsoluteUriWithValidScheme_NoException()
 {
     Assert.DoesNotThrow(() => _validator.ValidateReportUri("http://nwebsec.com/report"));
     Assert.DoesNotThrow(() => _validator.ValidateReportUri("https://nwebsec.com/report"));
 }
Beispiel #4
0
 public void ValidateReportUri_AbsoluteUriWithValidScheme_NoException()
 {
     _validator.ValidateReportUri("http://nwebsec.com/report");
     _validator.ValidateReportUri("https://nwebsec.com/report");
 }