public List <AppUserClaim> GetUserClaims(AppUser authUser)
        {
            List <AppUserClaim> list = new List <AppUserClaim> ();

            try {
                using (var db = new PtcDbContext()) {
                    list = db.Claims.Where(u => u.UserId == authUser.UserId).ToList();
                }
            } catch (Exception ex) {
                throw new Exception("Exception trying to retrieve user claims", ex);
            }

            return(list);
        }
        public AppUserAuth ValidateUser(AppUser user)
        {
            AppUserAuth ret      = new AppUserAuth();
            AppUser     authUser = null;

            using (var db = new PtcDbContext())
            {
                authUser = db.Users.Where(u => u.UserName.ToLower() == user.UserName.ToLower() && u.Password == user.Password).FirstOrDefault();
            }

            if (authUser != null)
            {
                ret = BuildUserAuthObject(authUser);
            }

            return(ret);
        }
        public AppUserAuth ValidateUser(AppUser user)
        {
            var     ret      = new AppUserAuth();
            AppUser authUser = null;

            using (var db = new PtcDbContext())
            {
                // Attempt to validate user
                authUser = db.Users.FirstOrDefault(u => u.Password == user.Password);
            }

            if (authUser != null)
            {
                // Build user security object
                ret = BuildUserAuthObject(authUser);
            }

            return(ret);
        }