From d6b9d6e2999170f45b6a86617788582187a68458 Mon Sep 17 00:00:00 2001 From: Michael Davidson Date: Tue, 1 Jan 2019 10:31:17 +1100 Subject: [PATCH] Whitespace fixes --- .../Csp/Builder/CspBuilder.cs | 22 ++--- .../Csp/Builder/CspManifestBuilder.cs | 96 +++++++++---------- .../Csp/Options/CspManifestSrcOptions.cs | 8 +- .../CspOptions.cs | 12 +-- .../CspBuilderTests.cs | 24 ++--- 5 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspBuilder.cs b/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspBuilder.cs index 676114e..895f3ac 100644 --- a/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspBuilder.cs +++ b/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspBuilder.cs @@ -33,14 +33,14 @@ public class CspBuilder /// Set up rules for AJAX, WebSockets and EventSource. /// public CspConnectionBuilder AllowConnections { get; } = new CspConnectionBuilder(); - /// - /// Sets up rules for where this app can load web manifests from - /// - public CspManifestBuilder AllowManifest { get; } = new CspManifestBuilder(); - /// - /// Set up rules for fonts. - /// - public CspFontsBuilder AllowFonts { get; } = new CspFontsBuilder(); + /// + /// Sets up rules for where this app can load web manifests from + /// + public CspManifestBuilder AllowManifest { get; } = new CspManifestBuilder(); + /// + /// Set up rules for fonts. + /// + public CspFontsBuilder AllowFonts { get; } = new CspFontsBuilder(); /// /// Set up rules for audio and video in e.g. HTML5 audio and video elements. /// @@ -129,7 +129,7 @@ public CspOptions BuildCspOptions() _options.Child = AllowChildren.BuildOptions(); #pragma warning restore CS0618 // Type or member is obsolete _options.Connect = AllowConnections.BuildOptions(); - _options.Manifest = AllowManifest.BuildOptions(); + _options.Manifest = AllowManifest.BuildOptions(); _options.Default = ByDefaultAllow.BuildOptions(); _options.Font = AllowFonts.BuildOptions(); _options.FormAction = AllowFormActions.BuildOptions(); @@ -142,8 +142,8 @@ public CspOptions BuildCspOptions() _options.Sandbox = _sandboxBuilder.BuildOptions(); _options.Frame = AllowFrames.BuildOptions(); _options.Worker = AllowWorkers.BuildOptions(); - _options.Prefetch = AllowPrefetch.BuildOptions(); - _options.BaseUri = AllowBaseUri.BuildOptions(); + _options.Prefetch = AllowPrefetch.BuildOptions(); + _options.BaseUri = AllowBaseUri.BuildOptions(); _options.OnSendingHeader = OnSendingHeader; return _options; } diff --git a/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspManifestBuilder.cs b/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspManifestBuilder.cs index 94d075a..b882551 100644 --- a/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspManifestBuilder.cs +++ b/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Builder/CspManifestBuilder.cs @@ -2,59 +2,59 @@ namespace Joonasw.AspNetCore.SecurityHeaders.Csp.Builder { - /// - /// Builder for controlling where web manifests can be loaded from - /// + /// + /// Builder for controlling where web manifests can be loaded from + /// public class CspManifestBuilder { - private readonly CspManifestSrcOptions _options = new CspManifestSrcOptions(); + private readonly CspManifestSrcOptions _options = new CspManifestSrcOptions(); - /// - /// Allow manifests to be loaded from the current domain. - /// - /// The builder for call chaining - public CspManifestBuilder FromSelf() { - _options.AllowSelf = true; - return this; - } + /// + /// Allow manifests to be loaded from the current domain. + /// + /// The builder for call chaining + public CspManifestBuilder FromSelf() { + _options.AllowSelf = true; + return this; + } - /// - /// Allow manifests to load from the given . - /// - /// The URI to allow. - /// The builder for call chaining - public CspManifestBuilder From(string uri) { - _options.AllowedSources.Add(uri); - return this; - } + /// + /// Allow manifests to load from the given . + /// + /// The URI to allow. + /// The builder for call chaining + public CspManifestBuilder From(string uri) { + _options.AllowedSources.Add(uri); + return this; + } - /// - /// Allow manifests to load from anywhere. - /// - /// The builder for call chaining - public CspManifestBuilder FromAnywhere() { - _options.AllowAny = true; - return this; - } + /// + /// Allow manifests to load from anywhere. + /// + /// The builder for call chaining + public CspManifestBuilder FromAnywhere() { + _options.AllowAny = true; + return this; + } - /// - /// Block all loading of manifests. - /// - /// The builder for call chaining - public void FromNowhere() { - _options.AllowNone = true; - } + /// + /// Block all loading of manifests. + /// + /// The builder for call chaining + public void FromNowhere() { + _options.AllowNone = true; + } - /// - /// Allow manifests to load from secure connections. - /// - /// The builder for call chaining - public CspManifestBuilder OnlyOverHttps() { - _options.AllowOnlyHttps = true; - return this; - } + /// + /// Allow manifests to load from secure connections. + /// + /// The builder for call chaining + public CspManifestBuilder OnlyOverHttps() { + _options.AllowOnlyHttps = true; + return this; + } - public CspManifestSrcOptions BuildOptions() { - return _options; - } - } + public CspManifestSrcOptions BuildOptions() { + return _options; + } + } } \ No newline at end of file diff --git a/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Options/CspManifestSrcOptions.cs b/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Options/CspManifestSrcOptions.cs index aefc6af..454e953 100644 --- a/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Options/CspManifestSrcOptions.cs +++ b/src/Joonasw.AspNetCore.SecurityHeaders/Csp/Options/CspManifestSrcOptions.cs @@ -2,9 +2,9 @@ { public class CspManifestSrcOptions : CspSrcOptionsBase { - public CspManifestSrcOptions() - :base ("manifest-src") - { - } + public CspManifestSrcOptions() + :base ("manifest-src") + { + } } } diff --git a/src/Joonasw.AspNetCore.SecurityHeaders/CspOptions.cs b/src/Joonasw.AspNetCore.SecurityHeaders/CspOptions.cs index af159d5..21fb109 100644 --- a/src/Joonasw.AspNetCore.SecurityHeaders/CspOptions.cs +++ b/src/Joonasw.AspNetCore.SecurityHeaders/CspOptions.cs @@ -37,10 +37,10 @@ public class CspOptions /// Rules to apply for AJAX, WebSockets and EventSource. /// public CspConnectSrcOptions Connect { get; set; } - /// - /// Rules to control where web manifests can be loaded from - /// - public CspManifestSrcOptions Manifest { get; set; } + /// + /// Rules to control where web manifests can be loaded from + /// + public CspManifestSrcOptions Manifest { get; set; } /// /// Rules to apply for fonts. /// @@ -145,7 +145,7 @@ public CspOptions() Child = new CspChildSrcOptions(); #pragma warning restore CS0618 // Type or member is obsolete Connect = new CspConnectSrcOptions(); - Manifest = new CspManifestSrcOptions(); + Manifest = new CspManifestSrcOptions(); Font = new CspFontSrcOptions(); FormAction = new CspFormActionOptions(); Img = new CspImgSrcOptions(); @@ -181,7 +181,7 @@ public CspOptions() Child.ToString(nonceService), #pragma warning restore CS0618 // Type or member is obsolete Connect.ToString(nonceService), - Manifest.ToString(nonceService), + Manifest.ToString(nonceService), Font.ToString(nonceService), FormAction.ToString(nonceService), Img.ToString(nonceService), diff --git a/test/Joonasw.AspNetCore.SecurityHeaders.Tests/CspBuilderTests.cs b/test/Joonasw.AspNetCore.SecurityHeaders.Tests/CspBuilderTests.cs index e819004..21655a2 100644 --- a/test/Joonasw.AspNetCore.SecurityHeaders.Tests/CspBuilderTests.cs +++ b/test/Joonasw.AspNetCore.SecurityHeaders.Tests/CspBuilderTests.cs @@ -95,26 +95,26 @@ public void WithFramesAndWorkers_ReturnsCorrectHeader() [Fact] public void WithPrefetch_ReturnsCorrectHeader() { - var builder = new CspBuilder(); + var builder = new CspBuilder(); - builder.AllowPrefetch.From("https://www.google.com"); + builder.AllowPrefetch.From("https://www.google.com"); - var headerValue = builder.BuildCspOptions().ToString(null).headerValue; + var headerValue = builder.BuildCspOptions().ToString(null).headerValue; - Assert.Equal("prefetch-src https://www.google.com", headerValue); + Assert.Equal("prefetch-src https://www.google.com", headerValue); } - [Fact] - public void WithManifest_ReturnsCorrectHeader() - { - var builder = new CspBuilder(); + [Fact] + public void WithManifest_ReturnsCorrectHeader() + { + var builder = new CspBuilder(); - builder.AllowManifest.From("https://www.google.com"); + builder.AllowManifest.From("https://www.google.com"); - var headerValue = builder.BuildCspOptions().ToString(null).headerValue; + var headerValue = builder.BuildCspOptions().ToString(null).headerValue; - Assert.Equal("manifest-src https://www.google.com", headerValue); - } + Assert.Equal("manifest-src https://www.google.com", headerValue); + } [Fact] public async Task OnSendingHeader_ShouldNotSendTest()