KestrunHostMapExtensions.AddAntiforgeryTokenRoute method
Adds a GET endpoint that issues the antiforgery cookie and returns a JSON payload: { token: “…”, headerName: “X-CSRF-TOKEN” }. The endpoint itself is exempt from antiforgery validation.
public static IEndpointConventionBuilder AddAntiforgeryTokenRoute(this KestrunHost host,
string pattern = "/csrf-token")
| parameter | description |
|---|---|
| host | The KestrunHost instance. |
| pattern | The route path to expose (default “/csrf-token”). |
Return Value
IEndpointConventionBuilder for further configuration.
See Also
- class KestrunHost
- class KestrunHostMapExtensions
- namespace Kestrun.Hosting