Configure tolken provider

This commit is contained in:
2016-09-23 21:23:33 -04:00
parent 0b5dde065a
commit f473c64540
4 changed files with 19 additions and 8 deletions
@@ -1,11 +1,14 @@
using System;
using InventoryTraker.Web.Core;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security.DataProtection;
namespace InventoryTraker.Web.Identity
{
public class ApplicationUserManager : UserManager<User>
{
public ApplicationUserManager(IUserStore<User> store)
public ApplicationUserManager(IUserStore<User> store, IDataProtectionProvider dataProtectionProvider)
: base(store)
{
UserValidator = new UserValidator<User>(this)
@@ -13,6 +16,15 @@ namespace InventoryTraker.Web.Identity
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
if (dataProtectionProvider != null)
{
var dataProtector = dataProtectionProvider.Create("Protector");
UserTokenProvider = new DataProtectorTokenProvider<User, string>(dataProtector)
{
TokenLifespan = TimeSpan.FromHours(1),
};
}
}
}
}