IAntiforgeryAdditionalDataProvider Interface

Allows providing or validating additional custom data for antiforgery tokens. For example, the developer could use this to supply a nonce when the token is generated, then he could validate the nonce when the token is validated.

Namespace
Microsoft.AspNetCore.Antiforgery
Assemblies
  • Microsoft.AspNetCore.Antiforgery

Syntax

public interface IAntiforgeryAdditionalDataProvider
interface Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider

Methods

GetAdditionalData(Microsoft.AspNetCore.Http.HttpContext)

Provides additional data to be stored for the antiforgery tokens generated during this request.

Arguments:context (Microsoft.AspNetCore.Http.HttpContext) – Information about the current request.
Return type:System.String
Returns:Supplemental data to embed within the antiforgery token.
string GetAdditionalData(HttpContext context)
ValidateAdditionalData(Microsoft.AspNetCore.Http.HttpContext, System.String)

Validates additional data that was embedded inside an incoming antiforgery token.

Arguments:
Return type:

System.Boolean

Returns:

True if the data is valid; false if the data is invalid.

bool ValidateAdditionalData(HttpContext context, string additionalData)