Пример #1
0
        public void Password_Can_Be_Hashed_And_Verified()
        {
            var correctPassword   = "******";
            var incorrectPassword = "******";

            var hashedPassword = _service.GetHashedPassword(correctPassword);

            Assert.IsTrue(_service.Verify(correctPassword, hashedPassword));
            Assert.IsFalse(_service.Verify(correctPassword, incorrectPassword));
        }
Пример #2
0
 public User GetByCredentials(string username, string inputPassword)
 {
     return(Query().Where(u => u.Username == username)
            .AsEnumerable()
            .Where(u => PasswordHashService.Verify(inputPassword, u.Password)).FirstOrDefault());
 }