Skip to content

Commit

Permalink
Moved HeaderOverrideHelper to Common
Browse files Browse the repository at this point in the history
  • Loading branch information
klings committed Mar 4, 2018
1 parent 9c856e0 commit b3c9f97
Show file tree
Hide file tree
Showing 36 changed files with 101 additions and 502 deletions.
141 changes: 0 additions & 141 deletions src/NWebsec.AspNet.Mvc/Helpers/HeaderOverrideHelper.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/NWebsec.AspNet.Mvc/HttpHeaders/Csp/CspHtmlHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Csp;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using HttpContextWrapper = NWebsec.Core.Web.HttpContextWrapper;

namespace NWebsec.Mvc.HttpHeaders.Csp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Csp;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using NWebsec.Csp;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using NWebsec.Csp;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Csp;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders
Expand Down
1 change: 0 additions & 1 deletion src/NWebsec.AspNet.Mvc/HttpHeaders/XRobotsTagAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using NWebsec.Core.Web;
using NWebsec.Csp;
using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.Helpers;
using NWebsec.Mvc.HttpHeaders.Internals;

namespace NWebsec.Mvc.HttpHeaders
Expand Down
11 changes: 11 additions & 0 deletions src/NWebsec.AspNetCore.Core/Helpers/CspReportHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) André N. Klingsheim. See License.txt in the project root for license information.

using NWebsec.Core.Common.Csp;

namespace NWebsec.AspNetCore.Core.Helpers
{
public class CspReportHelper : ICspReportHelper
{
public string GetBuiltInCspReportHandlerRelativeUri() => "/cspreport";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.Core.Common.HttpHeaders.Configuration.Validation;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
Expand All @@ -25,7 +25,7 @@ public class CspMediaTypeTagHelper : TagHelper
public CspMediaTypeTagHelper()
{
_cspConfigOverride = new CspConfigurationOverrideHelper();
_headerOverride = new HeaderOverrideHelper();
_headerOverride = new HeaderOverrideHelper(new CspReportHelper());
}

internal CspMediaTypeTagHelper(ICspConfigurationOverrideHelper overrideHelper,
Expand Down
4 changes: 2 additions & 2 deletions src/NWebsec.AspNetCore.Mvc.TagHelpers/CspNonceTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.Mvc.Common.Helpers;

namespace NWebsec.AspNetCore.Mvc.TagHelpers
Expand All @@ -23,7 +23,7 @@ public class CspNonceTagHelper : TagHelper
public CspNonceTagHelper()
{
_cspConfigOverride = new CspConfigurationOverrideHelper();
_headerOverride = new HeaderOverrideHelper();
_headerOverride = new HeaderOverrideHelper(new CspReportHelper());
}

internal CspNonceTagHelper(ICspConfigurationOverrideHelper overrideHelper,
Expand Down
4 changes: 2 additions & 2 deletions src/NWebsec.AspNetCore.Mvc/Csp/Internals/CspAttributeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

using System;
using Microsoft.AspNetCore.Mvc.Filters;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.AspNetCore.Mvc.Internals;
using NWebsec.Core.Common.HttpHeaders.Configuration;
using NWebsec.Mvc.Common.Helpers;
Expand All @@ -24,7 +24,7 @@ protected CspAttributeBase()
{
_config = new CspHeaderConfiguration { Enabled = true };
_headerConfigurationOverrideHelper = new CspConfigurationOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
}

internal sealed override string ContextKeyIdentifier => ReportOnly ? "CspReportOnly" : "Csp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

using System;
using Microsoft.AspNetCore.Mvc.Filters;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.AspNetCore.Mvc.Internals;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
Expand All @@ -24,7 +24,7 @@ protected CspBlockAllMixedContentAttributeBase()
{
_directive = new CspMixedContentOverride { Enabled = true };
_configurationOverrideHelper = new CspConfigurationOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
}

internal sealed override string ContextKeyIdentifier => ReportOnly ? "CspReportOnly" : "Csp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Filters;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.Core.Common.HttpHeaders.Csp;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.AspNetCore.Mvc.Internals;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
Expand All @@ -31,7 +31,7 @@ protected CspDirectiveAttributeBase()
InheritOtherSources = true
};
_headerConfigurationOverrideHelper = new CspConfigurationOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
}

internal sealed override string ContextKeyIdentifier => ReportOnly ? "CspReportOnly" : "Csp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

using System;
using Microsoft.AspNetCore.Mvc.Filters;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.Core.Common.HttpHeaders.Configuration.Validation;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.AspNetCore.Mvc.Internals;
using NWebsec.Mvc.Common.Csp;
using NWebsec.Mvc.Common.Helpers;
Expand All @@ -26,7 +26,7 @@ protected CspPluginTypesAttributeBase(params string[] mediaTypes)
{
_directive = new CspPluginTypesOverride { Enabled = true, InheritMediaTypes = true };
_configurationOverrideHelper = new CspConfigurationOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());

if (mediaTypes.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using NWebsec.AspNetCore.Core.Helpers;
using NWebsec.AspNetCore.Core.Web;
using NWebsec.Core.Common.HttpHeaders.Configuration;
using NWebsec.Core.Common.HttpHeaders.Csp;
using NWebsec.AspNetCore.Mvc.Helpers;
using NWebsec.AspNetCore.Mvc.Internals;
using NWebsec.Mvc.Common.Helpers;

Expand All @@ -25,7 +25,7 @@ protected CspReportUriAttributeBase()
{
_directive = new CspReportUriDirectiveConfiguration { Enabled = true };
_configurationOverrideHelper = new CspConfigurationOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper();
_headerOverrideHelper = new HeaderOverrideHelper(new CspReportHelper());
}

internal sealed override string ContextKeyIdentifier => ReportOnly ? "CspReportOnly" : "Csp";
Expand Down
Loading

0 comments on commit b3c9f97

Please sign in to comment.