mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Validates antiforgery tokens after authentication
This commit is contained in:
1 parent
fd64cbd6ba
commit
f87fa04df5
1 file changed
+3
-1
@@ -90,11 +90,13 @@ public class Program
|
||||
app.UseCultureRedirect(); // if the user attempts to go to a localized route without providing a culture, redirect to default culture
|
||||
app.UseApiExceptionHandling(); // handle any problem details returned by the API
|
||||
app.UseRouting();
|
||||
app.UseAntiforgeryFE(additionalContentTypes: ["application/json"]); // validate the antiforgery token of the JSON requests, sent via the RequestVerificationToken header
|
||||
app.UseRequestLocalization(); // set the culture from the localized routes
|
||||
app.UseSession();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
// validate the antiforgery token after authentication, because the token is bound to the authenticated user and
|
||||
// validating it before the user is known would reject every request made by a logged-in user
|
||||
app.UseAntiforgeryFE(additionalContentTypes: ["application/json"]);
|
||||
app.UseForwardedHeaders();
|
||||
|
||||
// handle path base from reverse proxies
|
||||
|
||||
Reference in new issue
Block a user