As our application is crossed from the Coverity Scan , there was an high impact in the application says that the CSRF attack is found. In order to prevent CSRF attacks I tired to implement the Antiforgery token concept in our blazor webassembly and blazor Server as an client - Server architecture. Where I couldn't able to find the hidden input field from the Component and there is no value is generated.
In client I have added the Component inside the form tag
<form method = "post"@onsubmit="UpdateInputs"><AntiforgeryToken/><button type="submit" class="btn btn-sm btn-primary" data-bs-dismiss="modal">Ok</button><button type="button" class="btn btn-sm btn-primary" data-bs-dismiss="modal" @onclick="clear">Cancel</button> </form>
but there is no input hidden field is appeared while the form is submitted.
In Server I added the [ValidateAntiForgeryToken] in the controller and in Program.cs file I added the
builder.Services.AddAntiforgery();app.UseAntiforgery();
What Am I missing or What i need to do with above code, to produce the antiforgery token.