Configure tolken provider
This commit is contained in:
@@ -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),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user