public override bool IsUserInRole(string username, string roleName) { //var clave = ConfigurationManager.AppSettings["ClaveCifrado"]; //var cif = SeguridadUtilidades.Cifrar(username, clave); using (var db=new taller01Entities()) { try { var us = db.Usuario.First(o => o.login == username); return us.Rol.nombre == roleName; } catch (Exception e) { return false; } } }
public override string[] GetRolesForUser(string username) { //var clave = ConfigurationManager.AppSettings["ClaveCifrado"]; //var cif = SeguridadUtilidades.Cifrar(username, clave); using (var db = new taller01Entities()) { try { var us = db.Usuario.First(o => o.login == username); return new []{ us.Rol.nombre}; } catch (Exception e) { return null; } } }
public override bool ValidateUser(string username, string password) { using (var db=new taller01Entities()) { var p = SeguridadUtilidades.GetSha1(password); return db.Usuario.Any(o => o.password == p && o.login==username); } }
public override MembershipUser GetUser(string username, bool userIsOnline) { using (var db = new taller01Entities()) { var user= db.Usuario.FirstOrDefault(o => o.login == username ); if (user == null) return null; return new UsuarioMembership(user); } }