React to changes in DataProtection
This commit is contained in:
parent
ddde171fcb
commit
c237f8989a
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
@ -19,7 +20,9 @@ namespace Microsoft.AspNetCore.Antiforgery.Internal
|
||||||
// Arrange
|
// Arrange
|
||||||
var serviceCollection = new ServiceCollection();
|
var serviceCollection = new ServiceCollection();
|
||||||
serviceCollection.AddAntiforgery();
|
serviceCollection.AddAntiforgery();
|
||||||
serviceCollection.AddDataProtection(o => o.SetApplicationName(applicationId));
|
serviceCollection
|
||||||
|
.AddDataProtection()
|
||||||
|
.SetApplicationName(applicationId);
|
||||||
|
|
||||||
var services = serviceCollection.BuildServiceProvider();
|
var services = serviceCollection.BuildServiceProvider();
|
||||||
var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>();
|
var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>();
|
||||||
|
|
@ -42,7 +45,9 @@ namespace Microsoft.AspNetCore.Antiforgery.Internal
|
||||||
o.CookieName = "antiforgery";
|
o.CookieName = "antiforgery";
|
||||||
});
|
});
|
||||||
serviceCollection.AddAntiforgery();
|
serviceCollection.AddAntiforgery();
|
||||||
serviceCollection.AddDataProtection(o => o.SetApplicationName("HelloWorldApp"));
|
serviceCollection
|
||||||
|
.AddDataProtection()
|
||||||
|
.SetApplicationName("HelloWorldApp");
|
||||||
|
|
||||||
var services = serviceCollection.BuildServiceProvider();
|
var services = serviceCollection.BuildServiceProvider();
|
||||||
var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>();
|
var options = services.GetRequiredService<IOptions<AntiforgeryOptions>>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue