IAntiForgeryAdditionalDataProvider Interface

IAntiForgeryAdditionalDataProvider Interface

Provides a way to include or validate custom data for anti-forgery tokens.

Namespace:  System.Web.Helpers
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

public interface IAntiForgeryAdditionalDataProvider

The IAntiForgeryAdditionalDataProvider type exposes the following members.

  NameDescription
Public methodGetAdditionalDataProvides additional data to store for the anti-forgery tokens that are generated during this request.
Public methodValidateAdditionalDataValidates additional data that was embedded inside an incoming anti-forgery token.
Top

The anti-forgery system already embeds the client's user name in the generated tokens. This interface lets you include and consume supplemental data. If an incoming anti-forgery token contains supplemental data but no additional data provider is configured, the supplemental data will not be validated.

As an example of how to use this interface, you could use the methods to supply a nonce when the token is generated and then validate the nonce when the token is validated.

Show:
© 2016 Microsoft