Skip to content

Commit 021a0a6

Browse files
authored
Add correct name for allow-from (#244)
* Add correct name for allow-from * Update public API
1 parent f485118 commit 021a0a6

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/XFrameOptionsHeaderExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ public static HeaderPolicyCollection AddFrameOptionsSameOrigin(this HeaderPolicy
3838
/// <param name="uri">The uri of the origin in which the page may be displayed in a frame</param>
3939
/// <returns>The <see cref="HeaderPolicyCollection"/> for method chaining</returns>
4040
public static HeaderPolicyCollection AddFrameOptionsSameOrigin(this HeaderPolicyCollection policies, string uri)
41+
=> policies.AddFrameOptionsAllowFrom(uri);
42+
43+
/// <summary>
44+
/// Add X-Frame-Options ALLOW-FROM {uri} to all requests, where the uri is provided
45+
/// The page can only be displayed in a frame on the specified origin.
46+
/// </summary>
47+
/// <param name="policies">The collection of policies</param>
48+
/// <param name="uri">The uri of the origin in which the page may be displayed in a frame</param>
49+
/// <returns>The <see cref="HeaderPolicyCollection"/> for method chaining</returns>
50+
public static HeaderPolicyCollection AddFrameOptionsAllowFrom(this HeaderPolicyCollection policies, string uri)
4151
{
4252
return policies.ApplyPolicy(new XFrameOptionsHeader($"ALLOW-FROM {uri}"));
4353
}

test/NetEscapades.AspNetCore.SecurityHeaders.Test/PublicApiTest.PublicApiHasNotChanged.verified.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ namespace Microsoft.AspNetCore.Builder
267267
}
268268
public static class XFrameOptionsHeaderExtensions
269269
{
270+
public static Microsoft.AspNetCore.Builder.HeaderPolicyCollection AddFrameOptionsAllowFrom(this Microsoft.AspNetCore.Builder.HeaderPolicyCollection policies, string uri) { }
270271
public static Microsoft.AspNetCore.Builder.HeaderPolicyCollection AddFrameOptionsDeny(this Microsoft.AspNetCore.Builder.HeaderPolicyCollection policies) { }
271272
public static Microsoft.AspNetCore.Builder.HeaderPolicyCollection AddFrameOptionsSameOrigin(this Microsoft.AspNetCore.Builder.HeaderPolicyCollection policies) { }
272273
public static Microsoft.AspNetCore.Builder.HeaderPolicyCollection AddFrameOptionsSameOrigin(this Microsoft.AspNetCore.Builder.HeaderPolicyCollection policies, string uri) { }

0 commit comments

Comments
 (0)