diff --git a/src/Microsoft.AspNet.Antiforgery/AntiforgeryOptions.cs b/src/Microsoft.AspNet.Antiforgery/AntiforgeryOptions.cs
index d8db3df2cb..6955481157 100644
--- a/src/Microsoft.AspNet.Antiforgery/AntiforgeryOptions.cs
+++ b/src/Microsoft.AspNet.Antiforgery/AntiforgeryOptions.cs
@@ -6,14 +6,14 @@ using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Antiforgery
{
///
- /// Provides programmatic configuration for the anti-forgery token system.
+ /// Provides programmatic configuration for the antiforgery token system.
///
public class AntiforgeryOptions
{
private const string AntiforgeryTokenFieldName = "__RequestVerificationToken";
///
- /// Specifies the name of the cookie that is used by the anti-forgery
+ /// Specifies the name of the cookie that is used by the antiforgery
/// system.
///
///
@@ -23,16 +23,16 @@ namespace Microsoft.AspNet.Antiforgery
public string CookieName { get; [param: NotNull] set; }
///
- /// Specifies the name of the anti-forgery token field that is used by the anti-forgery system.
+ /// Specifies the name of the antiforgery token field that is used by the antiforgery system.
///
public string FormFieldName { get; [param: NotNull] set; } = AntiforgeryTokenFieldName;
///
- /// Specifies whether SSL is required for the anti-forgery system
+ /// Specifies whether SSL is required for the antiforgery system
/// to operate. If this setting is 'true' and a non-SSL request
- /// comes into the system, all anti-forgery APIs will fail.
+ /// comes into the system, all antiforgery APIs will fail.
///
- public bool RequireSSL { get; set; }
+ public bool RequireSsl { get; set; }
///
/// Specifies whether to suppress the generation of X-Frame-Options header
diff --git a/src/Microsoft.AspNet.Antiforgery/AntiforgeryTokenSet.cs b/src/Microsoft.AspNet.Antiforgery/AntiforgeryTokenSet.cs
index c18e15dd4f..973e6883e9 100644
--- a/src/Microsoft.AspNet.Antiforgery/AntiforgeryTokenSet.cs
+++ b/src/Microsoft.AspNet.Antiforgery/AntiforgeryTokenSet.cs
@@ -6,12 +6,12 @@ using System;
namespace Microsoft.AspNet.Antiforgery
{
///
- /// The anti-forgery token pair (cookie and form token) for a request.
+ /// The antiforgery token pair (cookie and form token) for a request.
///
public class AntiforgeryTokenSet
{
///
- /// Creates the anti-forgery token pair (cookie and form token) for a request.
+ /// Creates the antiforgery token pair (cookie and form token) for a request.
///
/// The token that is supplied in the request form body.
/// The token that is supplied in the request cookie.
diff --git a/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgery.cs b/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgery.cs
index aba5de914b..93bb6e855b 100644
--- a/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgery.cs
+++ b/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgery.cs
@@ -12,7 +12,7 @@ using Microsoft.Framework.WebEncoders;
namespace Microsoft.AspNet.Antiforgery
{
///
- /// Provides access to the anti-forgery system, which provides protection against
+ /// Provides access to the antiforgery system, which provides protection against
/// Cross-site Request Forgery (XSRF, also called CSRF) attacks.
///
public class DefaultAntiforgery : IAntiforgery
@@ -145,9 +145,12 @@ namespace Microsoft.AspNet.Antiforgery
private void CheckSSLConfig(HttpContext context)
{
- if (_options.RequireSSL && !context.Request.IsHttps)
+ if (_options.RequireSsl && !context.Request.IsHttps)
{
- throw new InvalidOperationException(Resources.AntiforgeryWorker_RequireSSL);
+ throw new InvalidOperationException(Resources.FormatAntiforgeryWorker_RequireSSL(
+ nameof(AntiforgeryOptions),
+ nameof(AntiforgeryOptions.RequireSsl),
+ "true"));
}
}
diff --git a/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenGenerator.cs b/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenGenerator.cs
index 6ecc8048fb..05ab540c4e 100644
--- a/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenGenerator.cs
+++ b/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenGenerator.cs
@@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using System.Security.Claims;
+using System.Security.Principal;
using Microsoft.AspNet.Http;
using Microsoft.Framework.OptionsModel;
@@ -73,7 +74,13 @@ namespace Microsoft.AspNet.Antiforgery
{
// Application says user is authenticated, but we have no identifier for the user.
throw new InvalidOperationException(
- Resources.FormatAntiforgeryTokenValidator_AuthenticatedUserWithoutUsername(identity.GetType()));
+ Resources.FormatAntiforgeryTokenValidator_AuthenticatedUserWithoutUsername(
+ identity.GetType(),
+ nameof(IIdentity.IsAuthenticated),
+ "true",
+ nameof(IIdentity.Name),
+ nameof(IAntiforgeryAdditionalDataProvider),
+ nameof(DefaultAntiforgeryAdditionalDataProvider)));
}
return formToken;
diff --git a/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenStore.cs b/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenStore.cs
index 7ea53b3d8b..833730e525 100644
--- a/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenStore.cs
+++ b/src/Microsoft.AspNet.Antiforgery/DefaultAntiforgeryTokenStore.cs
@@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Antiforgery
// Note: don't use "newCookie.Secure = _options.RequireSSL;" since the default
// value of newCookie.Secure is poulated out of band.
- if (_options.RequireSSL)
+ if (_options.RequireSsl)
{
options.Secure = true;
}
diff --git a/src/Microsoft.AspNet.Antiforgery/IAntiforgery.cs b/src/Microsoft.AspNet.Antiforgery/IAntiforgery.cs
index 2be08cacab..564dbd2b83 100644
--- a/src/Microsoft.AspNet.Antiforgery/IAntiforgery.cs
+++ b/src/Microsoft.AspNet.Antiforgery/IAntiforgery.cs
@@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Antiforgery
///
/// Generates an input field for an antiforgery token.
///
- /// The associated with the current call.
+ /// The associated with the current request.
///
/// A string containing an <input type="hidden"> element. This element should be put inside
/// a <form>.
@@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Antiforgery
/// Generates an for this request and stores the cookie token
/// in the response.
///
- /// The associated with the current call.
+ /// The associated with the current request.
/// An with tokens for the response.
///
/// This method has a side effect:
@@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Antiforgery
///
/// Generates an for this request.
///
- /// The associated with the current call.
+ /// The associated with the current request.
///
/// Unlike , this method has no side effect. The caller
/// is responsible for setting the response cookie and injecting the returned
@@ -53,13 +53,13 @@ namespace Microsoft.AspNet.Antiforgery
///
/// Validates an antiforgery token that was supplied as part of the request.
///
- /// The associated with the current call.
+ /// The associated with the current request.
Task ValidateRequestAsync([NotNull] HttpContext context);
///
/// Validates an for the current request.
///
- /// The associated with the current call.
+ /// The associated with the current request.
///
/// The (cookie and form token) for this request.
///
@@ -68,7 +68,7 @@ namespace Microsoft.AspNet.Antiforgery
///
/// Generates and stores an antiforgery cookie token if one is not available or not valid.
///
- /// The associated with the current call.
+ /// The associated with the current request.
void SetCookieTokenAndHeader([NotNull] HttpContext context);
}
}
diff --git a/src/Microsoft.AspNet.Antiforgery/IAntiforgeryAdditionalDataProvider.cs b/src/Microsoft.AspNet.Antiforgery/IAntiforgeryAdditionalDataProvider.cs
index fb609768bc..b652619dd9 100644
--- a/src/Microsoft.AspNet.Antiforgery/IAntiforgeryAdditionalDataProvider.cs
+++ b/src/Microsoft.AspNet.Antiforgery/IAntiforgeryAdditionalDataProvider.cs
@@ -6,29 +6,29 @@ using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.Antiforgery
{
///
- /// Allows providing or validating additional custom data for anti-forgery tokens.
+ /// 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.
///
///
- /// The anti-forgery system already embeds the client's username within the
+ /// The antiforgery system already embeds the client's username within the
/// generated tokens. This interface provides and consumes supplemental
- /// data. If an incoming anti-forgery token contains supplemental data but no
+ /// data. If an incoming antiforgery token contains supplemental data but no
/// additional data provider is configured, the supplemental data will not be
/// validated.
///
public interface IAntiforgeryAdditionalDataProvider
{
///
- /// Provides additional data to be stored for the anti-forgery tokens generated
+ /// Provides additional data to be stored for the antiforgery tokens generated
/// during this request.
///
/// Information about the current request.
- /// Supplemental data to embed within the anti-forgery token.
+ /// Supplemental data to embed within the antiforgery token.
string GetAdditionalData(HttpContext context);
///
- /// Validates additional data that was embedded inside an incoming anti-forgery
+ /// Validates additional data that was embedded inside an incoming antiforgery
/// token.
///
/// Information about the current request.
diff --git a/src/Microsoft.AspNet.Antiforgery/IAntiforgeryTokenSerializer.cs b/src/Microsoft.AspNet.Antiforgery/IAntiforgeryTokenSerializer.cs
index 4ba30c5591..1864906983 100644
--- a/src/Microsoft.AspNet.Antiforgery/IAntiforgeryTokenSerializer.cs
+++ b/src/Microsoft.AspNet.Antiforgery/IAntiforgeryTokenSerializer.cs
@@ -3,7 +3,7 @@
namespace Microsoft.AspNet.Antiforgery
{
- // Abstracts out the serialization process for an anti-forgery token
+ // Abstracts out the serialization process for an antiforgery token
public interface IAntiforgeryTokenSerializer
{
AntiforgeryToken Deserialize(string serializedToken);
diff --git a/src/Microsoft.AspNet.Antiforgery/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Antiforgery/Properties/Resources.Designer.cs
index af584b07c3..f012e4b91e 100644
--- a/src/Microsoft.AspNet.Antiforgery/Properties/Resources.Designer.cs
+++ b/src/Microsoft.AspNet.Antiforgery/Properties/Resources.Designer.cs
@@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Antiforgery
= new ResourceManager("Microsoft.AspNet.Antiforgery.Resources", typeof(Resources).GetTypeInfo().Assembly);
///
- /// The provided identity of type '{0}' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider or a custom type that can provide some form of unique identifier for the current user.
+ /// The provided identity of type '{0}' is marked {1} = {2} but does not have a value for {3}. By default, the antiforgery system requires that all authenticated identities have a unique {3}. If it is not possible to provide a unique {3} for this identity, consider extending {4} by overriding the {5} or a custom type that can provide some form of unique identifier for the current user.
///
internal static string AntiforgeryTokenValidator_AuthenticatedUserWithoutUsername
{
@@ -19,15 +19,15 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The provided identity of type '{0}' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider or a custom type that can provide some form of unique identifier for the current user.
+ /// The provided identity of type '{0}' is marked {1} = {2} but does not have a value for {3}. By default, the antiforgery system requires that all authenticated identities have a unique {3}. If it is not possible to provide a unique {3} for this identity, consider extending {4} by overriding the {5} or a custom type that can provide some form of unique identifier for the current user.
///
- internal static string FormatAntiforgeryTokenValidator_AuthenticatedUserWithoutUsername(object p0)
+ internal static string FormatAntiforgeryTokenValidator_AuthenticatedUserWithoutUsername(object p0, object p1, object p2, object p3, object p4, object p5)
{
- return string.Format(CultureInfo.CurrentCulture, GetString("AntiforgeryTokenValidator_AuthenticatedUserWithoutUsername"), p0);
+ return string.Format(CultureInfo.CurrentCulture, GetString("AntiforgeryTokenValidator_AuthenticatedUserWithoutUsername"), p0, p1, p2, p3, p4, p5);
}
///
- /// The provided anti-forgery token failed a custom data check.
+ /// The provided antiforgery token failed a custom data check.
///
internal static string AntiforgeryToken_AdditionalDataCheckFailed
{
@@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The provided anti-forgery token failed a custom data check.
+ /// The provided antiforgery token failed a custom data check.
///
internal static string FormatAntiforgeryToken_AdditionalDataCheckFailed()
{
@@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The provided anti-forgery token was meant for a different claims-based user than the current user.
+ /// The provided antiforgery token was meant for a different claims-based user than the current user.
///
internal static string AntiforgeryToken_ClaimUidMismatch
{
@@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The provided anti-forgery token was meant for a different claims-based user than the current user.
+ /// The provided antiforgery token was meant for a different claims-based user than the current user.
///
internal static string FormatAntiforgeryToken_ClaimUidMismatch()
{
@@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The required anti-forgery cookie "{0}" is not present.
+ /// The required antiforgery cookie "{0}" is not present.
///
internal static string AntiforgeryToken_CookieMissing
{
@@ -67,7 +67,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The required anti-forgery cookie "{0}" is not present.
+ /// The required antiforgery cookie "{0}" is not present.
///
internal static string FormatAntiforgeryToken_CookieMissing(object p0)
{
@@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The anti-forgery token could not be decrypted.
+ /// The antiforgery token could not be decrypted.
///
internal static string AntiforgeryToken_DeserializationFailed
{
@@ -83,7 +83,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The anti-forgery token could not be decrypted.
+ /// The antiforgery token could not be decrypted.
///
internal static string FormatAntiforgeryToken_DeserializationFailed()
{
@@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The required anti-forgery form field "{0}" is not present.
+ /// The required antiforgery form field "{0}" is not present.
///
internal static string AntiforgeryToken_FormFieldMissing
{
@@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The required anti-forgery form field "{0}" is not present.
+ /// The required antiforgery form field "{0}" is not present.
///
internal static string FormatAntiforgeryToken_FormFieldMissing(object p0)
{
@@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The anti-forgery cookie token and form field token do not match.
+ /// The antiforgery cookie token and form field token do not match.
///
internal static string AntiforgeryToken_SecurityTokenMismatch
{
@@ -115,7 +115,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The anti-forgery cookie token and form field token do not match.
+ /// The antiforgery cookie token and form field token do not match.
///
internal static string FormatAntiforgeryToken_SecurityTokenMismatch()
{
@@ -123,7 +123,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// Validation of the provided anti-forgery token failed. The cookie "{0}" and the form field "{1}" were swapped.
+ /// Validation of the provided antiforgery token failed. The cookie "{0}" and the form field "{1}" were swapped.
///
internal static string AntiforgeryToken_TokensSwapped
{
@@ -131,7 +131,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// Validation of the provided anti-forgery token failed. The cookie "{0}" and the form field "{1}" were swapped.
+ /// Validation of the provided antiforgery token failed. The cookie "{0}" and the form field "{1}" were swapped.
///
internal static string FormatAntiforgeryToken_TokensSwapped(object p0, object p1)
{
@@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The provided anti-forgery token was meant for user "{0}", but the current user is "{1}".
+ /// The provided antiforgery token was meant for user "{0}", but the current user is "{1}".
///
internal static string AntiforgeryToken_UsernameMismatch
{
@@ -147,7 +147,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The provided anti-forgery token was meant for user "{0}", but the current user is "{1}".
+ /// The provided antiforgery token was meant for user "{0}", but the current user is "{1}".
///
internal static string FormatAntiforgeryToken_UsernameMismatch(object p0, object p1)
{
@@ -155,7 +155,7 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, but the current request is not an SSL request.
+ /// The antiforgery system has the configuration value {0}.{1} = {2}, but the current request is not an SSL request.
///
internal static string AntiforgeryWorker_RequireSSL
{
@@ -163,11 +163,11 @@ namespace Microsoft.AspNet.Antiforgery
}
///
- /// The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, but the current request is not an SSL request.
+ /// The antiforgery system has the configuration value {0}.{1} = {2}, but the current request is not an SSL request.
///
- internal static string FormatAntiforgeryWorker_RequireSSL()
+ internal static string FormatAntiforgeryWorker_RequireSSL(object p0, object p1, object p2)
{
- return GetString("AntiforgeryWorker_RequireSSL");
+ return string.Format(CultureInfo.CurrentCulture, GetString("AntiforgeryWorker_RequireSSL"), p0, p1, p2);
}
///
diff --git a/src/Microsoft.AspNet.Antiforgery/Resources.resx b/src/Microsoft.AspNet.Antiforgery/Resources.resx
index e666385354..2cad9e6cf6 100644
--- a/src/Microsoft.AspNet.Antiforgery/Resources.resx
+++ b/src/Microsoft.AspNet.Antiforgery/Resources.resx
@@ -118,34 +118,36 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- The provided identity of type '{0}' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider or a custom type that can provide some form of unique identifier for the current user.
+ The provided identity of type '{0}' is marked {1} = {2} but does not have a value for {3}. By default, the antiforgery system requires that all authenticated identities have a unique {3}. If it is not possible to provide a unique {3} for this identity, consider extending {4} by overriding the {5} or a custom type that can provide some form of unique identifier for the current user.
+ 0 = typeof(identity), 1 = nameof(IsAuthenticated), 2 = bool.TrueString, 3 = nameof(Name), 4 = nameof(IAdditionalDataProvider), 5 = nameof(DefaultAdditionalDataProvider)
- The provided anti-forgery token failed a custom data check.
+ The provided antiforgery token failed a custom data check.
- The provided anti-forgery token was meant for a different claims-based user than the current user.
+ The provided antiforgery token was meant for a different claims-based user than the current user.
- The required anti-forgery cookie "{0}" is not present.
+ The required antiforgery cookie "{0}" is not present.
- The anti-forgery token could not be decrypted.
+ The antiforgery token could not be decrypted.
- The required anti-forgery form field "{0}" is not present.
+ The required antiforgery form field "{0}" is not present.
- The anti-forgery cookie token and form field token do not match.
+ The antiforgery cookie token and form field token do not match.
- Validation of the provided anti-forgery token failed. The cookie "{0}" and the form field "{1}" were swapped.
+ Validation of the provided antiforgery token failed. The cookie "{0}" and the form field "{1}" were swapped.
- The provided anti-forgery token was meant for user "{0}", but the current user is "{1}".
+ The provided antiforgery token was meant for user "{0}", but the current user is "{1}".
- The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, but the current request is not an SSL request.
+ The antiforgery system has the configuration value {0}.{1} = {2}, but the current request is not an SSL request.
+ 0 = nameof(AntiforgeryOptions), 1 = nameof(RequireSsl), 2 = bool.TrueString
Value cannot be null or empty.
diff --git a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTest.cs b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTest.cs
index ee297fe0d8..c775e5cd36 100644
--- a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTest.cs
+++ b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTest.cs
@@ -15,7 +15,7 @@ using Xunit;
namespace Microsoft.AspNet.Antiforgery
{
- public class AntiforgeryTest
+ public class DefaultAntiforgeryTest
{
[Fact]
public async Task ChecksSSL_ValidateRequestAsync_Throws()
@@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
- RequireSSL = true
+ RequireSsl = true
};
var antiforgery = GetAntiforgery(options);
@@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = await Assert.ThrowsAsync(
async () => await antiforgery.ValidateRequestAsync(httpContext));
Assert.Equal(
- @"The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
+ @"The antiforgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
"but the current request is not an SSL request.",
exception.Message);
}
@@ -47,7 +47,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
- RequireSSL = true
+ RequireSsl = true
};
var antiforgery = GetAntiforgery(options);
@@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => antiforgery.ValidateTokens(httpContext, new AntiforgeryTokenSet("hello", "world")));
Assert.Equal(
- @"The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
+ @"The antiforgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
"but the current request is not an SSL request.",
exception.Message);
}
@@ -69,7 +69,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
- RequireSSL = true
+ RequireSsl = true
};
var antiforgery = GetAntiforgery(options);
@@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => antiforgery.GetHtml(httpContext));
Assert.Equal(
- @"The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
+ @"The antiforgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
"but the current request is not an SSL request.",
exception.Message);
}
@@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
- RequireSSL = true
+ RequireSsl = true
};
var antiforgery = GetAntiforgery(options);
@@ -100,7 +100,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => antiforgery.GetAndStoreTokens(httpContext));
Assert.Equal(
- @"The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
+ @"The antiforgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
"but the current request is not an SSL request.",
exception.Message);
}
@@ -113,7 +113,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
- RequireSSL = true
+ RequireSsl = true
};
var antiforgery = GetAntiforgery(options);
@@ -122,7 +122,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => antiforgery.GetTokens(httpContext));
Assert.Equal(
- @"The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
+ @"The antiforgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
"but the current request is not an SSL request.",
exception.Message);
}
@@ -135,7 +135,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
- RequireSSL = true
+ RequireSsl = true
};
var antiforgery = GetAntiforgery(options);
@@ -144,7 +144,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => antiforgery.SetCookieTokenAndHeader(httpContext));
Assert.Equal(
- @"The anti-forgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
+ @"The antiforgery system has the configuration value AntiforgeryOptions.RequireSsl = true, " +
"but the current request is not an SSL request.",
exception.Message);
}
diff --git a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenGeneratorTest.cs b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenGeneratorTest.cs
index 905a1444a9..8412e95208 100644
--- a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenGeneratorTest.cs
@@ -85,9 +85,10 @@ namespace Microsoft.AspNet.Antiforgery
"The provided identity of type " +
$"'{typeof(MyAuthenticatedIdentityWithoutUsername).FullName}' " +
"is marked IsAuthenticated = true but does not have a value for Name. " +
- "By default, the anti-forgery system requires that all authenticated identities have a unique Name. " +
+ "By default, the antiforgery system requires that all authenticated identities have a unique Name. " +
"If it is not possible to provide a unique Name for this identity, " +
- "consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider " +
+ "consider extending IAntiforgeryAdditionalDataProvider by overriding the " +
+ "DefaultAntiforgeryAdditionalDataProvider " +
"or a custom type that can provide some form of unique identifier for the current user.",
exception.Message);
}
@@ -281,7 +282,7 @@ namespace Microsoft.AspNet.Antiforgery
var ex =
Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, null, fieldtoken));
- Assert.Equal(@"The required anti-forgery cookie ""my-cookie-name"" is not present.", ex.Message);
+ Assert.Equal(@"The required antiforgery cookie ""my-cookie-name"" is not present.", ex.Message);
}
[Fact]
@@ -307,7 +308,7 @@ namespace Microsoft.AspNet.Antiforgery
var ex =
Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, sessionToken, null));
- Assert.Equal(@"The required anti-forgery form field ""my-form-field-name"" is not present.", ex.Message);
+ Assert.Equal(@"The required antiforgery form field ""my-form-field-name"" is not present.", ex.Message);
}
[Fact]
@@ -336,7 +337,7 @@ namespace Microsoft.AspNet.Antiforgery
Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, fieldtoken, fieldtoken));
Assert.Equal(
- "Validation of the provided anti-forgery token failed. " +
+ "Validation of the provided antiforgery token failed. " +
@"The cookie ""my-cookie-name"" and the form field ""my-form-field-name"" were swapped.",
ex1.Message);
@@ -344,7 +345,7 @@ namespace Microsoft.AspNet.Antiforgery
Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, sessionToken, sessionToken));
Assert.Equal(
- "Validation of the provided anti-forgery token failed. " +
+ "Validation of the provided antiforgery token failed. " +
@"The cookie ""my-cookie-name"" and the form field ""my-form-field-name"" were swapped.",
ex2.Message);
}
@@ -368,7 +369,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, sessionToken, fieldtoken));
Assert.Equal(
- @"The anti-forgery cookie token and form field token do not match.",
+ @"The antiforgery cookie token and form field token do not match.",
exception.Message);
}
@@ -406,7 +407,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, sessionToken, fieldtoken));
Assert.Equal(
- @"The provided anti-forgery token was meant for user """ + embeddedUsername +
+ @"The provided antiforgery token was meant for user """ + embeddedUsername +
@""", but the current user is """ + identityUsername + @""".",
exception.Message);
}
@@ -441,7 +442,7 @@ namespace Microsoft.AspNet.Antiforgery
var exception = Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, sessionToken, fieldtoken));
Assert.Equal(
- @"The provided anti-forgery token was meant for a different claims-based user than the current user.",
+ @"The provided antiforgery token was meant for a different claims-based user than the current user.",
exception.Message);
}
@@ -474,7 +475,7 @@ namespace Microsoft.AspNet.Antiforgery
// Act & assert
var exception = Assert.Throws(
() => tokenProvider.ValidateTokens(httpContext, sessionToken, fieldtoken));
- Assert.Equal(@"The provided anti-forgery token failed a custom data check.", exception.Message);
+ Assert.Equal(@"The provided antiforgery token failed a custom data check.", exception.Message);
}
[Fact]
diff --git a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenSerializerTest.cs b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenSerializerTest.cs
index 45d4646fc2..54fadd4399 100644
--- a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenSerializerTest.cs
+++ b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenSerializerTest.cs
@@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Antiforgery
// Act & assert
var ex = Assert.Throws(() => testSerializer.Deserialize(serializedToken));
- Assert.Equal(@"The anti-forgery token could not be decrypted.", ex.Message);
+ Assert.Equal(@"The antiforgery token could not be decrypted.", ex.Message);
}
[Fact]
diff --git a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenStoreTest.cs b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenStoreTest.cs
index b1c251e5f2..d2bfc7b458 100644
--- a/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenStoreTest.cs
+++ b/test/Microsoft.AspNet.Antiforgery.Test/DefaultAntiforgeryTokenStoreTest.cs
@@ -286,7 +286,7 @@ namespace Microsoft.AspNet.Antiforgery
var options = new AntiforgeryOptions()
{
CookieName = _cookieName,
- RequireSSL = requireSsl
+ RequireSsl = requireSsl
};
var tokenStore = new DefaultAntiforgeryTokenStore(