public static void Seed(GMSContext context) { //Usuario u = new Usuario(); //u.Nome = "Administrador"; //u.Sobrenome = "do Site"; //u.Login = "******"; //u.Senha = Criptografia.Codificador("GMS"); //u.Email = "*****@*****.**"; //u.Ativo = true; //u.Admin = true; //context.Usuarios.AddOrUpdate(u); }
public void Configuration(IAppBuilder app) { app.CreatePerOwinContext(() => GMSContext.Create()); app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create); app.CreatePerOwinContext <ApplicationSignInManager>(ApplicationSignInManager.Create); app.CreatePerOwinContext <ApplicationRoleManager>(ApplicationRoleManager.Create); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity <ApplicationUserManager, ApplicationUser, int>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager), getUserIdCallback: (id) => (id.GetUserId <int>())) } }); }