Skip to content

Commit

Permalink
Add antiforgery.
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Dec 17, 2024
1 parent 0fc06bc commit 4795df2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ProfanityFilter.WebApi/Components/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
</div>
</div>

<AntiforgeryToken />

<button class="button is-large is-info is-inverted js-modal-trigger"
@onclick="@(() => _isActive = _isActive is not true)">
<span>Select Replacement Strategy: @(_selectedStrategy.ToString().SplitCamelCase())</span>
Expand Down
1 change: 0 additions & 1 deletion src/ProfanityFilter.WebApi/Components/Pages/Home.razor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace ProfanityFilter.WebApi.Components.Pages;

[StreamRendering]
[IgnoreAntiforgeryToken(Order = 700)]
public sealed partial class Home : IAsyncDisposable
{
private readonly SystemTimer _debounceTimer = new()
Expand Down
1 change: 1 addition & 0 deletions src/ProfanityFilter.WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
builder.Services.AddSignalR(
static options => options.EnableDetailedErrors = true);

builder.Services.AddAntiforgery();
builder.Services.AddDataProtection()
.UseCryptographicAlgorithms(new()
{
Expand Down

0 comments on commit 4795df2

Please sign in to comment.