// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Antiforgery
{
///
/// The antiforgery token pair (cookie and request token) for a request.
///
public class AntiforgeryTokenSet
{
///
/// Creates the antiforgery token pair (cookie and request token) for a request.
///
/// The token that is supplied in the request.
/// The token that is supplied in the request cookie.
/// The name of the form field used for the request token.
/// The name of the header used for the request token.
public AntiforgeryTokenSet(
string requestToken,
string cookieToken,
string formFieldName,
string headerName)
{
if (formFieldName == null)
{
throw new ArgumentNullException(nameof(formFieldName));
}
RequestToken = requestToken;
CookieToken = cookieToken;
FormFieldName = formFieldName;
HeaderName = headerName;
}
///
/// Gets the request token.
///
public string RequestToken { get; }
///
/// Gets the name of the form field used for the request token.
///
public string FormFieldName { get; }
///
/// Gets the name of the header used for the request token.
///
public string HeaderName { get; }
///
/// Gets the cookie token.
///
public string CookieToken { get; }
}
}