React to WebEncoders changes.

This commit is contained in:
Chris R 2015-10-30 11:45:48 -07:00
parent ebcaeadf64
commit 84cfe5640d
4 changed files with 7 additions and 10 deletions

View File

@ -3,10 +3,10 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Text.Encodings.Web;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.Extensions.OptionsModel; using Microsoft.Extensions.OptionsModel;
using Microsoft.Extensions.WebEncoders;
namespace Microsoft.AspNet.Antiforgery namespace Microsoft.AspNet.Antiforgery
{ {
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Antiforgery
/// </summary> /// </summary>
public class DefaultAntiforgery : IAntiforgery public class DefaultAntiforgery : IAntiforgery
{ {
private readonly IHtmlEncoder _htmlEncoder; private readonly HtmlEncoder _htmlEncoder;
private readonly AntiforgeryOptions _options; private readonly AntiforgeryOptions _options;
private readonly IAntiforgeryTokenGenerator _tokenGenerator; private readonly IAntiforgeryTokenGenerator _tokenGenerator;
private readonly IAntiforgeryTokenSerializer _tokenSerializer; private readonly IAntiforgeryTokenSerializer _tokenSerializer;
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Antiforgery
IAntiforgeryTokenGenerator tokenGenerator, IAntiforgeryTokenGenerator tokenGenerator,
IAntiforgeryTokenSerializer tokenSerializer, IAntiforgeryTokenSerializer tokenSerializer,
IAntiforgeryTokenStore tokenStore, IAntiforgeryTokenStore tokenStore,
IHtmlEncoder htmlEncoder) HtmlEncoder htmlEncoder)
{ {
_options = antiforgeryOptionsAccessor.Value; _options = antiforgeryOptionsAccessor.Value;
_tokenGenerator = tokenGenerator; _tokenGenerator = tokenGenerator;
@ -50,9 +50,9 @@ namespace Microsoft.AspNet.Antiforgery
var inputTag = string.Format( var inputTag = string.Format(
"<input name=\"{0}\" type=\"{1}\" value=\"{2}\" />", "<input name=\"{0}\" type=\"{1}\" value=\"{2}\" />",
_htmlEncoder.HtmlEncode(_options.FormFieldName), _htmlEncoder.Encode(_options.FormFieldName),
_htmlEncoder.HtmlEncode("hidden"), _htmlEncoder.Encode("hidden"),
_htmlEncoder.HtmlEncode(tokenSet.FormToken)); _htmlEncoder.Encode(tokenSet.FormToken));
return inputTag; return inputTag;
} }

View File

@ -9,8 +9,6 @@
"Microsoft.AspNet.DataProtection": "1.0.0-*", "Microsoft.AspNet.DataProtection": "1.0.0-*",
"Microsoft.AspNet.Http.Abstractions": "1.0.0-*", "Microsoft.AspNet.Http.Abstractions": "1.0.0-*",
"Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.AspNet.WebUtilities": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*",
"Microsoft.Extensions.WebEncoders": "1.0.0-*" "Microsoft.Extensions.WebEncoders": "1.0.0-*"
}, },
"frameworks": { "frameworks": {

View File

@ -474,7 +474,7 @@ namespace Microsoft.AspNet.Antiforgery
tokenGenerator: tokenGenerator, tokenGenerator: tokenGenerator,
tokenSerializer: tokenSerializer, tokenSerializer: tokenSerializer,
tokenStore: tokenStore, tokenStore: tokenStore,
htmlEncoder: new CommonTestEncoder()); htmlEncoder: new HtmlTestEncoder());
} }
private HttpContext GetHttpContext() private HttpContext GetHttpContext()

View File

@ -3,7 +3,6 @@
"Microsoft.AspNet.Antiforgery": "1.0.0-*", "Microsoft.AspNet.Antiforgery": "1.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*", "Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.WebEncoders.Testing": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"commands": { "commands": {