Beispiel #1
0
        public HeaderConfigurationOverrideHelperTests()
        {
            _mockContext = new Mock <IHttpContextWrapper>(MockBehavior.Strict).Object;
            Mock.Get(_mockContext).Setup(ctx => ctx.GetNWebsecOverrideContext()).Returns(new NWebsecContext());

            _headerConfigurationOverrideHelper = new HeaderConfigurationOverrideHelper();
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferrerPolicyAttribute"/> class
 /// </summary>
 public ReferrerPolicyAttribute(ReferrerPolicy policy)
 {
     _config = new ReferrerPolicyConfiguration {
         Policy = policy.MapToCoreType()
     };
     _configurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper        = new HeaderOverrideHelper(new CspReportHelper());
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XDownloadOptionsAttribute"/> class
 /// </summary>
 public XDownloadOptionsAttribute()
 {
     _config = new SimpleBooleanConfiguration {
         Enabled = true
     };
     _headerConfigurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XXssProtectionAttribute"/> class
 /// </summary>
 public XXssProtectionAttribute()
 {
     _config = new XXssProtectionConfiguration {
         Policy = XXssPolicy.FilterEnabled, BlockMode = true
     };
     _headerConfigurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetNoCacheHttpHeadersAttribute"/> class
 /// </summary>
 public SetNoCacheHttpHeadersAttribute()
 {
     _config = new SimpleBooleanConfiguration {
         Enabled = true
     };
     _configurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper        = new HeaderOverrideHelper();
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFrameOptionsAttribute"/> class
 /// </summary>
 public XFrameOptionsAttribute()
 {
     _config = new XFrameOptionsConfiguration {
         Policy = XfoPolicy.Deny
     };
     _configurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper        = new HeaderOverrideHelper();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="XContentTypeOptionsAttribute"/> class
 /// </summary>
 public XContentTypeOptionsAttribute()
 {
     _config = new SimpleBooleanConfiguration {
         Enabled = true
     };
     _headerConfigurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper = new HeaderOverrideHelper();
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XRobotsTagAttribute"/> class
 /// </summary>
 public XRobotsTagAttribute()
 {
     _config = new XRobotsTagConfiguration {
         Enabled = true
     };
     _headerConfigurationOverrideHelper = new HeaderConfigurationOverrideHelper();
     _headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
 }
Beispiel #9
0
        public void Setup()
        {
            var mockedContext = new Mock <HttpContextBase>();
            IDictionary <String, Object> nwebsecContentItems = new Dictionary <string, object>();

            mockedContext.Setup(x => x.Items["nwebsecheaderoverride"]).Returns(nwebsecContentItems);
            _mockContext = mockedContext.Object;
            _headerConfigurationOverrideHelper = new HeaderConfigurationOverrideHelper();
        }