Files
InventoryTracker/InventoryTraker.Web/Identity/ApplicationUserManager.cs
T
2016-09-23 21:23:33 -04:00

30 lines
791 B
C#

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, IDataProtectionProvider dataProtectionProvider)
: base(store)
{
UserValidator = new UserValidator<User>(this)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
if (dataProtectionProvider != null)
{
var dataProtector = dataProtectionProvider.Create("Protector");
UserTokenProvider = new DataProtectorTokenProvider<User, string>(dataProtector)
{
TokenLifespan = TimeSpan.FromHours(1),
};
}
}
}
}