Skip to content

Commit

Permalink
require AntiForgery on Static Rendered components
Browse files Browse the repository at this point in the history
  • Loading branch information
sbwalker committed May 8, 2024
1 parent f789582 commit bf4052b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Antiforgery;

namespace OqtaneSSR.Extensions
{
Expand All @@ -23,6 +24,7 @@ public static void MapFallback(this IEndpointRouteBuilder endpoints)
{
routeEndpointBuilder.Metadata.Add(new RootComponentMetadata(typeof(App)));
routeEndpointBuilder.Metadata.Add(new ComponentTypeMetadata(typeof(App)));
routeEndpointBuilder.Metadata.Add(new RequireAntiforgeryTokenAttribute());
});
}
}
Expand Down
1 change: 1 addition & 0 deletions Oqtane.Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISyncMan
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseAntiforgery();

if (_useSwagger)
{
Expand Down

0 comments on commit bf4052b

Please sign in to comment.