Update Security to account for DataProtector API changes.

This commit is contained in:
Levi B 2014-10-10 12:21:08 -07:00
parent 9e2f992479
commit 2e65a40555
3 changed files with 7 additions and 6 deletions

View File

@ -13,7 +13,8 @@ namespace Microsoft.AspNet.Security.DataProtection
{
if (dataProtectionProvider == null)
{
dataProtectionProvider = DataProtectionProvider.CreateFromDpapi();
// TODO: Get this from the environment.
dataProtectionProvider = new EphemeralDataProtectionProvider();
}
return dataProtectionProvider.CreateProtector(string.Join(";", purposes));

View File

@ -215,7 +215,7 @@ namespace Microsoft.AspNet.Security.Google
[Fact]
public async Task ReplyPathWillAuthenticateValidAuthorizeCodeAndState()
{
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(DataProtectionProvider.CreateNew().CreateProtector("GoogleTest"));
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(new EphemeralDataProtectionProvider().CreateProtector("GoogleTest"));
var server = CreateServer(options =>
{
options.ClientId = "Test Id";
@ -289,7 +289,7 @@ namespace Microsoft.AspNet.Security.Google
[Fact]
public async Task ReplyPathWillRejectIfCodeIsInvalid()
{
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(DataProtectionProvider.CreateNew().CreateProtector("GoogleTest"));
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(new EphemeralDataProtectionProvider().CreateProtector("GoogleTest"));
var server = CreateServer(options =>
{
options.ClientId = "Test Id";
@ -319,7 +319,7 @@ namespace Microsoft.AspNet.Security.Google
[Fact]
public async Task ReplyPathWillRejectIfAccessTokenIsMissing()
{
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(DataProtectionProvider.CreateNew().CreateProtector("GoogleTest"));
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(new EphemeralDataProtectionProvider().CreateProtector("GoogleTest"));
var server = CreateServer(options =>
{
options.ClientId = "Test Id";
@ -349,7 +349,7 @@ namespace Microsoft.AspNet.Security.Google
[Fact]
public async Task AuthenticatedEventCanGetRefreshToken()
{
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(DataProtectionProvider.CreateNew().CreateProtector("GoogleTest"));
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(new EphemeralDataProtectionProvider().CreateProtector("GoogleTest"));
var server = CreateServer(options =>
{
options.ClientId = "Test Id";

View File

@ -84,7 +84,7 @@ namespace Microsoft.AspNet.Security.Tests.MicrosoftAccount
[Fact]
public async Task AuthenticatedEventCanGetRefreshToken()
{
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(DataProtectionProvider.CreateNew().CreateProtector("MsftTest"));
ISecureDataFormat<AuthenticationProperties> stateFormat = new PropertiesDataFormat(new EphemeralDataProtectionProvider().CreateProtector("MsftTest"));
var server = CreateServer(
options =>
{